17b6b6c76bb8382c882c7312100f1826709cb13b
[platform/upstream/glibc.git] / sysdeps / i386 / sys / ucontext.h
1 /* Copyright (C) 1997 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
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    Library General Public License for more details.
13
14    You should have received a copy of the GNU Library General Public
15    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17    Boston, MA 02111-1307, USA.  */
18
19 /* System V/i386 ABI compliant context switching support.  */
20
21 #ifndef _SYS_UCONTEXT_H
22 #define _SYS_UCONTEXT_H 1
23
24 #include <features.h>
25 #include <signal.h>
26
27 /* Type for general register.  */
28 typedef int greg_t;
29
30 /* Number of general registers.  */
31 #define NGREG   19
32
33 /* Container for all general registers.  */
34 typedef greg_t gregset_t[NGREG];
35
36 /* Number of each register is the `gregset_t' array.  */
37 enum
38 {
39   GS = 0,
40 #define GS      GS
41   FS,
42 #define FS      FS
43   ES,
44 #define ES      ES
45   DS,
46 #define DS      DS
47   EDI
48 #define EDI     EDI
49   ESI
50 #define ESI     ESI
51   EBP,
52 #define EBP     EBP
53   ESP,
54 #define ESP     ESP
55   EBX,
56 #define EBX     EBX
57   EDX,
58 #define EDX     EDX
59   ECX,
60 #define ECX     ECX
61   EAX,
62 #define EAX     EAX
63   TRAPNO,
64 #define TRAPNO  TRAPNO
65   ERR,
66 #define ERR     ERR
67   EIP,
68 #define EIP     EIP
69   CS,
70 #define CS      CS
71   EFL,
72 #define EFL     EFL
73   UESP,
74 #define UESP    UESP
75   SS
76 #define SS      SS
77 };
78
79 /* Structure to describe FPU registers.  */
80 typedef struct fpregset
81   {
82     union
83       {
84         struct fpchip_state
85           {
86             int state[27];
87             int status;
88           } fpchip_state;
89
90         struct fp_emul_space
91           {
92             char fp_emul[246];
93             char fp_epad[2];
94           } fp_emul_space;
95
96         int f_fpregs[62];
97       } fp_reg_set;
98
99     long int f_wregs[33];
100   } fpregset_t;
101
102 /* Context to describe whole processor state.  */
103 typedef struct
104   {
105     gregset_t gregs;
106     fpregset_t fpregs;
107   } mcontext_t;
108
109 /* Userlevel context.  */
110 typedef struct ucontext
111   {
112     unsigned long int uc_flags;
113     struct ucontext *uc_links;
114     __sigset_t uc_sigmask;
115     stack_t uc_stack;
116     mcontext_t uc_mcontext;
117     long int uc_filler[5];
118   } ucontext_t;
119
120 #endif /* sys/ucontext.h */