Warning: This file is not a C or C++ file. It does not have highlighting.

1/* Copyright (C) 1997-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18/* System V/i386 ABI compliant context switching support. */
19
20#ifndef _SYS_UCONTEXT_H
21#define _SYS_UCONTEXT_H 1
22
23#include <features.h>
24
25#include <bits/types/sigset_t.h>
26#include <bits/types/stack_t.h>
27
28
29/* Type for general register. */
30typedef int greg_t;
31
32/* Number of general registers. */
33#define __NGREG 19
34#ifdef __USE_MISC
35# define NGREG __NGREG
36#endif
37
38/* Container for all general registers. */
39typedef greg_t gregset_t[__NGREG];
40
41#ifdef __USE_MISC
42/* Number of each register is the `gregset_t' array. */
43enum
44{
45 REG_GS = 0,
46# define REG_GS REG_GS
47 REG_FS,
48# define REG_FS REG_FS
49 REG_ES,
50# define REG_ES REG_ES
51 REG_DS,
52# define REG_DS REG_DS
53 REG_EDI,
54# define REG_EDI REG_EDI
55 REG_ESI,
56# define REG_ESI REG_ESI
57 REG_EBP,
58# define REG_EBP REG_EBP
59 REG_ESP,
60# define REG_ESP REG_ESP
61 REG_EBX,
62# define REG_EBX REG_EBX
63 REG_EDX,
64# define REG_EDX REG_EDX
65 REG_ECX,
66# define REG_ECX REG_ECX
67 REG_EAX,
68# define REG_EAX REG_EAX
69 REG_TRAPNO,
70# define REG_TRAPNO REG_TRAPNO
71 REG_ERR,
72# define REG_ERR REG_ERR
73 REG_EIP,
74# define REG_EIP REG_EIP
75 REG_CS,
76# define REG_CS REG_CS
77 REG_EFL,
78# define REG_EFL REG_EFL
79 REG_UESP,
80# define REG_UESP REG_UESP
81 REG_SS
82# define REG_SS REG_SS
83};
84#endif
85
86#ifdef __USE_MISC
87# define __ctx(fld) fld
88# define __ctxt(tag) tag
89#else
90# define __ctx(fld) __ ## fld
91# define __ctxt(tag) /* Empty. */
92#endif
93
94/* Structure to describe FPU registers. */
95typedef struct
96 {
97 union
98 {
99 struct __ctxt(fpchip_state)
100 {
101 int __ctx(state)[27];
102 int __ctx(status);
103 } __ctx(fpchip_state);
104
105 struct __ctxt(fp_emul_space)
106 {
107 char __ctx(fp_emul)[246];
108 char __ctx(fp_epad)[2];
109 } __ctx(fp_emul_space);
110
111 int __ctx(f_fpregs)[62];
112 } __ctx(fp_reg_set);
113
114 long int __ctx(f_wregs)[33];
115 } fpregset_t;
116
117/* Context to describe whole processor state. */
118typedef struct
119 {
120 gregset_t __ctx(gregs);
121 fpregset_t __ctx(fpregs);
122 } mcontext_t;
123
124/* Userlevel context. */
125typedef struct ucontext_t
126 {
127 unsigned long int __ctx(uc_flags);
128 struct ucontext_t *uc_link;
129 sigset_t uc_sigmask;
130 stack_t uc_stack;
131 mcontext_t uc_mcontext;
132 long int __glibc_reserved1[5];
133 } ucontext_t;
134
135#undef __ctx
136#undef __ctxt
137
138#endif /* sys/ucontext.h */
139

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of glibc/sysdeps/i386/sys/ucontext.h