]> gitweb.factorcode.org Git - factor.git/blob - vm/os-windows-nt.hpp
1559d1147db1d3f7c97afdbbaf6dcddb1bbdf708
[factor.git] / vm / os-windows-nt.hpp
1 #undef _WIN32_WINNT
2 #define _WIN32_WINNT 0x0501  // For AddVectoredExceptionHandler
3
4 #ifndef UNICODE
5 #define UNICODE
6 #endif
7
8 #include <windows.h>
9 #include <shellapi.h>
10
11 #ifdef _MSC_VER
12         #undef min
13         #undef max
14 #endif
15
16 namespace factor
17 {
18
19 typedef char symbol_char;
20
21 #define FACTOR_OS_STRING "winnt"
22
23 #ifdef _MSC_VER
24         #define FACTOR_DLL NULL
25         #define FACTOR_STDCALL(return_type) return_type __stdcall
26 #else
27         #define FACTOR_DLL L"factor.dll"
28         #define FACTOR_STDCALL(return_type) __attribute__((stdcall)) return_type
29 #endif
30
31 FACTOR_STDCALL(LONG) exception_handler(PEXCEPTION_POINTERS pe);
32
33 // SSE traps raise these exception codes, which are defined in internal NT headers
34 // but not winbase.h
35 #ifndef STATUS_FLOAT_MULTIPLE_FAULTS
36 #define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4
37 #endif
38
39 #ifndef STATUS_FLOAT_MULTIPLE_TRAPS
40 #define STATUS_FLOAT_MULTIPLE_TRAPS  0xC00002B5
41 #endif
42
43 typedef HANDLE THREADHANDLE;
44
45 THREADHANDLE start_thread(void *(*start_routine)(void *),void *args);
46 inline static THREADHANDLE thread_id() { return GetCurrentThread(); }
47
48 void init_platform_globals();
49 void register_vm_with_thread(factor_vm *vm);
50 factor_vm *tls_vm();
51
52 }