2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / i386 / sys / ucontext.h
blobd6474c72289643828d863c2b877aebd2291506e9
1 /* Copyright (C) 1997, 1998, 1999, 2000 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
17 02111-1307 USA. */
19 #ifndef _SYS_UCONTEXT_H
20 #define _SYS_UCONTEXT_H 1
22 #include <features.h>
23 #include <signal.h>
25 /* We need the signal context definitions even if they are not used
26 included in <signal.h>. */
27 #include <bits/sigcontext.h>
30 /* Type for general register. */
31 typedef int greg_t;
33 /* Number of general registers. */
34 #define NGREG 19
36 /* Container for all general registers. */
37 typedef greg_t gregset_t[NGREG];
39 #ifdef __USE_GNU
40 /* Number of each register is the `gregset_t' array. */
41 enum
43 REG_GS = 0,
44 # define REG_GS REG_GS
45 REG_FS,
46 # define REG_FS REG_FS
47 REG_ES,
48 # define REG_ES REG_ES
49 REG_DS,
50 # define REG_DS REG_DS
51 REG_EDI,
52 # define REG_EDI REG_EDI
53 REG_ESI,
54 # define REG_ESI REG_ESI
55 REG_EBP,
56 # define REG_EBP REG_EBP
57 REG_ESP,
58 # define REG_ESP REG_ESP
59 REG_EBX,
60 # define REG_EBX REG_EBX
61 REG_EDX,
62 # define REG_EDX REG_EDX
63 REG_ECX,
64 # define REG_ECX REG_ECX
65 REG_EAX,
66 # define REG_EAX REG_EAX
67 REG_TRAPNO,
68 # define REG_TRAPNO REG_TRAPNO
69 REG_ERR,
70 # define REG_ERR REG_ERR
71 REG_EIP,
72 # define REG_EIP REG_EIP
73 REG_CS,
74 # define REG_CS REG_CS
75 REG_EFL,
76 # define REG_EFL REG_EFL
77 REG_UESP,
78 # define REG_UESP REG_UESP
79 REG_SS
80 # define REG_SS REG_SS
82 #endif
84 /* Definitions taken from the kernel headers. */
85 struct _libc_fpreg
87 unsigned short int significand[4];
88 unsigned short int exponent;
91 struct _libc_fpstate
93 unsigned long int cw;
94 unsigned long int sw;
95 unsigned long int tag;
96 unsigned long int ipoff;
97 unsigned long int cssel;
98 unsigned long int dataoff;
99 unsigned long int datasel;
100 struct _libc_fpreg _st[8];
101 unsigned long int status;
104 /* Structure to describe FPU registers. */
105 typedef struct _libc_fpstate *fpregset_t;
107 /* Context to describe whole processor state. */
108 typedef struct
110 gregset_t gregs;
111 /* Due to Linux's history we have to use a pointer here. The SysV/i386
112 ABI requires a struct with the values. */
113 fpregset_t fpregs;
114 unsigned long int oldmask;
115 unsigned long int cr2;
116 } mcontext_t;
118 /* Userlevel context. */
119 typedef struct ucontext
121 unsigned long int uc_flags;
122 struct ucontext *uc_link;
123 stack_t uc_stack;
124 mcontext_t uc_mcontext;
125 __sigset_t uc_sigmask;
126 struct _libc_fpstate __fpregs_mem;
127 } ucontext_t;
129 #endif /* sys/ucontext.h */