From: Gabor M. <me...@us...> - 2009-02-16 22:30:31
|
Update of /cvsroot/sbcl/sbcl/src/runtime In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18488/src/runtime Modified Files: bsd-os.c hppa-arch.c hpux-os.c interrupt.c interrupt.h linux-os.c mips-arch.c osf1-os.c ppc-arch.c runtime.c sparc-arch.c sparc-linux-os.h sunos-os.c x86-64-arch.c x86-64-darwin-os.c x86-arch.c x86-darwin-os.c Log Message: 1.0.25.54: centralize scattered arch_os_get_context() calls ... to the six signal handlers trampolines. These are now the only places where void_context appears, the rest of the runtime uses os_context_t. Also, the &void_context+37 hack was removed. On Sparc/Linux the third parameter of SA_SIGINFO signal handlers is a pointer to sigcontext, which happens to be the same as &void_context+37 most of the time, though. I have tested two on Sparc/Linux boxes, one running 2.6.26 that randomly segfaulted compiling itself with 1.0.25.12, and another runnin 2.6.24 that worked fine before at that version. Thanks to Bruce O'Neel for the shell access. Index: bsd-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/bsd-os.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- bsd-os.c 16 Feb 2009 22:27:07 -0000 1.60 +++ bsd-os.c 16 Feb 2009 22:30:25 -0000 1.61 @@ -194,14 +194,13 @@ */ void -memory_fault_handler(int signal, siginfo_t *siginfo, void *void_context +memory_fault_handler(int signal, siginfo_t *siginfo, os_context_t *context #if defined(LISP_FEATURE_FREEBSD) && defined(LISP_FEATURE_X86_64) /* FreeBSD/amd64 stores fault address only in undocumented 4th arg. */ ,void *fault_addr #endif ) { - os_context_t *context = arch_os_get_context(&void_context); #if defined(LISP_FEATURE_FREEBSD) && defined(LISP_FEATURE_X86_64) /* KLUDGE: Store fault address into si_addr for compatibilities. */ siginfo->si_addr = fault_addr; @@ -224,7 +223,8 @@ #if defined(LISP_FEATURE_MACH_EXCEPTION_HANDLER) void -mach_error_memory_fault_handler(int signal, siginfo_t *siginfo, void *void_context) { +mach_error_memory_fault_handler(int signal, siginfo_t *siginfo, + os_context_t *context) { lose("Unhandled memory fault. Exiting."); } #endif @@ -254,9 +254,8 @@ #else /* Currently PPC/Darwin/Cheney only */ static void -sigsegv_handler(int signal, siginfo_t *info, void* void_context) +sigsegv_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); #if 0 unsigned int pc = (unsigned int *)(*os_context_pc_addr(context)); #endif Index: hppa-arch.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/hppa-arch.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- hppa-arch.c 3 Jan 2009 16:26:22 -0000 1.15 +++ hppa-arch.c 16 Feb 2009 22:30:25 -0000 1.16 @@ -251,9 +251,8 @@ } static void -sigtrap_handler(int signal, siginfo_t *siginfo, void *void_context) +sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int bad_inst; bad_inst = *(unsigned int *)(*os_context_pc_addr(context) & ~3); @@ -266,9 +265,8 @@ } static void -sigill_handler(int signal, siginfo_t *siginfo, void *void_context) +sigill_handler(int signal, siginfo_t *siginfo, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int bad_inst; bad_inst = *(unsigned int *)(*os_context_pc_addr(context) & ~3); @@ -281,9 +279,9 @@ } } -static void sigfpe_handler(int signal, siginfo_t *siginfo, void *void_context) +static void sigfpe_handler(int signal, siginfo_t *siginfo, + os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int badinst; int opcode, r1, r2, t; long op1, op2, res; @@ -373,9 +371,9 @@ the light of day. Since the instructions that we need to fix up tend not to be doing unaligned memory access, this should be a safe workaround. -- CSR, 2002-08-17 */ -static void sigbus_handler(int signal, siginfo_t *siginfo, void *void_context) +static void sigbus_handler(int signal, siginfo_t *siginfo, + os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int badinst; int opcode, r1, r2, t; long op1, op2, res; @@ -450,7 +448,7 @@ } static void -ignore_handler(int signal, siginfo_t *siginfo, void *void_context) +ignore_handler(int signal, siginfo_t *siginfo, os_context_t *context) { } @@ -468,4 +466,3 @@ undoably_install_low_level_interrupt_handler(SIGXFSZ,ignore_handler); #endif } - Index: hpux-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/hpux-os.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- hpux-os.c 16 Feb 2009 22:27:07 -0000 1.2 +++ hpux-os.c 16 Feb 2009 22:30:25 -0000 1.3 @@ -116,9 +116,8 @@ */ static void -sigsegv_handler(int signal, siginfo_t *info, void* void_context) +sigsegv_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); os_vm_address_t addr = arch_get_bad_addr(signal, info, context); if (!cheneygc_handle_wp_violation(context, addr)) Index: interrupt.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/interrupt.c,v retrieving revision 1.166 retrieving revision 1.167 diff -u -d -r1.166 -r1.167 --- interrupt.c 16 Feb 2009 22:27:07 -0000 1.166 +++ interrupt.c 16 Feb 2009 22:30:25 -0000 1.167 @@ -89,6 +89,14 @@ * low_level_handle_now_handler * low_level_maybe_now_maybe_later * low_level_unblock_me_trampoline + * + * This gives us a single point of control (or six) over errno, fp + * control word, and fixing up signal context on sparc. + * + * The SPARC/Linux platform doesn't quite do signals the way we want + * them done. The third argument in the handler isn't filled in by the + * kernel properly, so we fix it up ourselves in the + * arch_os_get_context(..) function. -- CSR, 2002-07-23 */ #define SAVE_ERRNO(context,void_context) \ { \ @@ -101,7 +109,8 @@ errno = _saved_errno; \ } -static void run_deferred_handler(struct interrupt_data *data, void *v_context); +static void run_deferred_handler(struct interrupt_data *data, + os_context_t *context); #ifndef LISP_FEATURE_WIN32 static void store_signal_data_for_later (struct interrupt_data *data, void *handler, int signal, @@ -412,7 +421,8 @@ boolean internal_errors_enabled = 0; #ifndef LISP_FEATURE_WIN32 -static void (*interrupt_low_level_handlers[NSIG]) (int, siginfo_t*, void*); +static +void (*interrupt_low_level_handlers[NSIG]) (int, siginfo_t*, os_context_t*); #endif union interrupt_handler interrupt_handlers[NSIG]; @@ -826,9 +836,7 @@ arch_clear_pseudo_atomic_interrupted(context); /* Restore the sigmask in the context. */ sigcopyset(os_context_sigmask_addr(context), &data->pending_mask); - /* This will break on sparc linux: the deferred handler really - * wants to be called with a void_context */ - run_deferred_handler(data,(void *)context); + run_deferred_handler(data, context); } /* It is possible that the end of this function was reached * without never actually doing anything, the tests in Lisp for @@ -837,20 +845,6 @@ #endif } -/* - * the two main signal handlers: - * interrupt_handle_now(..) - * maybe_now_maybe_later(..) - * - * to which we have added interrupt_handle_now_handler(..). Why? - * Well, mostly because the SPARC/Linux platform doesn't quite do - * signals the way we want them done. The third argument in the - * handler isn't filled in by the kernel properly, so we fix it up - * ourselves in the arch_os_get_context(..) function; however, we only - * want to do this when we first hit the handler, and not when - * interrupt_handle_now(..) is being called from some other handler - * (when the fixup will already have been done). -- CSR, 2002-07-23 - */ void interrupt_handle_now(int signal, siginfo_t *info, os_context_t *context) @@ -951,17 +945,18 @@ * already; we're just doing the Lisp-level processing now that we * put off then */ static void -run_deferred_handler(struct interrupt_data *data, void *v_context) +run_deferred_handler(struct interrupt_data *data, os_context_t *context) { /* The pending_handler may enable interrupts and then another * interrupt may hit, overwrite interrupt_data, so reset the * pending handler before calling it. Trust the handler to finish * with the siginfo before enabling interrupts. */ - void (*pending_handler) (int, siginfo_t*, void*)=data->pending_handler; + void (*pending_handler) (int, siginfo_t*, os_context_t*) = + data->pending_handler; data->pending_handler=0; FSHOW_SIGNAL((stderr, "/running deferred handler %p\n", pending_handler)); - (*pending_handler)(data->pending_signal,&(data->pending_info), v_context); + (*pending_handler)(data->pending_signal,&(data->pending_info), context); } #ifndef LISP_FEATURE_WIN32 @@ -1088,10 +1083,8 @@ /* This function must not cons, because that may trigger a GC. */ void -sig_stop_for_gc_handler(int signal, siginfo_t *info, void *void_context) +sig_stop_for_gc_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); - struct thread *thread=arch_os_get_current_thread(); sigset_t ss; @@ -1546,7 +1539,7 @@ sigemptyset(&unblock); sigaddset(&unblock, signal); thread_sigmask(SIG_UNBLOCK, &unblock, 0); - (*interrupt_low_level_handlers[signal])(signal, info, void_context); + (*interrupt_low_level_handlers[signal])(signal, info, context); RESTORE_ERRNO; } @@ -1554,7 +1547,7 @@ low_level_handle_now_handler(int signal, siginfo_t *info, void *void_context) { SAVE_ERRNO(context,void_context); - (*interrupt_low_level_handlers[signal])(signal, info, void_context); + (*interrupt_low_level_handlers[signal])(signal, info, context); RESTORE_ERRNO; } @@ -1569,18 +1562,12 @@ } if (ARE_SAME_HANDLER(handler, SIG_DFL)) - sa.sa_sigaction = handler; + sa.sa_sigaction = (void (*)(int, siginfo_t*, void*))handler; else if (sigismember(&deferrable_sigset,signal)) sa.sa_sigaction = low_level_maybe_now_maybe_later; - /* The use of a trampoline appears to break the - arch_os_get_context() workaround for SPARC/Linux. For now, - don't use the trampoline (and so be vulnerable to the problems - that SA_NODEFER is meant to solve. */ -#if !(defined(LISP_FEATURE_SPARC) && defined(LISP_FEATURE_LINUX)) else if (!sigaction_nodefer_works && !sigismember(&blockable_sigset, signal)) sa.sa_sigaction = low_level_unblock_me_trampoline; -#endif else sa.sa_sigaction = low_level_handle_now_handler; @@ -1600,7 +1587,7 @@ /* This is called from Lisp. */ unsigned long -install_handler(int signal, void handler(int, siginfo_t*, void*)) +install_handler(int signal, void handler(int, siginfo_t*, os_context_t*)) { #ifndef LISP_FEATURE_WIN32 struct sigaction sa; @@ -1618,7 +1605,7 @@ if (interrupt_low_level_handlers[signal]==0) { if (ARE_SAME_HANDLER(handler, SIG_DFL) || ARE_SAME_HANDLER(handler, SIG_IGN)) - sa.sa_sigaction = handler; + sa.sa_sigaction = (void (*)(int, siginfo_t*, void*))handler; else if (sigismember(&deferrable_sigset, signal)) sa.sa_sigaction = maybe_now_maybe_later; else if (!sigaction_nodefer_works && @@ -1650,7 +1637,7 @@ /* This must not go through lisp as it's allowed anytime, even when on * the altstack. */ void -sigabrt_handler(int signal, siginfo_t *info, void *void_context) +sigabrt_handler(int signal, siginfo_t *info, os_context_t *context) { lose("SIGABRT received.\n"); } @@ -1677,7 +1664,7 @@ * signal(..)-style one-argument handlers, which is OK * because it works to call the 1-argument form where the * 3-argument form is expected.) */ - (void (*)(int, siginfo_t*, void*))SIG_DFL; + (void (*)(int, siginfo_t*, os_context_t*))SIG_DFL; } undoably_install_low_level_interrupt_handler(SIGABRT, sigabrt_handler); SHOW("returning from interrupt_init()"); Index: interrupt.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/interrupt.h,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- interrupt.h 16 Feb 2009 22:16:20 -0000 1.44 +++ interrupt.h 16 Feb 2009 22:30:25 -0000 1.45 @@ -86,7 +86,7 @@ union interrupt_handler { lispobj lisp; - void (*c)(int, siginfo_t*, void*); + void (*c)(int, siginfo_t*, os_context_t*); }; extern union interrupt_handler interrupt_handlers[NSIG]; @@ -94,7 +94,7 @@ struct interrupt_data { /* signal information for pending signal. pending_signal=0 when there * is no pending signal. */ - void (*pending_handler) (int, siginfo_t*, void*) ; + void (*pending_handler) (int, siginfo_t*, os_context_t*) ; int pending_signal; siginfo_t pending_info; sigset_t pending_mask; @@ -123,9 +123,9 @@ #endif #ifdef LISP_FEATURE_SB_THREAD -extern void sig_stop_for_gc_handler(int, siginfo_t*, void*); +extern void sig_stop_for_gc_handler(int, siginfo_t*, os_context_t*); #endif -typedef void (*interrupt_handler_t)(int, siginfo_t *, void *); +typedef void (*interrupt_handler_t)(int, siginfo_t *, os_context_t *); extern void undoably_install_low_level_interrupt_handler ( int signal, interrupt_handler_t handler); Index: linux-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/linux-os.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- linux-os.c 16 Feb 2009 22:27:07 -0000 1.78 +++ linux-os.c 16 Feb 2009 22:30:25 -0000 1.79 @@ -376,9 +376,8 @@ * page fault on this OS. */ static void -sigsegv_handler(int signal, siginfo_t *info, void* void_context) +sigsegv_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); os_vm_address_t addr = arch_get_bad_addr(signal, info, context); #ifdef LISP_FEATURE_ALPHA Index: mips-arch.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/mips-arch.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- mips-arch.c 16 Feb 2009 22:20:16 -0000 1.33 +++ mips-arch.c 16 Feb 2009 22:30:25 -0000 1.34 @@ -396,9 +396,8 @@ } static void -sigtrap_handler(int signal, siginfo_t *info, void *void_context) +sigtrap_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int code = (os_context_insn(context) >> 6) & 0xfffff; /* FIXME: This magic number is pseudo-atomic-trap from parms.lisp. * Genesis should provide the proper #define, but it specialcases @@ -415,9 +414,8 @@ #define FIXNUM_VALUE(lispobj) (((int)lispobj) >> N_FIXNUM_TAG_BITS) static void -sigfpe_handler(int signal, siginfo_t *info, void *void_context) +sigfpe_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int bad_inst = os_context_insn(context); unsigned int op, rs, rt, rd, funct, dest = 32; int immed; Index: osf1-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/osf1-os.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- osf1-os.c 16 Feb 2009 22:27:07 -0000 1.13 +++ osf1-os.c 16 Feb 2009 22:30:25 -0000 1.14 @@ -122,10 +122,8 @@ static void -sigsegv_handler(int signal, siginfo_t *info, void* void_context) +sigsegv_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); - os_vm_address_t addr = arch_get_bad_addr(signal,info,context); if (addr != NULL && Index: ppc-arch.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/ppc-arch.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- ppc-arch.c 16 Feb 2009 22:20:16 -0000 1.28 +++ ppc-arch.c 16 Feb 2009 22:30:25 -0000 1.29 @@ -423,10 +423,9 @@ } static void -sigtrap_handler(int signal, siginfo_t *siginfo, void *void_context) +sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) { unsigned int code; - os_context_t *context = void_context; code=*((u32 *)(*os_context_pc_addr(context))); if (code == ((3 << 26) | (0x18 << 21) | (reg_NL3 << 16))) { Index: runtime.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/runtime.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- runtime.c 16 Feb 2009 21:36:13 -0000 1.78 +++ runtime.c 16 Feb 2009 22:30:25 -0000 1.79 @@ -79,10 +79,10 @@ /* SIGINT handler that invokes the monitor (for when Lisp isn't up to it) */ static void -sigint_handler(int signal, siginfo_t *info, void *void_context) +sigint_handler(int signal, siginfo_t *info, os_context_t *context) { lose("\nSIGINT hit at 0x%08lX\n", - (unsigned long) *os_context_pc_addr(void_context)); + (unsigned long) *os_context_pc_addr(context)); } /* (This is not static, because we want to be able to call it from Index: sparc-arch.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/sparc-arch.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- sparc-arch.c 16 Feb 2009 22:20:16 -0000 1.25 +++ sparc-arch.c 16 Feb 2009 22:30:25 -0000 1.26 @@ -251,10 +251,9 @@ arch_skip_instruction(context); } -static void sigill_handler(int signal, siginfo_t *siginfo, void *void_context) +static void sigill_handler(int signal, siginfo_t *siginfo, + os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); - if ((siginfo->si_code) == ILL_ILLOPC #ifdef LISP_FEATURE_LINUX || (linux_sparc_siginfo_bug && (siginfo->si_code == 2)) @@ -291,12 +290,12 @@ } } -static void sigemt_handler(int signal, siginfo_t *siginfo, void *void_context) +static void sigemt_handler(int signal, siginfo_t *siginfo, + os_context_t *context) { unsigned int badinst; boolean subtract, immed; int rd, rs1, op1, rs2, op2, result; - os_context_t *context = arch_os_get_context(&void_context); badinst = *(unsigned int *)os_context_pc_addr(context); if ((badinst >> 30) != 2 || ((badinst >> 20) & 0x1f) != 0x11) { Index: sparc-linux-os.h =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/sparc-linux-os.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- sparc-linux-os.h 25 Jul 2007 21:37:31 -0000 1.5 +++ sparc-linux-os.h 16 Feb 2009 22:30:25 -0000 1.6 @@ -7,7 +7,7 @@ static inline os_context_t *arch_os_get_context(void **void_context) { asm volatile ("ta 0x03"); /* ta ST_FLUSH_WINDOWS */ - return (os_context_t *) (void_context + 37); + return (os_context_t *) (*void_context); } unsigned long os_context_fp_control(os_context_t *context); Index: sunos-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/sunos-os.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- sunos-os.c 16 Feb 2009 22:27:07 -0000 1.26 +++ sunos-os.c 16 Feb 2009 22:30:25 -0000 1.27 @@ -197,9 +197,8 @@ #if defined LISP_FEATURE_GENCGC void -sigsegv_handler(int signal, siginfo_t *info, void* void_context) +sigsegv_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); void* fault_addr = (void*)info->si_addr; if (!gencgc_handle_wp_violation(fault_addr)) @@ -210,9 +209,8 @@ #else static void -sigsegv_handler(int signal, siginfo_t *info, void* void_context) +sigsegv_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); os_vm_address_t addr = arch_get_bad_addr(signal, info, context); if (!cheneygc_handle_wp_violation(context, addr)) { Index: x86-64-arch.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-64-arch.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- x86-64-arch.c 16 Feb 2009 22:20:16 -0000 1.26 +++ x86-64-arch.c 16 Feb 2009 22:30:25 -0000 1.27 @@ -230,9 +230,8 @@ void -sigtrap_handler(int signal, siginfo_t *info, void *void_context) +sigtrap_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = (os_context_t*)void_context; unsigned int trap; if (single_stepping && (signal==SIGTRAP)) @@ -273,16 +272,14 @@ } void -sigill_handler(int signal, siginfo_t *siginfo, void *void_context) { - os_context_t *context = (os_context_t*)void_context; - +sigill_handler(int signal, siginfo_t *siginfo, os_context_t *context) { /* Triggering SIGTRAP using int3 is unreliable on OS X/x86, so * we need to use illegal instructions for traps. */ #if defined(LISP_FEATURE_DARWIN) && !defined(LISP_FEATURE_MACH_EXCEPTION_HANDLER) if (*((unsigned short *)*os_context_pc_addr(context)) == 0x0b0f) { *os_context_pc_addr(context) += 2; - return sigtrap_handler(signal, siginfo, void_context); + return sigtrap_handler(signal, siginfo, context); } #endif @@ -324,9 +321,8 @@ } static void -sigfpe_handler(int signal, siginfo_t *siginfo, void *void_context) +sigfpe_handler(int signal, siginfo_t *siginfo, os_context_t *context) { - os_context_t *context = arch_os_get_context(&void_context); unsigned int *mxcsr = arch_os_context_mxcsr_addr(context); if (siginfo->si_code == 0) { /* XMM exception */ Index: x86-64-darwin-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-64-darwin-os.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- x86-64-darwin-os.c 16 Feb 2009 22:23:09 -0000 1.8 +++ x86-64-darwin-os.c 16 Feb 2009 22:30:25 -0000 1.9 @@ -65,9 +65,10 @@ kern_return_t mach_thread_init(mach_port_t thread_exception_port); -void sigill_handler(int signal, siginfo_t *siginfo, void *void_context); -void sigtrap_handler(int signal, siginfo_t *siginfo, void *void_context); -void memory_fault_handler(int signal, siginfo_t *siginfo, void *void_context); +void sigill_handler(int signal, siginfo_t *siginfo, os_context_t *context); +void sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context); +void memory_fault_handler(int signal, siginfo_t *siginfo, + os_context_t *context); /* exc_server handles mach exception messages from the kernel and * calls catch exception raise. We use the system-provided @@ -277,18 +278,15 @@ #endif void -control_stack_exhausted_handler(int signal, siginfo_t *siginfo, void *void_context) { - os_context_t *context = arch_os_get_context(&void_context); - +control_stack_exhausted_handler(int signal, siginfo_t *siginfo, + os_context_t *context) { unblock_signals_in_context_and_maybe_warn(context); arrange_return_to_lisp_function (context, StaticSymbolFunction(CONTROL_STACK_EXHAUSTED_ERROR)); } void -undefined_alien_handler(int signal, siginfo_t *siginfo, void *void_context) { - os_context_t *context = arch_os_get_context(&void_context); - +undefined_alien_handler(int signal, siginfo_t *siginfo, os_context_t *context) { arrange_return_to_lisp_function (context, StaticSymbolFunction(UNDEFINED_ALIEN_VARIABLE_ERROR)); } Index: x86-arch.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-arch.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- x86-arch.c 16 Feb 2009 22:20:16 -0000 1.54 +++ x86-arch.c 16 Feb 2009 22:30:25 -0000 1.55 @@ -259,9 +259,8 @@ #ifndef LISP_FEATURE_WIN32 void -sigtrap_handler(int signal, siginfo_t *info, void *void_context) +sigtrap_handler(int signal, siginfo_t *info, os_context_t *context) { - os_context_t *context = (os_context_t*)void_context; unsigned int trap; if (single_stepping && (signal==SIGTRAP)) { @@ -294,16 +293,14 @@ } void -sigill_handler(int signal, siginfo_t *siginfo, void *void_context) { - os_context_t *context = (os_context_t*)void_context; - +sigill_handler(int signal, siginfo_t *siginfo, os_context_t *context) { /* Triggering SIGTRAP using int3 is unreliable on OS X/x86, so * we need to use illegal instructions for traps. */ #if defined(LISP_FEATURE_DARWIN) && !defined(LISP_FEATURE_MACH_EXCEPTION_HANDLER) if (*((unsigned short *)*os_context_pc_addr(context)) == 0x0b0f) { *os_context_pc_addr(context) += 2; - return sigtrap_handler(signal, siginfo, void_context); + return sigtrap_handler(signal, siginfo, context); } #endif fake_foreign_function_call(context); Index: x86-darwin-os.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/x86-darwin-os.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- x86-darwin-os.c 16 Feb 2009 22:23:09 -0000 1.15 +++ x86-darwin-os.c 16 Feb 2009 22:30:25 -0000 1.16 @@ -116,9 +116,10 @@ #ifdef LISP_FEATURE_MACH_EXCEPTION_HANDLER -void sigill_handler(int signal, siginfo_t *siginfo, void *void_context); -void sigtrap_handler(int signal, siginfo_t *siginfo, void *void_context); -void memory_fault_handler(int signal, siginfo_t *siginfo, void *void_context); +void sigill_handler(int signal, siginfo_t *siginfo, os_context_t *context); +void sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context); +void memory_fault_handler(int signal, siginfo_t *siginfo, + os_context_t *context); /* exc_server handles mach exception messages from the kernel and * calls catch exception raise. We use the system-provided @@ -371,8 +372,8 @@ #endif void -control_stack_exhausted_handler(int signal, siginfo_t *siginfo, void *void_context) { - os_context_t *context = arch_os_get_context(&void_context); +control_stack_exhausted_handler(int signal, siginfo_t *siginfo, + os_context_t *context) { unblock_signals_in_context_and_maybe_warn(context); arrange_return_to_lisp_function @@ -380,9 +381,7 @@ } void -undefined_alien_handler(int signal, siginfo_t *siginfo, void *void_context) { - os_context_t *context = arch_os_get_context(&void_context); - +undefined_alien_handler(int signal, siginfo_t *siginfo, os_context_t *context) { arrange_return_to_lisp_function (context, StaticSymbolFunction(UNDEFINED_ALIEN_VARIABLE_ERROR)); } |