X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fsunos-os.c;h=e2f68e17b46cfb54f1d671b039a09edc53b1d0bd;hb=64eccd1724e5f1e638bfc574f7f376427ee3dcb1;hp=723534f2ead36c3cf52c06551c017ad45271c7ea;hpb=b27fb452f72190637b03a6ef2e1333091da42a98;p=sbcl.git diff --git a/src/runtime/sunos-os.c b/src/runtime/sunos-os.c index 723534f..e2f68e1 100644 --- a/src/runtime/sunos-os.c +++ b/src/runtime/sunos-os.c @@ -66,19 +66,18 @@ os_init(char *argv[], char *envp[]) lose("sunos major version=%d (which isn't 5!)\n", major_version); } minor_version = atoi(name.release+2); - if ((minor_version == 8) || - (minor_version == 9) || - (minor_version == 10)) { - KLUDGE_MAYBE_MAP_ANON = 0x100; - } 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\n"); - } else { /* minor_version < 8 */ + if ((minor_version < 8)) { kludge_mmap_fd = open("/dev/zero",O_RDONLY); if (kludge_mmap_fd < 0) { perror("open"); lose("Error in open(..)\n"); } + } else if (minor_version > 11) { + FSHOW((stderr, "os_init: Solaris version greater than 11?\nUnknown MAP_ANON behaviour.\n")); + lose("Unknown mmap() interaction with MAP_ANON\n"); + } else { + /* Versions 8-11*/ + KLUDGE_MAYBE_MAP_ANON = 0x100; } /* I do not understand this at all. FIXME. */ @@ -178,10 +177,10 @@ boolean is_valid_lisp_addr(os_vm_address_t addr) if(in_range_p(addr, READ_ONLY_SPACE_START, READ_ONLY_SPACE_SIZE) || in_range_p(addr, STATIC_SPACE_START , STATIC_SPACE_SIZE) || #ifdef LISP_FEATURE_GENCGC - in_range_p(addr, DYNAMIC_SPACE_START, DYNAMIC_SPACE_SIZE) + in_range_p(addr, DYNAMIC_SPACE_START , dynamic_space_size) #else - 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_0_SPACE_START, dynamic_space_size) || + in_range_p(addr, DYNAMIC_1_SPACE_START, dynamic_space_size) #endif ) return 1; @@ -202,20 +201,10 @@ sigsegv_handler(int signal, siginfo_t *info, void* void_context) { os_context_t *context = arch_os_get_context(&void_context); void* fault_addr = (void*)info->si_addr; - if(info->si_code == 1) - { - perror("error: SEGV_MAPERR\n"); - exit(1); - } if (!gencgc_handle_wp_violation(fault_addr)) - if(!handle_guard_page_triggered(context, fault_addr)) -#ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK - arrange_return_to_lisp_function(context, - SymbolFunction(MEMORY_FAULT_ERROR)); -#else - interrupt_handle_now(signal, info, context); -#endif + if(!handle_guard_page_triggered(context, fault_addr)) + lisp_memory_fault_error(context, fault_addr); } #else @@ -224,12 +213,11 @@ static void sigsegv_handler(int signal, siginfo_t *info, void* void_context) { os_context_t *context = arch_os_get_context(&void_context); - os_vm_address_t addr; + os_vm_address_t addr = arch_get_bad_addr(signal, info, context); - addr = arch_get_bad_addr(signal, info, context); - if(!interrupt_maybe_gc(signal, info, context)) { - if(!handle_guard_page_triggered(context,addr)) - interrupt_handle_now(signal, info, context); + if (!cheneygc_handle_wp_violation(context, addr)) { + if (!handle_guard_page_triggered(context,addr)) + lisp_memory_fault_error(context, fault_addr); } } @@ -240,4 +228,23 @@ os_install_interrupt_handlers() { undoably_install_low_level_interrupt_handler(SIG_MEMORY_FAULT, sigsegv_handler); + +#ifdef LISP_FEATURE_SB_THREAD + undoably_install_low_level_interrupt_handler(SIG_STOP_FOR_GC, + sig_stop_for_gc_handler); +#endif +} + +char * +os_get_runtime_executable_path() +{ + int ret; + char path[] = "/proc/self/object/a.out"; + + ret = access(path, R_OK); + if (ret == -1) + return NULL; + + return copied_string(path); } +