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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 #ifndef _SYS_UCONTEXT_H
20 #define _SYS_UCONTEXT_H 1
24 #include <bits/wordsize.h>
26 /* We need the signal context definitions even if they are not used
27 included in <signal.h>. */
28 #include <bits/sigcontext.h>
32 /* Type for general register. */
33 typedef long int greg_t;
35 /* Number of general registers. */
38 /* Container for all general registers. */
39 typedef greg_t gregset_t[NGREG];
42 /* Number of each register in the `gregset_t' array. */
46 # define REG_R8 REG_R8
48 # define REG_R9 REG_R9
50 # define REG_R10 REG_R10
52 # define REG_R11 REG_R11
54 # define REG_R12 REG_R12
56 # define REG_R13 REG_R13
58 # define REG_R14 REG_R14
60 # define REG_R15 REG_R15
62 # define REG_RDI REG_RDI
64 # define REG_RSI REG_RSI
66 # define REG_RBP REG_RBP
68 # define REG_RBX REG_RBX
70 # define REG_RDX REG_RDX
72 # define REG_RAX REG_RAX
74 # define REG_RCX REG_RCX
76 # define REG_RSP REG_RSP
78 # define REG_RIP REG_RIP
80 # define REG_EFL REG_EFL
81 REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */
82 # define REG_CSGSFS REG_CSGSFS
84 # define REG_ERR REG_ERR
86 # define REG_TRAPNO REG_TRAPNO
92 unsigned short int significand[4];
93 unsigned short int exponent;
94 unsigned short int padding[3];
99 __uint32_t element[4];
104 /* 64-bit FXSAVE format. */
112 __uint32_t mxcr_mask;
113 struct _libc_fpxreg _st[8];
114 struct _libc_xmmreg _xmm[16];
115 __uint32_t padding[24];
118 /* Structure to describe FPU registers. */
119 typedef struct _libc_fpstate *fpregset_t;
121 /* Context to describe whole processor state. */
125 /* Note that fpregs is a pointer. */
127 unsigned long __reserved1 [8];
130 /* Userlevel context. */
131 typedef struct ucontext
133 unsigned long int uc_flags;
134 struct ucontext *uc_link;
136 mcontext_t uc_mcontext;
137 __sigset_t uc_sigmask;
138 struct _libc_fpstate __fpregs_mem;
141 #else /* __WORDSIZE == 32 */
143 /* Type for general register. */
146 /* Number of general registers. */
149 /* Container for all general registers. */
150 typedef greg_t gregset_t[NGREG];
153 /* Number of each register is the `gregset_t' array. */
157 # define REG_GS REG_GS
159 # define REG_FS REG_FS
161 # define REG_ES REG_ES
163 # define REG_DS REG_DS
165 # define REG_EDI REG_EDI
167 # define REG_ESI REG_ESI
169 # define REG_EBP REG_EBP
171 # define REG_ESP REG_ESP
173 # define REG_EBX REG_EBX
175 # define REG_EDX REG_EDX
177 # define REG_ECX REG_ECX
179 # define REG_EAX REG_EAX
181 # define REG_TRAPNO REG_TRAPNO
183 # define REG_ERR REG_ERR
185 # define REG_EIP REG_EIP
187 # define REG_CS REG_CS
189 # define REG_EFL REG_EFL
191 # define REG_UESP REG_UESP
193 # define REG_SS REG_SS
197 /* Definitions taken from the kernel headers. */
200 unsigned short int significand[4];
201 unsigned short int exponent;
206 unsigned long int cw;
207 unsigned long int sw;
208 unsigned long int tag;
209 unsigned long int ipoff;
210 unsigned long int cssel;
211 unsigned long int dataoff;
212 unsigned long int datasel;
213 struct _libc_fpreg _st[8];
214 unsigned long int status;
217 /* Structure to describe FPU registers. */
218 typedef struct _libc_fpstate *fpregset_t;
220 /* Context to describe whole processor state. */
224 /* Due to Linux's history we have to use a pointer here. The SysV/i386
225 ABI requires a struct with the values. */
227 unsigned long int oldmask;
228 unsigned long int cr2;
231 /* Userlevel context. */
232 typedef struct ucontext
234 unsigned long int uc_flags;
235 struct ucontext *uc_link;
237 mcontext_t uc_mcontext;
238 __sigset_t uc_sigmask;
239 struct _libc_fpstate __fpregs_mem;
242 #endif /* __WORDSIZE == 32 */
244 #endif /* sys/ucontext.h */