Common/PageFaultHandler: Fix compiling on 32-bit Windows

pull/1090/head
Connor McLaughlin 4 years ago
parent a03bca2f72
commit a29669432f

@ -1,4 +1,5 @@
#include "page_fault_handler.h" #include "page_fault_handler.h"
#include "common/cpu_detect.h"
#include "common/log.h" #include "common/log.h"
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
@ -67,7 +68,7 @@ static bool IsStoreInstruction(const void* ptr)
} }
#endif #endif
#if defined(WIN32) #if defined(WIN32) && defined(CPU_X64)
static PVOID s_veh_handle; static PVOID s_veh_handle;
static LONG ExceptionHandler(PEXCEPTION_POINTERS exi) static LONG ExceptionHandler(PEXCEPTION_POINTERS exi)
@ -189,7 +190,7 @@ bool InstallHandler(void* owner, Callback callback)
if (was_empty) if (was_empty)
{ {
#if defined(WIN32) #if defined(WIN32) && defined(CPU_X64)
s_veh_handle = AddVectoredExceptionHandler(1, ExceptionHandler); s_veh_handle = AddVectoredExceptionHandler(1, ExceptionHandler);
if (!s_veh_handle) if (!s_veh_handle)
{ {
@ -246,10 +247,10 @@ bool RemoveHandler(void* owner)
if (m_handlers.empty()) if (m_handlers.empty())
{ {
#if defined(WIN32) #if defined(WIN32) && defined(CPU_X64)
RemoveVectoredExceptionHandler(s_veh_handle); RemoveVectoredExceptionHandler(s_veh_handle);
s_veh_handle = nullptr; s_veh_handle = nullptr;
#else #elif defined(USE_SIGSEGV)
// restore old signal handler // restore old signal handler
#if defined(__APPLE__) || defined(__aarch64__) #if defined(__APPLE__) || defined(__aarch64__)
if (sigaction(SIGBUS, &s_old_sigbus_action, nullptr) < 0) if (sigaction(SIGBUS, &s_old_sigbus_action, nullptr) < 0)
@ -267,6 +268,8 @@ bool RemoveHandler(void* owner)
} }
s_old_sigsegv_action = {}; s_old_sigsegv_action = {};
#else
return false;
#endif #endif
} }

Loading…
Cancel
Save