handle floating-point exceptions on windows

db4
Joe Groff 2009-09-10 16:10:25 -05:00
parent bda5963c62
commit 6fa4a6a23b
1 changed files with 26 additions and 13 deletions

View File

@ -21,24 +21,37 @@ FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe)
else
signal_callstack_top = NULL;
if(e->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
{
switch (e->ExceptionCode) {
case EXCEPTION_ACCESS_VIOLATION:
signal_fault_addr = e->ExceptionInformation[1];
c->EIP = (cell)memory_signal_handler_impl;
}
break;
case EXCEPTION_FLT_DENORMAL_OPERAND:
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
case EXCEPTION_FLT_INEXACT_RESULT:
case EXCEPTION_FLT_INVALID_OPERATION:
case EXCEPTION_FLT_OVERFLOW:
case EXCEPTION_FLT_STACK_CHECK:
case EXCEPTION_FLT_UNDERFLOW:
c->EIP = (cell)fp_signal_handler_impl;
break;
/* If the Widcomm bluetooth stack is installed, the BTTray.exe process
injects code into running programs. For some reason this results in
random SEH exceptions with this (undocumented) exception code being
raised. The workaround seems to be ignoring this altogether, since that
is what happens if SEH is not enabled. Don't really have any idea what
this exception means. */
else if(e->ExceptionCode != 0x40010006)
{
injects code into running programs. For some reason this results in
random SEH exceptions with this (undocumented) exception code being
raised. The workaround seems to be ignoring this altogether, since that
is what happens if SEH is not enabled. Don't really have any idea what
this exception means. */
case 0x40010006:
break;
default:
signal_number = e->ExceptionCode;
c->EIP = (cell)misc_signal_handler_impl;
}
return EXCEPTION_CONTINUE_EXECUTION;
break;
}
return EXCEPTION_CONTINUE_EXECUTION;
}
void c_to_factor_toplevel(cell quot)