0.7.9.7:
[sbcl.git] / src / runtime / interrupt.c
index c5e70aa..f5e5979 100644 (file)
@@ -502,7 +502,8 @@ interrupt_handle_now_handler(int signal, siginfo_t *info, void *void_context)
  * stuff to detect and handle hitting the GC trigger
  */
 
-#ifndef GENCGC /* since GENCGC has its own way to record trigger */
+#ifndef LISP_FEATURE_GENCGC 
+/* since GENCGC has its own way to record trigger */
 static boolean
 gc_trigger_hit(int signal, siginfo_t *info, os_context_t *context)
 {
@@ -522,30 +523,31 @@ boolean handle_control_stack_guard_triggered(os_context_t *context,void *addr)
 {
     /* note the os_context hackery here.  When the signal handler returns, 
      * it won't go back to what it was doing ... */
-    if(addr>=CONTROL_STACK_GUARD_PAGE && 
-       addr<(CONTROL_STACK_GUARD_PAGE+os_vm_page_size)) {
-       void *function;
+    if(addr>=(void *)CONTROL_STACK_GUARD_PAGE && 
+       addr<(void *)(CONTROL_STACK_GUARD_PAGE+os_vm_page_size)) {
+       void *fun;
+       void *code;
+       
        /* we hit the end of the control stack.  disable protection
         * temporarily so the error handler has some headroom */
        protect_control_stack_guard_page(0);
        
-       function=
-           &(((struct simple_fun *)
-              native_pointer(SymbolFunction(CONTROL_STACK_EXHAUSTED_ERROR)))
-             ->code);
+       fun = (void *)
+           native_pointer((lispobj) SymbolFunction(CONTROL_STACK_EXHAUSTED_ERROR));
+       code = &(((struct simple_fun *) fun)->code);
 
        /* Build a stack frame showing `interrupted' so that the
         * user's backtrace makes (as much) sense (as usual) */
        build_fake_control_stack_frames(context);
        /* signal handler will "return" to this error-causing function */
-       *os_context_pc_addr(context) = function;
+       *os_context_pc_addr(context) = code;
 #ifdef LISP_FEATURE_X86
-       /* this much of the calling convention is common to all
-          non-x86 ports */
        *os_context_register_addr(context,reg_ECX) = 0; 
 #else
+       /* this much of the calling convention is common to all
+          non-x86 ports */
        *os_context_register_addr(context,reg_NARGS) = 0; 
-       *os_context_register_addr(context,reg_LIP) = function;
+       *os_context_register_addr(context,reg_LIP) = code;
        *os_context_register_addr(context,reg_CFP) = 
            current_control_frame_pointer;
 #endif
@@ -562,16 +564,16 @@ boolean handle_control_stack_guard_triggered(os_context_t *context,void *addr)
           (INST MOVE CODE-TN FUNCTION) 
 
           in compiler/sparc/call.lisp is changed, then this bit can
-          probably go away. -- CSR, 2002-07-24 */
+          probably go away.  -- CSR, 2002-07-24 */
        *os_context_register_addr(context,reg_CODE) = 
-           function - SIMPLE_FUN_CODE_OFFSET;
+           fun + FUN_POINTER_LOWTAG;
 #endif
        return 1;
     }
     else return 0;
 }
 
-#ifndef __i386__
+#ifndef LISP_FEATURE_X86
 /* This function gets called from the SIGSEGV (for e.g. Linux or
  * OpenBSD) or SIGBUS (for e.g. FreeBSD) handler. Here we check
  * whether the signal was due to treading on the mprotect()ed zone -
@@ -582,11 +584,13 @@ interrupt_maybe_gc(int signal, siginfo_t *info, void *void_context)
     os_context_t *context=(os_context_t *) void_context;
 
     if (!foreign_function_call_active
-#ifndef GENCGC /* since GENCGC has its own way to record trigger */
+#ifndef LISP_FEATURE_GENCGC 
+       /* nb: GENCGC on non-x86?  I really don't think so.  This
+        * happens every time */
        && gc_trigger_hit(signal, info, context)
 #endif
        ) {
-#ifndef GENCGC /* since GENCGC has its own way to record trigger */
+#ifndef LISP_FEATURE_GENCGC 
        clear_auto_gc_trigger();
 #endif