From b1fa25128ab8f2ca3b7213217ad05861417771fb Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Mon, 7 Jan 2008 22:44:39 +0000 Subject: [PATCH] Make it possible to override the Mach fault recovery scheme through an environment variable: SIGSEGV_MACH_FAULT. It can be set to "direct" to assume the fault address comes from code[1] argument, or "slow" to use the slow path through thread_get_status(EXCEPTION_STATE)->faultvaddr. --- BasiliskII/src/Unix/sigsegv.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/BasiliskII/src/Unix/sigsegv.cpp b/BasiliskII/src/Unix/sigsegv.cpp index 2534b42d..b7bfb013 100644 --- a/BasiliskII/src/Unix/sigsegv.cpp +++ b/BasiliskII/src/Unix/sigsegv.cpp @@ -2437,8 +2437,17 @@ sigsegv_address_t sigsegv_get_fault_address(sigsegv_info_t *SIP) mach_get_exception_state(SIP); sigsegv_address_t addr = (sigsegv_address_t)SIGSEGV_FAULT_ADDRESS; - if (use_fast_path < 0) - use_fast_path = addr == SIP->addr; + if (use_fast_path < 0) { + const char *machfault = getenv("SIGSEGV_MACH_FAULT"); + if (machfault) { + if (strcmp(machfault, "fast") == 0) + use_fast_path = 1; + else if (strcmp(machfault, "slow") == 0) + use_fast_path = 0; + } + if (use_fast_path < 0) + use_fast_path = addr == SIP->addr; + } SIP->addr = addr; } #endif