0.9.0.37:
[sbcl.git] / src / runtime / sunos-os.c
index a6ab92f..fdf5a08 100644 (file)
@@ -8,13 +8,13 @@
 #include <sys/param.h>
 #include <sys/utsname.h>
 
+#include "sbcl.h"
 #include "os.h"
 #include "arch.h"
 #include "interr.h"
 #include "interrupt.h"
 #include "globals.h"
 #include "validate.h"
-#include "sbcl.h"
 #include "target-arch-os.h"
 
 #define OS_VM_DEFAULT_PAGESIZE 8192
@@ -50,9 +50,11 @@ void os_init(void)
        lose("sunos major version=%d (which isn't 5!)", major_version);
     }
     minor_version = atoi(name.release+2);
-    if ((minor_version == 8) || (minor_version == 9)) {
+    if ((minor_version == 8) || 
+       (minor_version == 9) || 
+       (minor_version == 10)) {
        KLUDGE_MAYBE_MAP_ANON = 0x100;
-    } else if (minor_version > 9) {
+    } else if (minor_version > 10) {
        FSHOW((stderr, "os_init: Solaris version greater than 9?\nUnknown MAP_ANON behaviour.\n"));
        lose("Unknown mmap() interaction with MAP_ANON");
     } else { /* minor_version < 8 */
@@ -150,14 +152,26 @@ boolean is_valid_lisp_addr(os_vm_address_t addr)
        
        Just assume address is valid if it lies within one of the known
        spaces.  (Unlike sunos-os which keeps track of every valid page.) */
-    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_0_SPACE_START, DYNAMIC_SPACE_SIZE  )
-              || in_range_p(addr, DYNAMIC_1_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  ));
+    
+    /* FIXME: this looks like a valid definition for all targets with
+       cheney-gc; it may not be impressively smart (witness the
+       comment above) but maybe associating these functions with the
+       GC rather than the OS would be a maintainability win.  -- CSR,
+       2003-04-04 */
+    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_0_SPACE_START, DYNAMIC_SPACE_SIZE) ||
+       in_range_p(addr, DYNAMIC_1_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
 
 
@@ -169,7 +183,7 @@ sigsegv_handler(int signal, siginfo_t *info, void* void_context)
 
     addr = arch_get_bad_addr(signal, info, context);
     if(!interrupt_maybe_gc(signal, info, context)) {
-       if(!handle_control_stack_guard_triggered(context,addr))
+       if(!handle_guard_page_triggered(context,addr))
            interrupt_handle_now(signal, info, context);
     }
 }