]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/os-windows-nt.cpp
Get green threads working on Windows
[factor.git] / vm / os-windows-nt.cpp
index 2d5881252a10872e4ab6b123de9260c8cc0cdfb5..4f90d7f641d24ed5bfe34d85c6356aa8f8062d1f 100755 (executable)
@@ -48,11 +48,8 @@ void sleep_nanos(u64 nsec)
        Sleep((DWORD)(nsec/1000000));
 }
 
-LONG factor_vm::exception_handler(PEXCEPTION_POINTERS pe)
+LONG factor_vm::exception_handler(PEXCEPTION_RECORD e, void *frame, PCONTEXT c, void *dispatch)
 {
-       PEXCEPTION_RECORD e = (PEXCEPTION_RECORD)pe->ExceptionRecord;
-       CONTEXT *c = (CONTEXT*)pe->ContextRecord;
-
        c->ESP = (cell)fix_callstack_top((stack_frame *)c->ESP);
        signal_callstack_top = (stack_frame *)c->ESP;
 
@@ -81,35 +78,23 @@ LONG factor_vm::exception_handler(PEXCEPTION_POINTERS pe)
                MXCSR(c) &= 0xffffffc0;
                c->EIP = (cell)factor::fp_signal_handler_impl;
                break;
-       case 0x40010006:
-               /* 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. */
-               break;
        default:
                signal_number = e->ExceptionCode;
                c->EIP = (cell)factor::misc_signal_handler_impl;
                break;
        }
-       return EXCEPTION_CONTINUE_EXECUTION;
+
+       return ExceptionContinueExecution;
 }
 
-FACTOR_STDCALL(LONG) exception_handler(PEXCEPTION_POINTERS pe)
+LONG exception_handler(PEXCEPTION_RECORD e, void *frame, PCONTEXT c, void *dispatch)
 {
-       return current_vm()->exception_handler(pe);
+       return current_vm()->exception_handler(e,frame,c,dispatch);
 }
 
 void factor_vm::c_to_factor_toplevel(cell quot)
 {
-       if(!AddVectoredExceptionHandler(0, (PVECTORED_EXCEPTION_HANDLER)factor::exception_handler))
-               fatal_error("AddVectoredExceptionHandler failed", 0);
-
        c_to_factor(quot);
-
-       RemoveVectoredExceptionHandler((void *)factor::exception_handler);
 }
 
 void factor_vm::open_console()