0.pre8.92:
[sbcl.git] / src / runtime / bsd-os.c
index 54a1c00..3e3cfb6 100644 (file)
@@ -29,6 +29,7 @@
 #include "interr.h"
 #include "lispregs.h"
 #include "sbcl.h"
+#include "thread.h"
 
 #include <sys/types.h>
 #include <signal.h>
@@ -37,9 +38,6 @@
 #include "validate.h"
 vm_size_t os_vm_page_size;
 
-#if defined GENCGC
-#include "gencgc.h"
-#endif
 
 /* The different BSD variants have diverged in exactly where they
  * store signal context information, but at least they tend to use the
@@ -193,26 +191,25 @@ in_range_p(os_vm_address_t a, lispobj sbeg, size_t slen)
 boolean
 is_valid_lisp_addr(os_vm_address_t addr)
 {
-    return in_range_p(addr, READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE)
-       || in_range_p(addr, STATIC_SPACE_START   , STATIC_SPACE_SIZE   )
-       || in_range_p(addr, DYNAMIC_SPACE_START  , DYNAMIC_SPACE_SIZE  )
-       || in_range_p(addr, CONTROL_STACK_START  , CONTROL_STACK_SIZE  )
-       || in_range_p(addr, BINDING_STACK_START  , BINDING_STACK_SIZE  );
+    struct thread *th;
+    if(in_range_p(addr, READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE) ||
+       in_range_p(addr, STATIC_SPACE_START   , STATIC_SPACE_SIZE) ||
+       in_range_p(addr, DYNAMIC_SPACE_START  , DYNAMIC_SPACE_SIZE))
+       return 1;
+    for_each_thread(th) {
+       if((th->control_stack_start <= addr) && (addr < th->control_stack_end))
+           return 1;
+       if(in_range_p(addr, th->binding_stack_start, BINDING_STACK_SIZE))
+           return 1;
+    }
+    return 0;
 }
 \f
 /*
  * any OS-dependent special low-level handling for signals
  */
 
-#if !defined GENCGC
-
-void
-os_install_interrupt_handlers(void)
-{
-    SHOW("os_install_interrupt_handlers()/bsd-os/!defined(GENCGC)");
-}
-
-#else
+#if defined LISP_FEATURE_GENCGC
 
 /*
  * The GENCGC needs to be hooked into whatever signal is raised for
@@ -246,4 +243,29 @@ os_install_interrupt_handlers(void)
     SHOW("leaving os_install_interrupt_handlers()");
 }
 
-#endif /* !defined GENCGC */
+#else
+/* As of 2002.07.31, this configuration has never been tested */
+void
+os_install_interrupt_handlers(void)
+{
+    SHOW("os_install_interrupt_handlers()/bsd-os/!defined(GENCGC)");
+}
+
+#endif /* defined GENCGC */
+\f
+/* threads */
+
+/* no threading in any *BSD variant on any CPU (yet? in sbcl-0.8.0 anyway) */
+#ifdef LISP_FEATURE_SB_THREAD
+#error "Define threading support functions"
+#else
+struct thread *arch_os_get_current_thread() {
+    return all_threads;
+}
+int arch_os_thread_init(struct thread *thread) {
+    return 1;                  /* success */
+}
+int arch_os_thread_cleanup(struct thread *thread) {
+    return 1;                  /* success */
+}
+#endif