1 /* Copyright (C) 2001-2016 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
24 /* We need the signal context definitions even if they are not exposed
26 #include <bits/sigcontext.h>
27 #include <bits/sigstack.h>
32 /* Type for general register. */
33 __extension__
typedef long 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
88 # define REG_OLDMASK REG_OLDMASK
90 # define REG_CR2 REG_CR2
96 unsigned short int significand
[4];
97 unsigned short int exponent
;
98 unsigned short int padding
[3];
103 __uint32_t element
[4];
108 /* 64-bit FXSAVE format. */
116 __uint32_t mxcr_mask
;
117 struct _libc_fpxreg _st
[8];
118 struct _libc_xmmreg _xmm
[16];
119 __uint32_t padding
[24];
122 /* Structure to describe FPU registers. */
123 typedef struct _libc_fpstate
*fpregset_t
;
125 /* Context to describe whole processor state. */
129 /* Note that fpregs is a pointer. */
131 __extension__
unsigned long long __reserved1
[8];
134 /* Userlevel context. */
135 typedef struct ucontext
137 unsigned long int uc_flags
;
138 struct ucontext
*uc_link
;
140 mcontext_t uc_mcontext
;
141 __sigset_t uc_sigmask
;
142 struct _libc_fpstate __fpregs_mem
;
145 #else /* !__x86_64__ */
147 /* Type for general register. */
150 /* Number of general registers. */
153 /* Container for all general registers. */
154 typedef greg_t gregset_t
[NGREG
];
157 /* Number of each register is the `gregset_t' array. */
161 # define REG_GS REG_GS
163 # define REG_FS REG_FS
165 # define REG_ES REG_ES
167 # define REG_DS REG_DS
169 # define REG_EDI REG_EDI
171 # define REG_ESI REG_ESI
173 # define REG_EBP REG_EBP
175 # define REG_ESP REG_ESP
177 # define REG_EBX REG_EBX
179 # define REG_EDX REG_EDX
181 # define REG_ECX REG_ECX
183 # define REG_EAX REG_EAX
185 # define REG_TRAPNO REG_TRAPNO
187 # define REG_ERR REG_ERR
189 # define REG_EIP REG_EIP
191 # define REG_CS REG_CS
193 # define REG_EFL REG_EFL
195 # define REG_UESP REG_UESP
197 # define REG_SS REG_SS
201 /* Definitions taken from the kernel headers. */
204 unsigned short int significand
[4];
205 unsigned short int exponent
;
210 unsigned long int cw
;
211 unsigned long int sw
;
212 unsigned long int tag
;
213 unsigned long int ipoff
;
214 unsigned long int cssel
;
215 unsigned long int dataoff
;
216 unsigned long int datasel
;
217 struct _libc_fpreg _st
[8];
218 unsigned long int status
;
221 /* Structure to describe FPU registers. */
222 typedef struct _libc_fpstate
*fpregset_t
;
224 /* Context to describe whole processor state. */
228 /* Due to Linux's history we have to use a pointer here. The SysV/i386
229 ABI requires a struct with the values. */
231 unsigned long int oldmask
;
232 unsigned long int cr2
;
235 /* Userlevel context. */
236 typedef struct ucontext
238 unsigned long int uc_flags
;
239 struct ucontext
*uc_link
;
241 mcontext_t uc_mcontext
;
242 __sigset_t uc_sigmask
;
243 struct _libc_fpstate __fpregs_mem
;
246 #endif /* !__x86_64__ */
248 #endif /* sys/ucontext.h */