1 /* Copyright (C) 1997-2023 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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/>. */
18 /* System V/i386 ABI compliant context switching support. */
20 #ifndef _SYS_UCONTEXT_H
21 #define _SYS_UCONTEXT_H 1
25 #include <bits/types/sigset_t.h>
26 #include <bits/types/stack_t.h>
29 /* Type for general register. */
32 /* Number of general registers. */
35 # define NGREG __NGREG
38 /* Container for all general registers. */
39 typedef greg_t gregset_t
[__NGREG
];
42 /* Number of each register is the `gregset_t' array. */
46 # define REG_GS REG_GS
48 # define REG_FS REG_FS
50 # define REG_ES REG_ES
52 # define REG_DS REG_DS
54 # define REG_EDI REG_EDI
56 # define REG_ESI REG_ESI
58 # define REG_EBP REG_EBP
60 # define REG_ESP REG_ESP
62 # define REG_EBX REG_EBX
64 # define REG_EDX REG_EDX
66 # define REG_ECX REG_ECX
68 # define REG_EAX REG_EAX
70 # define REG_TRAPNO REG_TRAPNO
72 # define REG_ERR REG_ERR
74 # define REG_EIP REG_EIP
76 # define REG_CS REG_CS
78 # define REG_EFL REG_EFL
80 # define REG_UESP REG_UESP
82 # define REG_SS REG_SS
87 # define __ctx(fld) fld
88 # define __ctxt(tag) tag
90 # define __ctx(fld) __ ## fld
91 # define __ctxt(tag) /* Empty. */
94 /* Structure to describe FPU registers. */
99 struct __ctxt(fpchip_state
)
101 int __ctx(state
)[27];
103 } __ctx(fpchip_state
);
105 struct __ctxt(fp_emul_space
)
107 char __ctx(fp_emul
)[246];
108 char __ctx(fp_epad
)[2];
109 } __ctx(fp_emul_space
);
111 int __ctx(f_fpregs
)[62];
114 long int __ctx(f_wregs
)[33];
117 /* Context to describe whole processor state. */
120 gregset_t
__ctx(gregs
);
121 fpregset_t
__ctx(fpregs
);
124 /* Userlevel context. */
125 typedef struct ucontext_t
127 unsigned long int __ctx(uc_flags
);
128 struct ucontext_t
*uc_link
;
131 mcontext_t uc_mcontext
;
132 long int __glibc_reserved1
[5];
138 #endif /* sys/ucontext.h */