Update.
[platform/upstream/glibc.git] / sysdeps / unix / sysv / linux / 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 #ifndef _SYS_UCONTEXT_H
20 #define _SYS_UCONTEXT_H 1
21
22 #include <features.h>
23 #include <signal.h>
24
25 /* We need the signal context definitions even if they are not used
26    included in <signal.h>.  */
27 #include <bits/sigcontext.h>
28
29
30 /* Type for general register.  */
31 typedef int greg_t;
32
33 /* Number of general registers.  */
34 #define NGREG   19
35
36 /* Container for all general registers.  */
37 typedef greg_t gregset_t[NGREG];
38
39 /* Number of each register is the `gregset_t' array.  */
40 enum
41 {
42   GS = 0,
43 #define GS      GS
44   FS,
45 #define FS      FS
46   ES,
47 #define ES      ES
48   DS,
49 #define DS      DS
50   EDI,
51 #define EDI     EDI
52   ESI,
53 #define ESI     ESI
54   EBP,
55 #define EBP     EBP
56   ESP,
57 #define ESP     ESP
58   EBX,
59 #define EBX     EBX
60   EDX,
61 #define EDX     EDX
62   ECX,
63 #define ECX     ECX
64   EAX,
65 #define EAX     EAX
66   TRAPNO,
67 #define TRAPNO  TRAPNO
68   ERR,
69 #define ERR     ERR
70   EIP,
71 #define EIP     EIP
72   CS,
73 #define CS      CS
74   EFL,
75 #define EFL     EFL
76   UESP,
77 #define UESP    UESP
78   SS
79 #define SS      SS
80 };
81
82 /* Structure to describe FPU registers.  */
83 typedef struct _fpstate *fpregset_t;
84
85 /* Context to describe whole processor state.  */
86 typedef struct
87   {
88     gregset_t gregs;
89     /* Due to Linux's history we have to use a pointer here.  The SysV/i386
90        ABI requires a struct with the values.  */
91     fpregset_t fpregs;
92     unsigned long int oldmask;
93     unsigned long int cr2;
94   } mcontext_t;
95
96 /* Userlevel context.  */
97 typedef struct ucontext
98   {
99     unsigned long int uc_flags;
100     struct ucontext *uc_links;
101     stack_t uc_stack;
102     mcontext_t uc_mcontext;
103     __sigset_t uc_sigmask;
104   } ucontext_t;
105
106 #endif /* sys/ucontext.h */