1 /* Copyright (C) 2001, 2002 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 <http://www.gnu.org/licenses/>. */
18 #ifndef _SYS_UCONTEXT_H
19 #define _SYS_UCONTEXT_H 1
23 #include <bits/wordsize.h>
25 /* We need the signal context definitions even if they are not used
26 included in <signal.h>. */
27 #include <bits/sigcontext.h>
31 /* Type for general register. */
32 typedef long int greg_t
;
34 /* Number of general registers. */
37 /* Container for all general registers. */
38 typedef greg_t gregset_t
[NGREG
];
41 /* Number of each register in the `gregset_t' array. */
45 # define REG_R8 REG_R8
47 # define REG_R9 REG_R9
49 # define REG_R10 REG_R10
51 # define REG_R11 REG_R11
53 # define REG_R12 REG_R12
55 # define REG_R13 REG_R13
57 # define REG_R14 REG_R14
59 # define REG_R15 REG_R15
61 # define REG_RDI REG_RDI
63 # define REG_RSI REG_RSI
65 # define REG_RBP REG_RBP
67 # define REG_RBX REG_RBX
69 # define REG_RDX REG_RDX
71 # define REG_RAX REG_RAX
73 # define REG_RCX REG_RCX
75 # define REG_RSP REG_RSP
77 # define REG_RIP REG_RIP
79 # define REG_EFL REG_EFL
80 REG_CSGSFS
, /* Actually short cs, gs, fs, __pad0. */
81 # define REG_CSGSFS REG_CSGSFS
83 # define REG_ERR REG_ERR
85 # define REG_TRAPNO REG_TRAPNO
87 # define REG_OLDMASK REG_OLDMASK
89 # define REG_CR2 REG_CR2
95 unsigned short int significand
[4];
96 unsigned short int exponent
;
97 unsigned short int padding
[3];
102 __uint32_t element
[4];
107 /* 64-bit FXSAVE format. */
115 __uint32_t mxcr_mask
;
116 struct _libc_fpxreg _st
[8];
117 struct _libc_xmmreg _xmm
[16];
118 __uint32_t padding
[24];
121 /* Structure to describe FPU registers. */
122 typedef struct _libc_fpstate
*fpregset_t
;
124 /* Context to describe whole processor state. */
128 /* Note that fpregs is a pointer. */
130 unsigned long __reserved1
[8];
133 /* Userlevel context. */
134 typedef struct ucontext
136 unsigned long int uc_flags
;
137 struct ucontext
*uc_link
;
139 mcontext_t uc_mcontext
;
140 __sigset_t uc_sigmask
;
141 struct _libc_fpstate __fpregs_mem
;
144 #else /* __WORDSIZE == 32 */
146 /* Type for general register. */
149 /* Number of general registers. */
152 /* Container for all general registers. */
153 typedef greg_t gregset_t
[NGREG
];
156 /* Number of each register is the `gregset_t' array. */
160 # define REG_GS REG_GS
162 # define REG_FS REG_FS
164 # define REG_ES REG_ES
166 # define REG_DS REG_DS
168 # define REG_EDI REG_EDI
170 # define REG_ESI REG_ESI
172 # define REG_EBP REG_EBP
174 # define REG_ESP REG_ESP
176 # define REG_EBX REG_EBX
178 # define REG_EDX REG_EDX
180 # define REG_ECX REG_ECX
182 # define REG_EAX REG_EAX
184 # define REG_TRAPNO REG_TRAPNO
186 # define REG_ERR REG_ERR
188 # define REG_EIP REG_EIP
190 # define REG_CS REG_CS
192 # define REG_EFL REG_EFL
194 # define REG_UESP REG_UESP
196 # define REG_SS REG_SS
200 /* Definitions taken from the kernel headers. */
203 unsigned short int significand
[4];
204 unsigned short int exponent
;
209 unsigned long int cw
;
210 unsigned long int sw
;
211 unsigned long int tag
;
212 unsigned long int ipoff
;
213 unsigned long int cssel
;
214 unsigned long int dataoff
;
215 unsigned long int datasel
;
216 struct _libc_fpreg _st
[8];
217 unsigned long int status
;
220 /* Structure to describe FPU registers. */
221 typedef struct _libc_fpstate
*fpregset_t
;
223 /* Context to describe whole processor state. */
227 /* Due to Linux's history we have to use a pointer here. The SysV/i386
228 ABI requires a struct with the values. */
230 unsigned long int oldmask
;
231 unsigned long int cr2
;
234 /* Userlevel context. */
235 typedef struct ucontext
237 unsigned long int uc_flags
;
238 struct ucontext
*uc_link
;
240 mcontext_t uc_mcontext
;
241 __sigset_t uc_sigmask
;
242 struct _libc_fpstate __fpregs_mem
;
245 #endif /* __WORDSIZE == 32 */
247 #endif /* sys/ucontext.h */