Release 970509
[wine/multimedia.git] / include / sigcontext.h
blob2b4c33efdabb4392ac468ab682dc8a1e08fcfcff
1 /*
2 * Signal context definitions
4 * Copyright 1995 Alexandre Julliard
5 */
7 #ifndef __WINE_SIGCONTEXT_H
8 #define __WINE_SIGCONTEXT_H
10 #ifdef WINELIB
11 #error This file must not be used in Winelib
12 #endif
14 #ifdef linux
15 typedef struct
17 unsigned short sc_gs, __gsh;
18 unsigned short sc_fs, __fsh;
19 unsigned short sc_es, __esh;
20 unsigned short sc_ds, __dsh;
21 unsigned long sc_edi;
22 unsigned long sc_esi;
23 unsigned long sc_ebp;
24 unsigned long sc_esp;
25 unsigned long sc_ebx;
26 unsigned long sc_edx;
27 unsigned long sc_ecx;
28 unsigned long sc_eax;
29 unsigned long sc_trapno;
30 unsigned long sc_err;
31 unsigned long sc_eip;
32 unsigned short sc_cs, __csh;
33 unsigned long sc_eflags;
34 unsigned long esp_at_signal;
35 unsigned short sc_ss, __ssh;
36 unsigned long i387;
37 unsigned long oldmask;
38 unsigned long cr2;
39 } SIGCONTEXT;
40 #endif /* linux */
42 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
43 #include <signal.h>
44 typedef struct sigcontext SIGCONTEXT;
45 #endif /* FreeBSD */
47 #if defined(__svr4__) || defined(_SCO_DS)
48 #include <signal.h>
49 #ifdef _SCO_DS
50 #include <sys/regset.h>
51 #endif
52 #include <sys/ucontext.h>
53 typedef struct ucontext SIGCONTEXT;
54 #endif /* svr4 || SCO_DS */
56 #ifdef __EMX__
57 typedef unsigned long ULONG;
58 typedef unsigned short USHORT;
59 typedef struct _fpreg /* Note 1 */
61 ULONG losig;
62 ULONG hisig;
63 USHORT signexp;
64 } FPREG;
65 typedef FPREG *PFPREG;
67 typedef struct _CONTEXT /* Note 1 */
69 ULONG ContextFlags;
70 ULONG ctx_env[7];
71 FPREG ctx_stack[8];
72 ULONG ctx_SegGs;
73 ULONG ctx_SegFs;
74 ULONG ctx_SegEs;
75 ULONG ctx_SegDs;
76 ULONG ctx_RegEdi;
77 ULONG ctx_RegEsi;
78 ULONG ctx_RegEax;
79 ULONG ctx_RegEbx;
80 ULONG ctx_RegEcx;
81 ULONG ctx_RegEdx;
82 ULONG ctx_RegEbp;
83 ULONG ctx_RegEip;
84 ULONG ctx_SegCs;
85 ULONG ctx_EFlags;
86 ULONG ctx_RegEsp;
87 ULONG ctx_SegSs;
88 } SIGCONTEXT;
89 /*typedef CONTEXTRECORD *PCONTEXTRECORD;*/
91 #endif /* __EMX__ */
94 #if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__)
96 #define EAX_sig(context) ((context)->sc_eax)
97 #define EBX_sig(context) ((context)->sc_ebx)
98 #define ECX_sig(context) ((context)->sc_ecx)
99 #define EDX_sig(context) ((context)->sc_edx)
100 #define ESI_sig(context) ((context)->sc_esi)
101 #define EDI_sig(context) ((context)->sc_edi)
102 #define EBP_sig(context) ((context)->sc_ebp)
104 #define CS_sig(context) ((context)->sc_cs)
105 #define DS_sig(context) ((context)->sc_ds)
106 #define ES_sig(context) ((context)->sc_es)
107 #define SS_sig(context) ((context)->sc_ss)
109 #ifdef linux
110 /* fs and gs are not supported on *BSD. Hopefully we won't need them. */
111 #define FS_sig(context) ((context)->sc_fs)
112 #define GS_sig(context) ((context)->sc_gs)
113 #endif
115 #ifndef __FreeBSD__
116 #define EFL_sig(context) ((context)->sc_eflags)
117 #else
118 #define EFL_sig(context) ((context)->sc_efl)
119 #endif
121 #define EIP_sig(context) (*((unsigned long*)&(context)->sc_eip))
122 #define ESP_sig(context) (*((unsigned long*)&(context)->sc_esp))
124 #endif /* linux || __NetBSD__ || __FreeBSD__ */
126 #if defined(__svr4__) || defined(_SCO_DS)
128 #ifdef _SCO_DS
129 #define gregs regs
130 #endif
132 #define EAX_sig(context) ((context)->uc_mcontext.gregs[EAX])
133 #define EBX_sig(context) ((context)->uc_mcontext.gregs[EBX])
134 #define ECX_sig(context) ((context)->uc_mcontext.gregs[ECX])
135 #define EDX_sig(context) ((context)->uc_mcontext.gregs[EDX])
136 #define ESI_sig(context) ((context)->uc_mcontext.gregs[ESI])
137 #define EDI_sig(context) ((context)->uc_mcontext.gregs[EDI])
138 #define EBP_sig(context) ((context)->uc_mcontext.gregs[EBP])
140 #define CS_sig(context) ((context)->uc_mcontext.gregs[CS])
141 #define DS_sig(context) ((context)->uc_mcontext.gregs[DS])
142 #define ES_sig(context) ((context)->uc_mcontext.gregs[ES])
143 #define SS_sig(context) ((context)->uc_mcontext.gregs[SS])
145 #define FS_sig(context) ((context)->uc_mcontext.gregs[FS])
146 #define GS_sig(context) ((context)->uc_mcontext.gregs[GS])
148 #define EFL_sig(context) ((context)->uc_mcontext.gregs[EFL])
150 #define EIP_sig(context) ((context)->uc_mcontext.gregs[EIP])
151 #ifdef R_ESP
152 #define ESP_sig(context) ((context)->uc_mcontext.gregs[R_ESP])
153 #else
154 #define ESP_sig(context) ((context)->uc_mcontext.gregs[ESP])
155 #endif
157 #endif /* svr4 || SCO_DS */
159 #ifdef __EMX__
161 #define EAX_sig(context) ((context)->ctx_RegEax)
162 #define EBX_sig(context) ((context)->ctx_RegEbx)
163 #define ECX_sig(context) ((context)->ctx_RegEcx)
164 #define EDX_sig(context) ((context)->ctx_RegEdx)
165 #define ESI_sig(context) ((context)->ctx_RegEsi)
166 #define EDI_sig(context) ((context)->ctx_RegEdi)
167 #define EBP_sig(context) ((context)->ctx_RegEbp)
168 #define ESP_sig(context) ((context)->ctx_RegEsp)
169 #define CS_sig(context) ((context)->ctx_SegCs)
170 #define DS_sig(context) ((context)->ctx_SegDs)
171 #define ES_sig(context) ((context)->ctx_SegEs)
172 #define SS_sig(context) ((context)->ctx_SegSs)
173 #define FS_sig(context) ((context)->ctx_SegFs)
174 #define GS_sig(context) ((context)->ctx_SegGs)
175 #define EFL_sig(context) ((context)->ctx_EFlags)
176 #define EIP_sig(context) ((context)->ctx_RegEip)
178 #endif /* __EMX__ */
180 /* Generic definitions */
182 #define AX_sig(context) (*(WORD*)&EAX_sig(context))
183 #define BX_sig(context) (*(WORD*)&EBX_sig(context))
184 #define CX_sig(context) (*(WORD*)&ECX_sig(context))
185 #define DX_sig(context) (*(WORD*)&EDX_sig(context))
186 #define SI_sig(context) (*(WORD*)&ESI_sig(context))
187 #define DI_sig(context) (*(WORD*)&EDI_sig(context))
188 #define BP_sig(context) (*(WORD*)&EBP_sig(context))
190 #define AL_sig(context) (*(BYTE*)&EAX_sig(context))
191 #define AH_sig(context) (*((BYTE*)&EAX_sig(context)+1))
192 #define BL_sig(context) (*(BYTE*)&EBX_sig(context))
193 #define BH_sig(context) (*((BYTE*)&EBX_sig(context)+1))
194 #define CL_sig(context) (*(BYTE*)&ECX_sig(context))
195 #define CH_sig(context) (*((BYTE*)&ECX_sig(context)+1))
196 #define DL_sig(context) (*(BYTE*)&EDX_sig(context))
197 #define DH_sig(context) (*((BYTE*)&EDX_sig(context)+1))
199 #define IP_sig(context) (*(WORD*)&EIP_sig(context))
200 #define SP_sig(context) (*(WORD*)&ESP_sig(context))
202 #define FL_sig(context) (*(WORD*)&EFL_sig(context))
204 #endif /* __WINE_SIGCONTEXT_H */