Fix x86 stack alignment in Mach exception handler code

release
Slava Pestov 2007-10-29 02:23:16 -04:00
parent 2454135fd3
commit c014cf1aeb
3 changed files with 12 additions and 0 deletions

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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;
}