2 * i386 signal handling routines
4 * Copyright 1999 Alexandre Julliard
17 #ifdef HAVE_SYS_PARAM_H
18 # include <sys/param.h>
23 # ifdef HAVE_SYS_SYSCALL_H
24 # include <sys/syscall.h>
28 #include "selectors.h"
30 /***********************************************************************
31 * signal context platform-specific definitions
37 unsigned short sc_gs
, __gsh
;
38 unsigned short sc_fs
, __fsh
;
39 unsigned short sc_es
, __esh
;
40 unsigned short sc_ds
, __dsh
;
49 unsigned long sc_trapno
;
52 unsigned short sc_cs
, __csh
;
53 unsigned long sc_eflags
;
54 unsigned long esp_at_signal
;
55 unsigned short sc_ss
, __ssh
;
57 unsigned long oldmask
;
61 #define HANDLER_DEF(name) void name( int __signal, SIGCONTEXT __context )
62 #define HANDLER_CONTEXT (&__context)
64 /* this is the sigaction structure from the Linux 2.1.20 kernel. */
65 struct kernel_sigaction
67 void (*ksa_handler
)();
68 unsigned long ksa_mask
;
69 unsigned long ksa_flags
;
73 /* Similar to the sigaction function in libc, except it leaves alone the
74 restorer field, which is used to specify the signal stack address */
75 static inline int wine_sigaction( int sig
, struct kernel_sigaction
*new,
76 struct kernel_sigaction
*old
)
78 __asm__
__volatile__( "pushl %%ebx\n\t"
83 : "0" (SYS_sigaction
), "r" (sig
), "c" (new), "d" (old
) );
89 #ifdef HAVE_SIGALTSTACK
90 /* direct syscall for sigaltstack to work around glibc 2.0 brain-damage */
91 static inline int wine_sigaltstack( const struct sigaltstack
*new,
92 struct sigaltstack
*old
)
95 __asm__
__volatile__( "pushl %%ebx\n\t"
100 : "0" (SYS_sigaltstack
), "r" (new), "c" (old
) );
101 if (ret
>= 0) return 0;
111 #define EAX_sig(context) ((context)->tf_eax)
112 #define EBX_sig(context) ((context)->tf_ebx)
113 #define ECX_sig(context) ((context)->tf_ecx)
114 #define EDX_sig(context) ((context)->tf_edx)
115 #define ESI_sig(context) ((context)->tf_esi)
116 #define EDI_sig(context) ((context)->tf_edi)
117 #define EBP_sig(context) ((context)->tf_ebp)
119 #define CS_sig(context) ((context)->tf_cs)
120 #define DS_sig(context) ((context)->tf_ds)
121 #define ES_sig(context) ((context)->tf_es)
122 #define SS_sig(context) ((context)->tf_ss)
124 #include <machine/frame.h>
125 typedef struct trapframe SIGCONTEXT
;
127 #define HANDLER_DEF(name) void name( int __signal, int code, SIGCONTEXT *__context )
128 #define HANDLER_CONTEXT __context
130 #define EFL_sig(context) ((context)->tf_eflags)
132 #define EIP_sig(context) (*((unsigned long*)&(context)->tf_eip))
133 #define ESP_sig(context) (*((unsigned long*)&(context)->tf_esp))
137 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
139 typedef struct sigcontext SIGCONTEXT
;
141 #define HANDLER_DEF(name) void name( int __signal, int code, SIGCONTEXT *__context )
142 #define HANDLER_CONTEXT __context
146 #if defined(__svr4__) || defined(_SCO_DS) || defined(__sun)
149 #include <sys/regset.h>
153 #include <sys/ucontext.h>
155 typedef struct ucontext SIGCONTEXT
;
157 #define HANDLER_DEF(name) void name( int __signal, void *__siginfo, SIGCONTEXT *__context )
158 #define HANDLER_CONTEXT __context
160 #endif /* svr4 || SCO_DS */
166 unsigned long ContextFlags
;
167 FLOATING_SAVE_AREA sc_float
;
172 unsigned long sc_edi
;
173 unsigned long sc_esi
;
174 unsigned long sc_eax
;
175 unsigned long sc_ebx
;
176 unsigned long sc_ecx
;
177 unsigned long sc_edx
;
178 unsigned long sc_ebp
;
179 unsigned long sc_eip
;
181 unsigned long sc_eflags
;
182 unsigned long sc_esp
;
189 #if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMX__)
191 #define EAX_sig(context) ((context)->sc_eax)
192 #define EBX_sig(context) ((context)->sc_ebx)
193 #define ECX_sig(context) ((context)->sc_ecx)
194 #define EDX_sig(context) ((context)->sc_edx)
195 #define ESI_sig(context) ((context)->sc_esi)
196 #define EDI_sig(context) ((context)->sc_edi)
197 #define EBP_sig(context) ((context)->sc_ebp)
199 #define CS_sig(context) ((context)->sc_cs)
200 #define DS_sig(context) ((context)->sc_ds)
201 #define ES_sig(context) ((context)->sc_es)
202 #define SS_sig(context) ((context)->sc_ss)
204 /* FS and GS are now in the sigcontext struct of FreeBSD, but not
205 * saved by the exception handling. duh.
206 * Actually they are in -current (have been for a while), and that
207 * patch now finally has been MFC'd to -stable too (Nov 15 1999).
208 * If you're running a system from the -stable branch older than that,
209 * like a 3.3-RELEASE, grab the patch from the ports tree:
210 * ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/emulators/wine/files/patch-3.3-sys-fsgs
211 * (If its not yet there when you look, go here:
212 * http://www.jelal.kn-bremen.de/freebsd/ports/emulators/wine/files/ )
215 #define FS_sig(context) ((context)->sc_fs)
216 #define GS_sig(context) ((context)->sc_gs)
220 #define FS_sig(context) ((context)->sc_fs)
221 #define GS_sig(context) ((context)->sc_gs)
222 #define CR2_sig(context) ((context)->cr2)
223 #define TRAP_sig(context) ((context)->sc_trapno)
224 #define ERROR_sig(context) ((context)->sc_err)
225 #define FPU_sig(context) ((FLOATING_SAVE_AREA*)((context)->i387))
229 #define EFL_sig(context) ((context)->sc_eflags)
231 #define EFL_sig(context) ((context)->sc_efl)
232 /* FreeBSD, see i386/i386/traps.c::trap_pfault va->err kludge */
233 #define CR2_sig(context) ((context)->sc_err)
234 #define TRAP_sig(context) ((context)->sc_trapno)
237 #define EIP_sig(context) (*((unsigned long*)&(context)->sc_eip))
238 #define ESP_sig(context) (*((unsigned long*)&(context)->sc_esp))
240 #endif /* linux || __NetBSD__ || __FreeBSD__ || __OpenBSD__ */
242 #if defined(__svr4__) || defined(_SCO_DS) || defined(__sun)
248 #define EAX_sig(context) ((context)->uc_mcontext.gregs[EAX])
249 #define EBX_sig(context) ((context)->uc_mcontext.gregs[EBX])
250 #define ECX_sig(context) ((context)->uc_mcontext.gregs[ECX])
251 #define EDX_sig(context) ((context)->uc_mcontext.gregs[EDX])
252 #define ESI_sig(context) ((context)->uc_mcontext.gregs[ESI])
253 #define EDI_sig(context) ((context)->uc_mcontext.gregs[EDI])
254 #define EBP_sig(context) ((context)->uc_mcontext.gregs[EBP])
256 #define CS_sig(context) ((context)->uc_mcontext.gregs[CS])
257 #define DS_sig(context) ((context)->uc_mcontext.gregs[DS])
258 #define ES_sig(context) ((context)->uc_mcontext.gregs[ES])
259 #define SS_sig(context) ((context)->uc_mcontext.gregs[SS])
261 #define FS_sig(context) ((context)->uc_mcontext.gregs[FS])
262 #define GS_sig(context) ((context)->uc_mcontext.gregs[GS])
264 #define EFL_sig(context) ((context)->uc_mcontext.gregs[EFL])
266 #define EIP_sig(context) ((context)->uc_mcontext.gregs[EIP])
268 #define ESP_sig(context) ((context)->uc_mcontext.gregs[R_ESP])
270 #define ESP_sig(context) ((context)->uc_mcontext.gregs[ESP])
273 #define TRAP_sig(context) ((context)->uc_mcontext.gregs[TRAPNO])
276 #endif /* svr4 || SCO_DS */
279 /* exception code definitions (already defined by FreeBSD) */
280 #ifndef __FreeBSD__ /* FIXME: other BSDs? */
281 #define T_DIVIDE 0 /* Division by zero exception */
282 #define T_TRCTRAP 1 /* Single-step exception */
283 #define T_NMI 2 /* NMI interrupt */
284 #define T_BPTFLT 3 /* Breakpoint exception */
285 #define T_OFLOW 4 /* Overflow exception */
286 #define T_BOUND 5 /* Bound range exception */
287 #define T_PRIVINFLT 6 /* Invalid opcode exception */
288 #define T_DNA 7 /* Device not available exception */
289 #define T_DOUBLEFLT 8 /* Double fault exception */
290 #define T_FPOPFLT 9 /* Coprocessor segment overrun */
291 #define T_TSSFLT 10 /* Invalid TSS exception */
292 #define T_SEGNPFLT 11 /* Segment not present exception */
293 #define T_STKFLT 12 /* Stack fault */
294 #define T_PROTFLT 13 /* General protection fault */
295 #define T_PAGEFLT 14 /* Page fault */
296 #define T_RESERVED 15 /* Unknown exception */
297 #define T_ARITHTRAP 16 /* Floating point exception */
298 #define T_ALIGNFLT 17 /* Alignment check exception */
299 #define T_MCHK 18 /* Machine check exception */
300 #define T_CACHEFLT 19 /* Cache flush exception */
303 #define T_UNKNOWN (-1) /* Unknown fault (TRAP_sig not defined) */
305 #include "wine/exception.h"
307 #include "stackframe.h"
311 #include "syslevel.h"
312 #include "debugtools.h"
314 DEFAULT_DEBUG_CHANNEL(seh
)
318 /***********************************************************************
321 * Initialization code for a signal handler.
322 * Restores the proper %fs value for the current thread.
324 static inline void handler_init( CONTEXT
*context
, const SIGCONTEXT
*sigcontext
)
327 /* get %fs at time of the fault */
329 fs
= FS_sig(sigcontext
);
334 /* now restore a proper %fs for the fault handler */
335 if (!IS_SELECTOR_SYSTEM(CS_sig(sigcontext
))) fs
= SYSLEVEL_Win16CurrentTeb
;
336 if (!fs
) fs
= SYSLEVEL_EmergencyTeb
;
340 /***********************************************************************
343 * Get the trap code for a signal.
345 static inline int get_trap_code( const SIGCONTEXT
*sigcontext
)
348 return TRAP_sig(sigcontext
);
350 return T_UNKNOWN
; /* unknown trap code */
354 /***********************************************************************
357 * Set the register values from a sigcontext.
359 static void save_context( CONTEXT
*context
, const SIGCONTEXT
*sigcontext
)
361 context
->Eax
= EAX_sig(sigcontext
);
362 context
->Ebx
= EBX_sig(sigcontext
);
363 context
->Ecx
= ECX_sig(sigcontext
);
364 context
->Edx
= EDX_sig(sigcontext
);
365 context
->Esi
= ESI_sig(sigcontext
);
366 context
->Edi
= EDI_sig(sigcontext
);
367 context
->Ebp
= EBP_sig(sigcontext
);
368 context
->EFlags
= EFL_sig(sigcontext
);
369 context
->Eip
= EIP_sig(sigcontext
);
370 context
->Esp
= ESP_sig(sigcontext
);
371 context
->SegCs
= LOWORD(CS_sig(sigcontext
));
372 context
->SegDs
= LOWORD(DS_sig(sigcontext
));
373 context
->SegEs
= LOWORD(ES_sig(sigcontext
));
374 context
->SegSs
= LOWORD(SS_sig(sigcontext
));
375 /* %fs already handled in handler_init */
377 context
->SegGs
= LOWORD(GS_sig(sigcontext
));
379 context
->SegGs
= __get_gs();
381 if (ISV86(context
)) V86BASE(context
) = (DWORD
)DOSMEM_MemoryBase(0);
385 /***********************************************************************
388 * Build a sigcontext from the register values.
390 static void restore_context( const CONTEXT
*context
, SIGCONTEXT
*sigcontext
)
392 EAX_sig(sigcontext
) = context
->Eax
;
393 EBX_sig(sigcontext
) = context
->Ebx
;
394 ECX_sig(sigcontext
) = context
->Ecx
;
395 EDX_sig(sigcontext
) = context
->Edx
;
396 ESI_sig(sigcontext
) = context
->Esi
;
397 EDI_sig(sigcontext
) = context
->Edi
;
398 EBP_sig(sigcontext
) = context
->Ebp
;
399 EFL_sig(sigcontext
) = context
->EFlags
;
400 EIP_sig(sigcontext
) = context
->Eip
;
401 ESP_sig(sigcontext
) = context
->Esp
;
402 CS_sig(sigcontext
) = context
->SegCs
;
403 DS_sig(sigcontext
) = context
->SegDs
;
404 ES_sig(sigcontext
) = context
->SegEs
;
405 SS_sig(sigcontext
) = context
->SegSs
;
407 FS_sig(sigcontext
) = context
->SegFs
;
409 __set_fs( context
->SegFs
);
412 GS_sig(sigcontext
) = context
->SegGs
;
414 __set_gs( context
->SegGs
);
419 /***********************************************************************
422 * Set the FPU context from a sigcontext.
424 static void inline save_fpu( CONTEXT
*context
, const SIGCONTEXT
*sigcontext
)
427 if (FPU_sig(sigcontext
))
429 context
->FloatSave
= *FPU_sig(sigcontext
);
434 __asm__
__volatile__( "fnsave %0; fwait" : "=m" (context
->FloatSave
) );
435 #endif /* __GNUC__ */
439 /***********************************************************************
442 * Restore the FPU context to a sigcontext.
444 static void inline restore_fpu( CONTEXT
*context
, const SIGCONTEXT
*sigcontext
)
447 if (FPU_sig(sigcontext
))
449 *FPU_sig(sigcontext
) = context
->FloatSave
;
454 /* avoid nested exceptions */
455 context
->FloatSave
.StatusWord
&= context
->FloatSave
.ControlWord
| 0xffffff80;
456 __asm__
__volatile__( "frstor %0; fwait" : : "m" (context
->FloatSave
) );
457 #endif /* __GNUC__ */
461 /**********************************************************************
464 * Get the FPU exception code from the FPU status.
466 static inline DWORD
get_fpu_code( const CONTEXT
*context
)
468 DWORD status
= context
->FloatSave
.StatusWord
;
470 if (status
& 0x01) /* IE */
472 if (status
& 0x40) /* SF */
473 return EXCEPTION_FLT_STACK_CHECK
;
475 return EXCEPTION_FLT_INVALID_OPERATION
;
477 if (status
& 0x02) return EXCEPTION_FLT_DENORMAL_OPERAND
; /* DE flag */
478 if (status
& 0x04) return EXCEPTION_FLT_DIVIDE_BY_ZERO
; /* ZE flag */
479 if (status
& 0x08) return EXCEPTION_FLT_OVERFLOW
; /* OE flag */
480 if (status
& 0x10) return EXCEPTION_FLT_UNDERFLOW
; /* UE flag */
481 if (status
& 0x20) return EXCEPTION_FLT_INEXACT_RESULT
; /* PE flag */
482 return EXCEPTION_FLT_INVALID_OPERATION
; /* generic error */
486 /**********************************************************************
489 * Handler for SIGSEGV and related errors.
491 static HANDLER_DEF(segv_handler
)
493 EXCEPTION_RECORD rec
;
495 DWORD page_fault_code
= EXCEPTION_ACCESS_VIOLATION
;
497 handler_init( &context
, HANDLER_CONTEXT
);
500 /* we want the page-fault case to be fast */
501 if (get_trap_code(HANDLER_CONTEXT
) == T_PAGEFLT
)
502 if (!(page_fault_code
= VIRTUAL_HandleFault( (LPVOID
)CR2_sig(HANDLER_CONTEXT
) ))) return;
505 save_context( &context
, HANDLER_CONTEXT
);
506 rec
.ExceptionRecord
= NULL
;
507 rec
.ExceptionFlags
= EXCEPTION_CONTINUABLE
;
508 rec
.ExceptionAddress
= (LPVOID
)context
.Eip
;
509 rec
.NumberParameters
= 0;
511 switch(get_trap_code(HANDLER_CONTEXT
))
513 case T_OFLOW
: /* Overflow exception */
514 rec
.ExceptionCode
= EXCEPTION_INT_OVERFLOW
;
516 case T_BOUND
: /* Bound range exception */
517 rec
.ExceptionCode
= EXCEPTION_ARRAY_BOUNDS_EXCEEDED
;
519 case T_PRIVINFLT
: /* Invalid opcode exception */
520 rec
.ExceptionCode
= EXCEPTION_ILLEGAL_INSTRUCTION
;
522 case T_STKFLT
: /* Stack fault */
523 rec
.ExceptionCode
= EXCEPTION_STACK_OVERFLOW
;
525 case T_SEGNPFLT
: /* Segment not present exception */
526 case T_PROTFLT
: /* General protection fault */
527 case T_UNKNOWN
: /* Unknown fault code */
528 if (INSTR_EmulateInstruction( &context
)) goto restore
;
529 rec
.ExceptionCode
= EXCEPTION_PRIV_INSTRUCTION
;
531 case T_PAGEFLT
: /* Page fault */
533 rec
.NumberParameters
= 2;
535 rec
.ExceptionInformation
[0] = (ERROR_sig(HANDLER_CONTEXT
) & 2) != 0;
537 rec
.ExceptionInformation
[0] = 0;
538 #endif /* ERROR_sig */
539 rec
.ExceptionInformation
[1] = CR2_sig(HANDLER_CONTEXT
);
541 rec
.ExceptionCode
= page_fault_code
;
543 case T_ALIGNFLT
: /* Alignment check exception */
544 /* FIXME: pass through exception handler first? */
545 if (context
.EFlags
& 0x00040000)
547 /* Disable AC flag, return */
548 context
.EFlags
&= ~0x00040000;
551 rec
.ExceptionCode
= EXCEPTION_DATATYPE_MISALIGNMENT
;
554 ERR( "Got unexpected trap %d\n", get_trap_code(HANDLER_CONTEXT
) );
556 case T_NMI
: /* NMI interrupt */
557 case T_DNA
: /* Device not available exception */
558 case T_DOUBLEFLT
: /* Double fault exception */
559 case T_TSSFLT
: /* Invalid TSS exception */
560 case T_RESERVED
: /* Unknown exception */
561 case T_MCHK
: /* Machine check exception */
563 case T_CACHEFLT
: /* Cache flush exception */
565 rec
.ExceptionCode
= EXCEPTION_ILLEGAL_INSTRUCTION
;
569 EXC_RtlRaiseException( &rec
, &context
);
571 restore_context( &context
, HANDLER_CONTEXT
);
575 /**********************************************************************
578 * Handler for SIGTRAP.
580 static HANDLER_DEF(trap_handler
)
582 EXCEPTION_RECORD rec
;
585 handler_init( &context
, HANDLER_CONTEXT
);
587 save_context( &context
, HANDLER_CONTEXT
);
588 rec
.ExceptionFlags
= EXCEPTION_CONTINUABLE
;
589 rec
.ExceptionRecord
= NULL
;
590 rec
.ExceptionAddress
= (LPVOID
)context
.Eip
;
591 rec
.NumberParameters
= 0;
593 switch(get_trap_code(HANDLER_CONTEXT
))
595 case T_TRCTRAP
: /* Single-step exception */
596 rec
.ExceptionCode
= EXCEPTION_SINGLE_STEP
;
597 context
.EFlags
&= ~0x100; /* clear single-step flag */
599 case T_BPTFLT
: /* Breakpoint exception */
600 rec
.ExceptionAddress
= (char *) rec
.ExceptionAddress
- 1; /* back up over the int3 instruction */
603 rec
.ExceptionCode
= EXCEPTION_BREAKPOINT
;
606 EXC_RtlRaiseException( &rec
, &context
);
607 restore_context( &context
, HANDLER_CONTEXT
);
611 /**********************************************************************
614 * Handler for SIGFPE.
616 static HANDLER_DEF(fpe_handler
)
618 EXCEPTION_RECORD rec
;
621 handler_init( &context
, HANDLER_CONTEXT
);
623 save_fpu( &context
, HANDLER_CONTEXT
);
625 switch(get_trap_code(HANDLER_CONTEXT
))
627 case T_DIVIDE
: /* Division by zero exception */
628 rec
.ExceptionCode
= EXCEPTION_INT_DIVIDE_BY_ZERO
;
630 case T_FPOPFLT
: /* Coprocessor segment overrun */
631 rec
.ExceptionCode
= EXCEPTION_FLT_INVALID_OPERATION
;
633 case T_ARITHTRAP
: /* Floating point exception */
634 case T_UNKNOWN
: /* Unknown fault code */
635 rec
.ExceptionCode
= get_fpu_code( &context
);
638 ERR( "Got unexpected trap %d\n", get_trap_code(HANDLER_CONTEXT
) );
639 rec
.ExceptionCode
= EXCEPTION_FLT_INVALID_OPERATION
;
642 save_context( &context
, HANDLER_CONTEXT
);
643 rec
.ExceptionFlags
= EXCEPTION_CONTINUABLE
;
644 rec
.ExceptionRecord
= NULL
;
645 rec
.ExceptionAddress
= (LPVOID
)context
.Eip
;
646 rec
.NumberParameters
= 0;
647 EXC_RtlRaiseException( &rec
, &context
);
648 restore_context( &context
, HANDLER_CONTEXT
);
649 restore_fpu( &context
, HANDLER_CONTEXT
);
653 /**********************************************************************
656 * Handler for SIGINT.
658 static HANDLER_DEF(int_handler
)
660 EXCEPTION_RECORD rec
;
663 handler_init( &context
, HANDLER_CONTEXT
);
664 save_context( &context
, HANDLER_CONTEXT
);
665 rec
.ExceptionCode
= CONTROL_C_EXIT
;
666 rec
.ExceptionFlags
= EXCEPTION_CONTINUABLE
;
667 rec
.ExceptionRecord
= NULL
;
668 rec
.ExceptionAddress
= (LPVOID
)context
.Eip
;
669 rec
.NumberParameters
= 0;
670 EXC_RtlRaiseException( &rec
, &context
);
671 restore_context( &context
, HANDLER_CONTEXT
);
675 /***********************************************************************
678 * Set a signal handler
680 static int set_handler( int sig
, int have_sigaltstack
, void (*func
)() )
682 struct sigaction sig_act
;
685 if (!have_sigaltstack
&& NtCurrentTeb()->signal_stack
)
687 struct kernel_sigaction sig_act
;
688 sig_act
.ksa_handler
= func
;
689 sig_act
.ksa_flags
= SA_RESTART
| SA_NOMASK
;
690 sig_act
.ksa_mask
= 0;
691 /* point to the top of the stack */
692 sig_act
.ksa_restorer
= (char *)NtCurrentTeb()->signal_stack
+ SIGNAL_STACK_SIZE
;
693 return wine_sigaction( sig
, &sig_act
, NULL
);
696 sig_act
.sa_handler
= func
;
697 sigemptyset( &sig_act
.sa_mask
);
700 sig_act
.sa_flags
= SA_RESTART
| SA_NOMASK
;
701 #elif defined (__svr4__) || defined(_SCO_DS)
702 sig_act
.sa_flags
= SA_SIGINFO
| SA_RESTART
;
704 sig_act
.sa_flags
= 0;
708 if (have_sigaltstack
) sig_act
.sa_flags
|= SA_ONSTACK
;
710 return sigaction( sig
, &sig_act
, NULL
);
714 /**********************************************************************
717 BOOL
SIGNAL_Init(void)
719 int have_sigaltstack
= 0;
721 #ifdef HAVE_SIGALTSTACK
722 struct sigaltstack ss
;
723 if ((ss
.ss_sp
= NtCurrentTeb()->signal_stack
))
725 ss
.ss_size
= SIGNAL_STACK_SIZE
;
727 if (!sigaltstack(&ss
, NULL
)) have_sigaltstack
= 1;
729 /* sigaltstack may fail because the kernel is too old, or
730 because glibc is brain-dead. In the latter case a
731 direct system call should succeed. */
732 else if (!wine_sigaltstack(&ss
, NULL
)) have_sigaltstack
= 1;
735 #endif /* HAVE_SIGALTSTACK */
737 /* automatic child reaping to avoid zombies */
738 signal( SIGCHLD
, SIG_IGN
);
740 if (set_handler( SIGINT
, have_sigaltstack
, (void (*)())int_handler
) == -1) goto error
;
741 if (set_handler( SIGFPE
, have_sigaltstack
, (void (*)())fpe_handler
) == -1) goto error
;
742 if (set_handler( SIGSEGV
, have_sigaltstack
, (void (*)())segv_handler
) == -1) goto error
;
743 if (set_handler( SIGILL
, have_sigaltstack
, (void (*)())segv_handler
) == -1) goto error
;
745 if (set_handler( SIGBUS
, have_sigaltstack
, (void (*)())segv_handler
) == -1) goto error
;
748 if (set_handler( SIGTRAP
, have_sigaltstack
, (void (*)())trap_handler
) == -1) goto error
;
757 /**********************************************************************
758 * DbgBreakPoint (NTDLL)
760 void WINAPI
DbgBreakPoint(void);
761 __ASM_GLOBAL_FUNC( DbgBreakPoint
, "int $3; ret");
763 /**********************************************************************
764 * DbgUserBreakPoint (NTDLL)
766 void WINAPI
DbgUserBreakPoint(void);
767 __ASM_GLOBAL_FUNC( DbgUserBreakPoint
, "int $3; ret");
769 #endif /* __i386__ */