1.0.5.49: interrupt & GC & PA handling
[sbcl.git] / src / runtime / mips-arch.c
index d53ea91..ac3b0ff 100644 (file)
@@ -264,7 +264,18 @@ arch_internal_error_arguments(os_context_t *context)
 boolean
 arch_pseudo_atomic_atomic(os_context_t *context)
 {
-    return os_context_register(context, reg_ALLOC) & 1;
+    /* 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(context, reg_ALLOC) & 1;
 }
 
 void
@@ -386,19 +397,30 @@ arch_handle_after_breakpoint(os_context_t *context)
     *os_context_sigmask_addr(context) = orig_sigmask;
 }
 
+void
+arch_handle_single_step_trap(os_context_t *context, int trap)
+{
+    unsigned int code = *((u32 *)(*os_context_pc_addr(context)));
+    int register_offset = code >> 11 & 0x1f;
+    handle_single_step_trap(context, trap, register_offset);
+    arch_skip_instruction(context);
+}
+
 static void
 sigtrap_handler(int signal, siginfo_t *info, void *void_context)
 {
     os_context_t *context = arch_os_get_context(&void_context);
     unsigned int code = (os_context_insn(context) >> 6) & 0xfffff;
-    /* FIXME: WTF is this magic number? Needs to become a #define
-     * and go into maybe_handle_trap. */
+    /* FIXME: This magic number is pseudo-atomic-trap from parms.lisp.
+     * Genesis should provide the proper #define, but it specialcases
+     * pseudo-atomic-trap to work around some oddity on SPARC.
+     * Eventually this should go into handle_trap. */
     if (code==0x10) {
         arch_clear_pseudo_atomic_interrupted(context);
         arch_skip_instruction(context);
         interrupt_handle_pending(context);
-    } else if (!maybe_handle_trap(context,code))
-        interrupt_handle_now(signal, info, void_context);
+    } else
+        handle_trap(context,code & 0x1f);
 }
 
 #define FIXNUM_VALUE(lispobj) (((int)lispobj) >> N_FIXNUM_TAG_BITS)
@@ -469,52 +491,6 @@ arch_install_interrupt_handlers(void)
     undoably_install_low_level_interrupt_handler(SIGFPE,sigfpe_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);
-}
-
 #ifdef LISP_FEATURE_LINKAGE_TABLE
 
 /* Linkage tables for MIPS