2 * Signal context definitions
4 * Copyright 1995 Alexandre Julliard
7 #ifndef __WINE_SIG_CONTEXT_H
8 #define __WINE_SIG_CONTEXT_H
15 unsigned short sc_gs, __gsh;
16 unsigned short sc_fs, __fsh;
17 unsigned short sc_es, __esh;
18 unsigned short sc_ds, __dsh;
27 unsigned long sc_trapno;
30 unsigned short sc_cs, __csh;
31 unsigned long sc_eflags;
32 unsigned long esp_at_signal;
33 unsigned short sc_ss, __ssh;
35 unsigned long oldmask;
39 #define HANDLER_DEF(name) void name (int signal, SIGCONTEXT context)
40 #define HANDLER_CONTEXT (&context)
44 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
47 typedef struct sigcontext SIGCONTEXT;
49 #define HANDLER_DEF(name) void name(int signal, int code, SIGCONTEXT *context)
50 #define HANDLER_CONTEXT context
54 #if defined(__svr4__) || defined(_SCO_DS)
58 #include <sys/regset.h>
60 #include <sys/ucontext.h>
61 typedef struct ucontext SIGCONTEXT;
63 #define HANDLER_DEF(name) void name(int signal, void *siginfo, SIGCONTEXT *context)
64 #define HANDLER_CONTEXT context
66 #endif /* svr4 || SCO_DS */
69 typedef unsigned long ULONG;
70 typedef unsigned short USHORT;
71 typedef struct _fpreg /* Note 1 */
77 typedef FPREG *PFPREG;
79 typedef struct _CONTEXT /* Note 1 */
101 /*typedef CONTEXTRECORD *PCONTEXTRECORD;*/
106 #if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) \
107 || defined(__OpenBSD__)
109 #define EAX_sig(context) ((context)->sc_eax)
110 #define EBX_sig(context) ((context)->sc_ebx)
111 #define ECX_sig(context) ((context)->sc_ecx)
112 #define EDX_sig(context) ((context)->sc_edx)
113 #define ESI_sig(context) ((context)->sc_esi)
114 #define EDI_sig(context) ((context)->sc_edi)
115 #define EBP_sig(context) ((context)->sc_ebp)
117 #define CS_sig(context) ((context)->sc_cs)
118 #define DS_sig(context) ((context)->sc_ds)
119 #define ES_sig(context) ((context)->sc_es)
120 #define SS_sig(context) ((context)->sc_ss)
123 /* fs and gs are not supported on *BSD. Hopefully we won't need them. */
124 #define FS_sig(context) ((context)->sc_fs)
125 #define GS_sig(context) ((context)->sc_gs)
129 #define EFL_sig(context) ((context)->sc_eflags)
131 #define EFL_sig(context) ((context)->sc_efl)
134 #define EIP_sig(context) (*((unsigned long*)&(context)->sc_eip))
135 #define ESP_sig(context) (*((unsigned long*)&(context)->sc_esp))
137 #endif /* linux || __NetBSD__ || __FreeBSD__ || __OpenBSD__ */
139 #if defined(__svr4__) || defined(_SCO_DS)
145 #define EAX_sig(context) ((context)->uc_mcontext.gregs[EAX])
146 #define EBX_sig(context) ((context)->uc_mcontext.gregs[EBX])
147 #define ECX_sig(context) ((context)->uc_mcontext.gregs[ECX])
148 #define EDX_sig(context) ((context)->uc_mcontext.gregs[EDX])
149 #define ESI_sig(context) ((context)->uc_mcontext.gregs[ESI])
150 #define EDI_sig(context) ((context)->uc_mcontext.gregs[EDI])
151 #define EBP_sig(context) ((context)->uc_mcontext.gregs[EBP])
153 #define CS_sig(context) ((context)->uc_mcontext.gregs[CS])
154 #define DS_sig(context) ((context)->uc_mcontext.gregs[DS])
155 #define ES_sig(context) ((context)->uc_mcontext.gregs[ES])
156 #define SS_sig(context) ((context)->uc_mcontext.gregs[SS])
158 #define FS_sig(context) ((context)->uc_mcontext.gregs[FS])
159 #define GS_sig(context) ((context)->uc_mcontext.gregs[GS])
161 #define EFL_sig(context) ((context)->uc_mcontext.gregs[EFL])
163 #define EIP_sig(context) ((context)->uc_mcontext.gregs[EIP])
165 #define ESP_sig(context) ((context)->uc_mcontext.gregs[R_ESP])
167 #define ESP_sig(context) ((context)->uc_mcontext.gregs[ESP])
170 #endif /* svr4 || SCO_DS */
174 #define EAX_sig(context) ((context)->ctx_RegEax)
175 #define EBX_sig(context) ((context)->ctx_RegEbx)
176 #define ECX_sig(context) ((context)->ctx_RegEcx)
177 #define EDX_sig(context) ((context)->ctx_RegEdx)
178 #define ESI_sig(context) ((context)->ctx_RegEsi)
179 #define EDI_sig(context) ((context)->ctx_RegEdi)
180 #define EBP_sig(context) ((context)->ctx_RegEbp)
181 #define ESP_sig(context) ((context)->ctx_RegEsp)
182 #define CS_sig(context) ((context)->ctx_SegCs)
183 #define DS_sig(context) ((context)->ctx_SegDs)
184 #define ES_sig(context) ((context)->ctx_SegEs)
185 #define SS_sig(context) ((context)->ctx_SegSs)
186 #define FS_sig(context) ((context)->ctx_SegFs)
187 #define GS_sig(context) ((context)->ctx_SegGs)
188 #define EFL_sig(context) ((context)->ctx_EFlags)
189 #define EIP_sig(context) ((context)->ctx_RegEip)
193 /* Generic definitions */
195 #define AX_sig(context) (*(WORD*)&EAX_sig(context))
196 #define BX_sig(context) (*(WORD*)&EBX_sig(context))
197 #define CX_sig(context) (*(WORD*)&ECX_sig(context))
198 #define DX_sig(context) (*(WORD*)&EDX_sig(context))
199 #define SI_sig(context) (*(WORD*)&ESI_sig(context))
200 #define DI_sig(context) (*(WORD*)&EDI_sig(context))
201 #define BP_sig(context) (*(WORD*)&EBP_sig(context))
203 #define AL_sig(context) (*(BYTE*)&EAX_sig(context))
204 #define AH_sig(context) (*((BYTE*)&EAX_sig(context)+1))
205 #define BL_sig(context) (*(BYTE*)&EBX_sig(context))
206 #define BH_sig(context) (*((BYTE*)&EBX_sig(context)+1))
207 #define CL_sig(context) (*(BYTE*)&ECX_sig(context))
208 #define CH_sig(context) (*((BYTE*)&ECX_sig(context)+1))
209 #define DL_sig(context) (*(BYTE*)&EDX_sig(context))
210 #define DH_sig(context) (*((BYTE*)&EDX_sig(context)+1))
212 #define IP_sig(context) (*(WORD*)&EIP_sig(context))
213 #define SP_sig(context) (*(WORD*)&ESP_sig(context))
215 #define FL_sig(context) (*(WORD*)&EFL_sig(context))
217 #endif /* __i386__ */
219 #endif /* __WINE_SIG_CONTEXT_H */