recompiler: Fix exception handling on WIN64

Use VEH instead of SEH on WIN64, as SEH needs us to register all our JIT functions for it
This commit is contained in:
tellowkrinkle 2020-07-01 21:14:37 -05:00
parent 970ed11def
commit 310648fb88
3 changed files with 8 additions and 5 deletions

View File

@ -298,7 +298,7 @@ protected:
#elif defined(_WIN32)
struct _EXCEPTION_POINTERS;
extern int SysPageFaultExceptionFilter(struct _EXCEPTION_POINTERS *eps);
extern long __stdcall SysPageFaultExceptionFilter(struct _EXCEPTION_POINTERS *eps);
#define PCSX2_PAGEFAULT_PROTECT __try
#define PCSX2_PAGEFAULT_EXCEPT \

View File

@ -19,7 +19,7 @@
#include <winnt.h>
static int DoSysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
static long DoSysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
{
if (eps->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION)
return EXCEPTION_CONTINUE_SEARCH;
@ -32,7 +32,7 @@ static int DoSysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
return Source_PageFault->WasHandled() ? EXCEPTION_CONTINUE_EXECUTION : EXCEPTION_CONTINUE_SEARCH;
}
int SysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
long __stdcall SysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
{
// Prevent recursive exception filtering by catching the exception from the filter here.
// In the event that the filter causes an access violation (happened during shutdown
@ -49,7 +49,9 @@ int SysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
void _platform_InstallSignalHandler()
{
// NOP on Win32 systems -- we use __try{} __except{} instead.
#ifdef _WIN64 // We don't handle SEH properly on Win64 so use a vectored exception handler instead
AddVectoredExceptionHandler(true, SysPageFaultExceptionFilter);
#endif
}

View File

@ -175,12 +175,13 @@ extern SysMainMemory& GetVmMemory();
// This should be available on Windows, via Microsoft or Intel compilers (I'm pretty sure Intel
// supports native SEH model). GNUC in Windows, or any compiler in a non-windows platform, will
// need to use setjmp/longjmp instead to exit recompiled code.
// In addition, we don't currently set up SEH properly on Windows x64 so disable it there too
//
//#define PCSX2_SEH 0 // use this to force disable SEH on win32, to test setjmp functionality.
#ifndef PCSX2_SEH
# if defined(_WIN32) && !defined(__GNUC__)
# if defined(_WIN32) && !defined(__GNUC__) && !defined(_WIN64)
# define PCSX2_SEH 1
# else
# define PCSX2_SEH 0