diff --git a/vm/mach_signal.c b/vm/mach_signal.c index 118fc7044c..bfffa4cee0 100644 --- a/vm/mach_signal.c +++ b/vm/mach_signal.c @@ -37,6 +37,8 @@ static void call_fault_handler(exception_type_t exception, else signal_callstack_top = NULL; + MACH_STACK_POINTER(thread_state) = fix_stack_pointer(MACH_STACK_POINTER(thread_state)); + /* Now we point the program counter at the right handler function. */ if(exception == EXC_BAD_ACCESS) { diff --git a/vm/os-macosx-ppc.h b/vm/os-macosx-ppc.h index b6c2cc6859..640aeb796d 100644 --- a/vm/os-macosx-ppc.h +++ b/vm/os-macosx-ppc.h @@ -30,3 +30,8 @@ Modified for Factor by Slava Pestov */ #define UAP_PROGRAM_COUNTER(ucontext) \ MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss)) #endif + +INLINE CELL fix_stack_pointer(CELL sp) +{ + return sp; +} diff --git a/vm/os-macosx-x86.32.h b/vm/os-macosx-x86.32.h index b77a0c7742..d5e5827a5c 100644 --- a/vm/os-macosx-x86.32.h +++ b/vm/os-macosx-x86.32.h @@ -28,3 +28,8 @@ Modified for Factor by Slava Pestov */ #define UAP_PROGRAM_COUNTER(ucontext) \ MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss)) #endif + +INLINE CELL fix_stack_pointer(CELL sp) +{ + return ((sp + 4) & ~15) - 4; +}