Module: wine Branch: master Commit: 38cf3a43058a6ba5a1f34fe5fd46efe3e270e536 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=38cf3a43058a6ba5a1f34fe5...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Aug 11 14:14:38 2006 +0200
ntdll: Switch linux to siginfo-style signal handling.
---
dlls/ntdll/signal_i386.c | 85 ++++++++++++++-------------------------------- 1 files changed, 26 insertions(+), 59 deletions(-)
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 2055d93..b115ff6 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -65,60 +65,36 @@ #endif */
#ifdef linux -typedef struct -{ - unsigned short sc_gs, __gsh; - unsigned short sc_fs, __fsh; - unsigned short sc_es, __esh; - unsigned short sc_ds, __dsh; - unsigned long sc_edi; - unsigned long sc_esi; - unsigned long sc_ebp; - unsigned long sc_esp; - unsigned long sc_ebx; - unsigned long sc_edx; - unsigned long sc_ecx; - unsigned long sc_eax; - unsigned long sc_trapno; - unsigned long sc_err; - unsigned long sc_eip; - unsigned short sc_cs, __csh; - unsigned long sc_eflags; - unsigned long esp_at_signal; - unsigned short sc_ss, __ssh; - unsigned long i387; - unsigned long oldmask; - unsigned long cr2; -} volatile SIGCONTEXT; - -#define HANDLER_DEF(name) void name( int __signal, SIGCONTEXT __context ) -#define HANDLER_CONTEXT (&__context)
-#define EAX_sig(context) ((context)->sc_eax) -#define EBX_sig(context) ((context)->sc_ebx) -#define ECX_sig(context) ((context)->sc_ecx) -#define EDX_sig(context) ((context)->sc_edx) -#define ESI_sig(context) ((context)->sc_esi) -#define EDI_sig(context) ((context)->sc_edi) -#define EBP_sig(context) ((context)->sc_ebp) - -#define CS_sig(context) ((context)->sc_cs) -#define DS_sig(context) ((context)->sc_ds) -#define ES_sig(context) ((context)->sc_es) -#define FS_sig(context) ((context)->sc_fs) -#define GS_sig(context) ((context)->sc_gs) -#define SS_sig(context) ((context)->sc_ss) - -#define TRAP_sig(context) ((context)->sc_trapno) -#define ERROR_sig(context) ((context)->sc_err) -#define EFL_sig(context) ((context)->sc_eflags) +typedef ucontext_t SIGCONTEXT;
-#define EIP_sig(context) ((context)->sc_eip) -#define ESP_sig(context) ((context)->sc_esp) +#define HANDLER_DEF(name) void name( int __signal, siginfo_t *__siginfo, SIGCONTEXT *__context ) +#define HANDLER_CONTEXT __context
-#define FPU_sig(context) ((FLOATING_SAVE_AREA*)((context)->i387)) +#define EAX_sig(context) ((context)->uc_mcontext.gregs[REG_EAX]) +#define EBX_sig(context) ((context)->uc_mcontext.gregs[REG_EBX]) +#define ECX_sig(context) ((context)->uc_mcontext.gregs[REG_ECX]) +#define EDX_sig(context) ((context)->uc_mcontext.gregs[REG_EDX]) +#define ESI_sig(context) ((context)->uc_mcontext.gregs[REG_ESI]) +#define EDI_sig(context) ((context)->uc_mcontext.gregs[REG_EDI]) +#define EBP_sig(context) ((context)->uc_mcontext.gregs[REG_EBP]) +#define ESP_sig(context) ((context)->uc_mcontext.gregs[REG_ESP]) + +#define CS_sig(context) ((context)->uc_mcontext.gregs[REG_CS]) +#define DS_sig(context) ((context)->uc_mcontext.gregs[REG_DS]) +#define ES_sig(context) ((context)->uc_mcontext.gregs[REG_ES]) +#define SS_sig(context) ((context)->uc_mcontext.gregs[REG_SS]) +#define FS_sig(context) ((context)->uc_mcontext.gregs[REG_FS]) +#define GS_sig(context) ((context)->uc_mcontext.gregs[REG_GS]) + +#define EFL_sig(context) ((context)->uc_mcontext.gregs[REG_EFL]) +#define EIP_sig(context) ((context)->uc_mcontext.gregs[REG_EIP]) +#define TRAP_sig(context) ((context)->uc_mcontext.gregs[REG_TRAPNO]) +#define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) + +#define FPU_sig(context) ((FLOATING_SAVE_AREA*)((context)->uc_mcontext.fpregs))
-#define FAULT_ADDRESS ((void *)HANDLER_CONTEXT->cr2) +#define FAULT_ADDRESS (__siginfo->si_addr)
#define VM86_EAX 0 /* the %eax value while vm86_enter is executing */
@@ -1466,16 +1442,7 @@ #endif /* HAVE_SIGALTSTACK */ sigaddset( &sig_act.sa_mask, SIGINT ); sigaddset( &sig_act.sa_mask, SIGUSR1 ); sigaddset( &sig_act.sa_mask, SIGUSR2 ); - -#if defined(linux) - sig_act.sa_flags = SA_RESTART; -#elif defined (__svr4__) || defined(_SCO_DS) || defined(__APPLE__) || \ - defined(__NetBSD__) || defined(__OpenBSD__) || \ - defined(__FreeBSD__) || defined(__FreeBSD_kernel__) sig_act.sa_flags = SA_SIGINFO | SA_RESTART; -#else - sig_act.sa_flags = 0; -#endif
#ifdef SA_ONSTACK sig_act.sa_flags |= SA_ONSTACK;