X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fppc-arch.c;h=533293d8835638d4ea38cc4c1f4dedc816cb11ed;hb=f2db6743b1fadeea9e72cb583d857851c87efcd4;hp=dca032e751fe8a4691f156f192760338122c1531;hpb=5f4fe75b7ee2b33e263097415240d198b6275de3;p=sbcl.git diff --git a/src/runtime/ppc-arch.c b/src/runtime/ppc-arch.c index dca032e..533293d 100644 --- a/src/runtime/ppc-arch.c +++ b/src/runtime/ppc-arch.c @@ -16,11 +16,13 @@ #include "globals.h" #include "validate.h" #include "os.h" +#include "interrupt.h" #include "lispregs.h" #include "signal.h" #include "interrupt.h" #include "interr.h" #include "breakpoint.h" +#include "alloc.h" #if defined(LISP_FEATURE_GENCGC) #include "gencgc-alloc-region.h" @@ -84,7 +86,18 @@ arch_internal_error_arguments(os_context_t *context) boolean arch_pseudo_atomic_atomic(os_context_t *context) { - return ((*os_context_register_addr(context,reg_ALLOC)) & 4); + /* FIXME: this foreign_function_call_active test is dubious at + * best. If a foreign call is made in a pseudo atomic section + * (?) or more likely a pseudo atomic section is in a foreign + * call then an interrupt is executed immediately. Maybe it + * has to do with C code not maintaining pseudo atomic + * properly. MG - 2005-08-10 + * + * The foreign_function_call_active used to live at each call-site + * to arch_pseudo_atomic_atomic, but this seems clearer. + * --NS 2007-05-15 */ + return (!foreign_function_call_active) + && ((*os_context_register_addr(context,reg_ALLOC)) & 4); } void @@ -344,7 +357,13 @@ handle_allocation_trap(os_context_t * context) dynamic_space_free_pointer); #endif - memory = (char *) alloc(size); + { + struct interrupt_data *data = + arch_os_get_current_thread()->interrupt_data; + data->allocation_trap_context = context; + memory = (char *) alloc(size); + data->allocation_trap_context = 0; + } #if 0 fprintf(stderr, "alloc returned %p\n", memory); @@ -415,9 +434,6 @@ sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) { unsigned int code; -#ifdef LISP_FEATURE_LINUX - os_restore_fp_control(context); -#endif code=*((u32 *)(*os_context_pc_addr(context))); if (code == ((3 << 26) | (0x18 << 21) | (reg_NL3 << 16))) { arch_clear_pseudo_atomic_interrupted(context); @@ -433,9 +449,6 @@ sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) if (allocation_trap_p(context)) { handle_allocation_trap(context); arch_skip_instruction(context); -#ifdef LISP_FEATURE_DARWIN - DARWIN_FIX_CONTEXT(context); -#endif return; } #endif @@ -444,32 +457,21 @@ sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) /* twllei reg_ZERO,N will always trap if reg_ZERO = 0 */ int trap = code & 0x1f; handle_trap(context,trap); - -#ifdef LISP_FEATURE_DARWIN - DARWIN_FIX_CONTEXT(context); -#endif return; } if (((code >> 26) == 3) && (((code >> 21) & 31) == 24)) { interrupt_internal_error(context, 0); -#ifdef LISP_FEATURE_DARWIN - DARWIN_FIX_CONTEXT(context); -#endif return; } - interrupt_handle_now(signal, code, context); -#ifdef LISP_FEATURE_DARWIN - /* Work around G5 bug */ - DARWIN_FIX_CONTEXT(context); -#endif + interrupt_handle_now(signal, (siginfo_t *)code, context); } void arch_install_interrupt_handlers() { - undoably_install_low_level_interrupt_handler(SIGILL,sigtrap_handler); - undoably_install_low_level_interrupt_handler(SIGTRAP,sigtrap_handler); + undoably_install_low_level_interrupt_handler(SIGILL, sigtrap_handler); + undoably_install_low_level_interrupt_handler(SIGTRAP, sigtrap_handler); } void