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 used
25 included in <signal.h>. */
26 #include <bits/sigcontext.h>
30 /* Type for general register. */
31 __extension__
typedef long long int greg_t
;
33 /* Number of general registers. */
36 /* Container for all general registers. */
37 typedef greg_t gregset_t
[NGREG
];
40 /* Number of each register in the `gregset_t' array. */
44 # define REG_R8 REG_R8
46 # define REG_R9 REG_R9
48 # define REG_R10 REG_R10
50 # define REG_R11 REG_R11
52 # define REG_R12 REG_R12
54 # define REG_R13 REG_R13
56 # define REG_R14 REG_R14
58 # define REG_R15 REG_R15
60 # define REG_RDI REG_RDI
62 # define REG_RSI REG_RSI
64 # define REG_RBP REG_RBP
66 # define REG_RBX REG_RBX
68 # define REG_RDX REG_RDX
70 # define REG_RAX REG_RAX
72 # define REG_RCX REG_RCX
74 # define REG_RSP REG_RSP
76 # define REG_RIP REG_RIP
78 # define REG_EFL REG_EFL
79 REG_CSGSFS
, /* Actually short cs, gs, fs, __pad0. */
80 # define REG_CSGSFS REG_CSGSFS
82 # define REG_ERR REG_ERR
84 # define REG_TRAPNO REG_TRAPNO
86 # define REG_OLDMASK REG_OLDMASK
88 # define REG_CR2 REG_CR2
94 unsigned short int significand
[4];
95 unsigned short int exponent
;
96 unsigned short int padding
[3];
101 __uint32_t element
[4];
106 /* 64-bit FXSAVE format. */
114 __uint32_t mxcr_mask
;
115 struct _libc_fpxreg _st
[8];
116 struct _libc_xmmreg _xmm
[16];
117 __uint32_t padding
[24];
120 /* Structure to describe FPU registers. */
121 typedef struct _libc_fpstate
*fpregset_t
;
123 /* Context to describe whole processor state. */
127 /* Note that fpregs is a pointer. */
129 __extension__
unsigned long long __reserved1
[8];
132 /* Userlevel context. */
133 typedef struct ucontext
135 unsigned long int uc_flags
;
136 struct ucontext
*uc_link
;
138 mcontext_t uc_mcontext
;
139 __sigset_t uc_sigmask
;
140 struct _libc_fpstate __fpregs_mem
;
143 #else /* !__x86_64__ */
145 /* Type for general register. */
148 /* Number of general registers. */
151 /* Container for all general registers. */
152 typedef greg_t gregset_t
[NGREG
];
155 /* Number of each register is the `gregset_t' array. */
159 # define REG_GS REG_GS
161 # define REG_FS REG_FS
163 # define REG_ES REG_ES
165 # define REG_DS REG_DS
167 # define REG_EDI REG_EDI
169 # define REG_ESI REG_ESI
171 # define REG_EBP REG_EBP
173 # define REG_ESP REG_ESP
175 # define REG_EBX REG_EBX
177 # define REG_EDX REG_EDX
179 # define REG_ECX REG_ECX
181 # define REG_EAX REG_EAX
183 # define REG_TRAPNO REG_TRAPNO
185 # define REG_ERR REG_ERR
187 # define REG_EIP REG_EIP
189 # define REG_CS REG_CS
191 # define REG_EFL REG_EFL
193 # define REG_UESP REG_UESP
195 # define REG_SS REG_SS
199 /* Definitions taken from the kernel headers. */
202 unsigned short int significand
[4];
203 unsigned short int exponent
;
208 unsigned long int cw
;
209 unsigned long int sw
;
210 unsigned long int tag
;
211 unsigned long int ipoff
;
212 unsigned long int cssel
;
213 unsigned long int dataoff
;
214 unsigned long int datasel
;
215 struct _libc_fpreg _st
[8];
216 unsigned long int status
;
219 /* Structure to describe FPU registers. */
220 typedef struct _libc_fpstate
*fpregset_t
;
222 /* Context to describe whole processor state. */
226 /* Due to Linux's history we have to use a pointer here. The SysV/i386
227 ABI requires a struct with the values. */
229 unsigned long int oldmask
;
230 unsigned long int cr2
;
233 /* Userlevel context. */
234 typedef struct ucontext
236 unsigned long int uc_flags
;
237 struct ucontext
*uc_link
;
239 mcontext_t uc_mcontext
;
240 __sigset_t uc_sigmask
;
241 struct _libc_fpstate __fpregs_mem
;
244 #endif /* !__x86_64__ */
246 #endif /* sys/ucontext.h */