X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fruntime%2Fbsd-os.c;h=707ea9aec8451c8a95cd9afa6ede38f696f0885a;hb=50f728671defadb8f7b1e8691c984cb0e6aba17c;hp=15601738f514837c35fa613ccce0e60bac5273e4;hpb=a530bbe337109d898d5b4a001fc8f1afa3b5dc39;p=sbcl.git diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index 1560173..707ea9a 100644 --- a/src/runtime/bsd-os.c +++ b/src/runtime/bsd-os.c @@ -1,5 +1,5 @@ /* - * OS-dependent routines for FreeBSD (and could maybe be extended to all BSD?) + * OS-dependent routines for BSD-ish systems * * This file (along with os.h) exports an OS-independent interface to * the operating system VM facilities. This interface looks a lot like @@ -18,10 +18,6 @@ * files for more information. */ -/* - * $Header$ - */ - #include #include #include @@ -30,6 +26,7 @@ #include "arch.h" #include "globals.h" #include "interrupt.h" +#include "interr.h" #include "lispregs.h" #include "sbcl.h" @@ -40,9 +37,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 @@ -167,6 +161,10 @@ os_map(int fd, int offset, os_vm_address_t addr, os_vm_size_t len) return addr; } +/* FIXME: If this can be a no-op on BSD/x86, then it + * deserves a more precise name. + * + * (Perhaps os_prepare_data_area_to_be_executed()?) */ void os_flush_icache(os_vm_address_t address, os_vm_size_t length) { @@ -194,8 +192,7 @@ 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_0_SPACE_START, DYNAMIC_SPACE_SIZE ) - || in_range_p(addr, DYNAMIC_1_SPACE_START, DYNAMIC_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 ); } @@ -204,13 +201,7 @@ is_valid_lisp_addr(os_vm_address_t addr) * any OS-dependent special low-level handling for signals */ -#if !defined GENCGC - -void -os_install_interrupt_handlers(void) -{} - -#else +#if defined LISP_FEATURE_GENCGC /* * The GENCGC needs to be hooked into whatever signal is raised for @@ -228,20 +219,28 @@ memory_fault_handler(int signal, siginfo_t *siginfo, void *void_context) #else #error unsupported BSD variant #endif - if (!gencgc_handle_wp_violation(fault_addr)) { - interrupt_handle_now(signal, siginfo, void_context); - } + os_context_t *context = arch_os_get_context(&void_context); + if (!gencgc_handle_wp_violation(fault_addr)) + if(!handle_control_stack_guard_triggered(context,fault_addr)) + /* FIXME is this context or void_context? not that it */ + /* makes a difference currently except on linux/sparc */ + interrupt_handle_now(signal, siginfo, void_context); } void os_install_interrupt_handlers(void) { -#if defined __FreeBSD__ - interrupt_install_low_level_handler(SIGBUS, memory_fault_handler); -#elif defined __OpenBSD__ - interrupt_install_low_level_handler(SIGSEGV, memory_fault_handler); + SHOW("os_install_interrupt_handlers()/bsd-os/defined(GENCGC)"); + undoably_install_low_level_interrupt_handler(SIG_MEMORY_FAULT, + memory_fault_handler); + SHOW("leaving os_install_interrupt_handlers()"); +} + #else -#error unsupported BSD variant -#endif +/* 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 */ +#endif /* defined GENCGC */