Port safepoints to FreeBSD/x86
authorDavid Lichteblau <david@lichteblau.com>
Fri, 14 Sep 2012 17:35:11 +0000 (19:35 +0200)
committerDavid Lichteblau <david@lichteblau.com>
Fri, 14 Sep 2012 17:36:23 +0000 (19:36 +0200)
src/runtime/bsd-os.c
src/runtime/x86-assem.S
src/runtime/x86-bsd-os.c

index eeaf755..c2829b3 100644 (file)
@@ -213,6 +213,10 @@ memory_fault_handler(int signal, siginfo_t *siginfo, os_context_t *context)
 
     FSHOW((stderr, "Memory fault at: %p, PC: %p\n", fault_addr, *os_context_pc_addr(context)));
 
+#ifdef LISP_FEATURE_SB_SAFEPOINT
+    if (!handle_safepoint_violation(context, fault_addr))
+#endif
+
     if (!gencgc_handle_wp_violation(fault_addr))
         if(!handle_guard_page_triggered(context,fault_addr))
             lisp_memory_fault_error(context, fault_addr);
@@ -241,9 +245,15 @@ os_install_interrupt_handlers(void)
                                                  memory_fault_handler);
 #endif
 
-#ifdef THREADS_USING_GCSIGNAL
+#ifdef LISP_FEATURE_SB_THREAD
+# ifdef LISP_FEATURE_SB_SAFEPOINT
+#  ifdef LISP_FEATURE_SB_THRUPTION
+    undoably_install_low_level_interrupt_handler(SIGPIPE, thruption_handler);
+#  endif
+# else
     undoably_install_low_level_interrupt_handler(SIG_STOP_FOR_GC,
                                                  sig_stop_for_gc_handler);
+# endif
 #endif
     SHOW("leaving os_install_interrupt_handlers()");
 }
index 769f10d..6723b67 100644 (file)
 # define LoadCurrentThreadSlot(offset,reg);     \
        movl    SBCL_THREAD_BASE_EA, reg ;      \
        movl    offset(reg), reg ;
-#elif defined(LISP_FEATURE_LINUX) || defined(LISP_FEATURE_SUNOS)
+#elif defined(LISP_FEATURE_LINUX) || defined(LISP_FEATURE_SUNOS) || defined(LISP_FEATURE_FREEBSD)
   /* see comment in arch_os_thread_init */
 # define SBCL_THREAD_BASE_EA %fs:THREAD_SELFPTR_OFFSET
 # define MAYBE_FS(addr) addr
index 5a4daa2..8b62584 100644 (file)
@@ -186,6 +186,10 @@ int arch_os_thread_init(struct thread *thread) {
 #endif
 #endif
 
+#ifdef LISP_FEATURE_SB_SAFEPOINT
+    thread->selfptr = thread;
+#endif
+
 #ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
     stack_t sigstack;