vm: fix fp_trap_error() so that it can work properly in signal handlers

db4
Slava Pestov 2009-09-12 18:15:16 -05:00
parent 1337f82ce6
commit 9ccf5811b3
2 changed files with 8 additions and 8 deletions

View File

@ -130,9 +130,9 @@ void divide_by_zero_error()
general_error(ERROR_DIVIDE_BY_ZERO,F,F,NULL); general_error(ERROR_DIVIDE_BY_ZERO,F,F,NULL);
} }
void fp_trap_error() void fp_trap_error(stack_frame *signal_callstack_top)
{ {
general_error(ERROR_FP_TRAP,F,F,NULL); general_error(ERROR_FP_TRAP,F,F,signal_callstack_top);
} }
PRIMITIVE(call_clear) PRIMITIVE(call_clear)
@ -158,7 +158,7 @@ void misc_signal_handler_impl()
void fp_signal_handler_impl() void fp_signal_handler_impl()
{ {
fp_trap_error(); fp_trap_error(signal_callstack_top);
} }
} }

View File

@ -55,12 +55,12 @@ static void call_fault_handler(
MACH_PROGRAM_COUNTER(thread_state) = (cell)memory_signal_handler_impl; MACH_PROGRAM_COUNTER(thread_state) = (cell)memory_signal_handler_impl;
} }
else if(exception == EXC_ARITHMETIC && code != MACH_EXC_INTEGER_DIV) else if(exception == EXC_ARITHMETIC && code != MACH_EXC_INTEGER_DIV)
{ {
MACH_PROGRAM_COUNTER(thread_state) = (cell)fp_signal_handler_impl; MACH_PROGRAM_COUNTER(thread_state) = (cell)fp_signal_handler_impl;
} }
else else
{ {
signal_number = exception == EXC_ARITHMETIC ? SIGFPE : SIGABRT; signal_number = (exception == EXC_ARITHMETIC ? SIGFPE : SIGABRT);
MACH_PROGRAM_COUNTER(thread_state) = (cell)misc_signal_handler_impl; MACH_PROGRAM_COUNTER(thread_state) = (cell)misc_signal_handler_impl;
} }
} }