mirror of https://github.com/PCSX2/pcsx2.git
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:
parent
970ed11def
commit
310648fb88
|
@ -298,7 +298,7 @@ protected:
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
|
|
||||||
struct _EXCEPTION_POINTERS;
|
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_PROTECT __try
|
||||||
#define PCSX2_PAGEFAULT_EXCEPT \
|
#define PCSX2_PAGEFAULT_EXCEPT \
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <winnt.h>
|
#include <winnt.h>
|
||||||
|
|
||||||
static int DoSysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
|
static long DoSysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
|
||||||
{
|
{
|
||||||
if (eps->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION)
|
if (eps->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION)
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
@ -32,7 +32,7 @@ static int DoSysPageFaultExceptionFilter(EXCEPTION_POINTERS *eps)
|
||||||
return Source_PageFault->WasHandled() ? EXCEPTION_CONTINUE_EXECUTION : EXCEPTION_CONTINUE_SEARCH;
|
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.
|
// 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
|
// 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()
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -175,12 +175,13 @@ extern SysMainMemory& GetVmMemory();
|
||||||
// This should be available on Windows, via Microsoft or Intel compilers (I'm pretty sure Intel
|
// 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
|
// 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.
|
// 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.
|
//#define PCSX2_SEH 0 // use this to force disable SEH on win32, to test setjmp functionality.
|
||||||
|
|
||||||
#ifndef PCSX2_SEH
|
#ifndef PCSX2_SEH
|
||||||
# if defined(_WIN32) && !defined(__GNUC__)
|
# if defined(_WIN32) && !defined(__GNUC__) && !defined(_WIN64)
|
||||||
# define PCSX2_SEH 1
|
# define PCSX2_SEH 1
|
||||||
# else
|
# else
|
||||||
# define PCSX2_SEH 0
|
# define PCSX2_SEH 0
|
||||||
|
|
Loading…
Reference in New Issue