Fix x86 stack alignment in Mach exception handler code
parent
2454135fd3
commit
c014cf1aeb
|
@ -37,6 +37,8 @@ static void call_fault_handler(exception_type_t exception,
|
||||||
else
|
else
|
||||||
signal_callstack_top = NULL;
|
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. */
|
/* Now we point the program counter at the right handler function. */
|
||||||
if(exception == EXC_BAD_ACCESS)
|
if(exception == EXC_BAD_ACCESS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,3 +30,8 @@ Modified for Factor by Slava Pestov */
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) \
|
#define UAP_PROGRAM_COUNTER(ucontext) \
|
||||||
MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss))
|
MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
INLINE CELL fix_stack_pointer(CELL sp)
|
||||||
|
{
|
||||||
|
return sp;
|
||||||
|
}
|
||||||
|
|
|
@ -28,3 +28,8 @@ Modified for Factor by Slava Pestov */
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) \
|
#define UAP_PROGRAM_COUNTER(ucontext) \
|
||||||
MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss))
|
MACH_PROGRAM_COUNTER(&(((ucontext_t *)(ucontext))->uc_mcontext->ss))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
INLINE CELL fix_stack_pointer(CELL sp)
|
||||||
|
{
|
||||||
|
return ((sp + 4) & ~15) - 4;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue