X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fppc-arch.c;h=11be9fdfcfe7d823a33bbd30d44ced1c3416b7e3;hb=c1aa8b6b5b870f21bc8c81da85708e9d71d4eb93;hp=35dc8438222645c677b318ce0ed7964acef9fb0a;hpb=6c605fa4b46d3fee9304c4e40e0e605aa5a24f28;p=sbcl.git diff --git a/src/runtime/ppc-arch.c b/src/runtime/ppc-arch.c index 35dc843..11be9fd 100644 --- a/src/runtime/ppc-arch.c +++ b/src/runtime/ppc-arch.c @@ -21,6 +21,7 @@ #include "interrupt.h" #include "interr.h" #include "breakpoint.h" +#include "alloc.h" #if defined(LISP_FEATURE_GENCGC) #include "gencgc-alloc-region.h" @@ -84,7 +85,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 @@ -137,7 +149,7 @@ static unsigned int *skipped_break_addr, displaced_after_inst; static sigset_t orig_sigmask; void -arch_do_displaced_inst(os_context_t *context,unsigned int orig_inst) +arch_do_displaced_inst(os_context_t *context, unsigned int orig_inst) { /* not sure how we ensure that we get the breakpoint reinstalled * after doing this -dan */ @@ -149,6 +161,10 @@ arch_do_displaced_inst(os_context_t *context,unsigned int orig_inst) *pc = orig_inst; os_flush_icache((os_vm_address_t) pc, sizeof(unsigned int)); skipped_break_addr = pc; + + /* FIXME: we should apparently be installing the after-breakpoint + * here, but would need to find the next instruction address for + * it first. alpha-arch.c shows how to do it. --NS 2007-04-02 */ } #ifdef LISP_FEATURE_GENCGC @@ -231,10 +247,8 @@ handle_allocation_trap(os_context_t * context) fprintf(stderr, "In handle_allocation_trap\n"); #endif - /* - * I don't think it's possible for us NOT to be in lisp when we get - * here. Remove this later? - */ + /* I don't think it's possible for us NOT to be in lisp when we get + * here. Remove this later? */ were_in_lisp = !foreign_function_call_active; if (were_in_lisp) { @@ -387,9 +401,6 @@ arch_handle_fun_end_breakpoint(os_context_t *context) =(int)handle_fun_end_breakpoint(context); } -/* FIXME: AFTER-BREAKPOINT-TRAP is defined for PPC, but never - * emitted as far as I can see. Should it be emitted, do removed - * entirely? */ void arch_handle_after_breakpoint(os_context_t *context) { @@ -412,9 +423,10 @@ arch_handle_single_step_trap(os_context_t *context, int trap) } static void -sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) +sigtrap_handler(int signal, siginfo_t *siginfo, void *void_context) { unsigned int code; + os_context_t *context = void_context; #ifdef LISP_FEATURE_LINUX os_restore_fp_control(context); @@ -444,9 +456,7 @@ sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) if ((code >> 16) == ((3 << 10) | (6 << 5))) { /* twllei reg_ZERO,N will always trap if reg_ZERO = 0 */ int trap = code & 0x1f; - - if (!maybe_handle_trap(context,trap)) - interrupt_handle_now(signal, siginfo, context); + handle_trap(context,trap); #ifdef LISP_FEATURE_DARWIN DARWIN_FIX_CONTEXT(context); @@ -461,7 +471,7 @@ sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) return; } - interrupt_handle_now(signal, code, context); + interrupt_handle_now(signal, (siginfo_t *)code, context); #ifdef LISP_FEATURE_DARWIN /* Work around G5 bug */ DARWIN_FIX_CONTEXT(context); @@ -471,51 +481,8 @@ sigtrap_handler(int signal, siginfo_t *siginfo, os_context_t *context) void arch_install_interrupt_handlers() { - undoably_install_low_level_interrupt_handler(SIGILL,sigtrap_handler); - undoably_install_low_level_interrupt_handler(SIGTRAP,sigtrap_handler); -} - - -extern lispobj call_into_lisp(lispobj fun, lispobj *args, int nargs); - -lispobj funcall0(lispobj function) -{ - lispobj *args = current_control_stack_pointer; - - return call_into_lisp(function, args, 0); -} - -lispobj funcall1(lispobj function, lispobj arg0) -{ - lispobj *args = current_control_stack_pointer; - - current_control_stack_pointer += 1; - args[0] = arg0; - - return call_into_lisp(function, args, 1); -} - -lispobj funcall2(lispobj function, lispobj arg0, lispobj arg1) -{ - lispobj *args = current_control_stack_pointer; - - current_control_stack_pointer += 2; - args[0] = arg0; - args[1] = arg1; - - return call_into_lisp(function, args, 2); -} - -lispobj funcall3(lispobj function, lispobj arg0, lispobj arg1, lispobj arg2) -{ - lispobj *args = current_control_stack_pointer; - - current_control_stack_pointer += 3; - args[0] = arg0; - args[1] = arg1; - args[2] = arg2; - - return call_into_lisp(function, args, 3); + undoably_install_low_level_interrupt_handler(SIGILL, sigtrap_handler); + undoably_install_low_level_interrupt_handler(SIGTRAP, sigtrap_handler); } void