diff --git a/pcsx2/System.h b/pcsx2/System.h index 987c7c167a..d9692185cf 100644 --- a/pcsx2/System.h +++ b/pcsx2/System.h @@ -170,25 +170,6 @@ extern wxString SysGetDiscID(); extern SysMainMemory& GetVmMemory(); -// -------------------------------------------------------------------------------------- -// PCSX2_SEH - Defines existence of "built in" Structured Exception Handling support. -// -------------------------------------------------------------------------------------- -// 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__) && !defined(_WIN64) -# define PCSX2_SEH 1 -# else -# define PCSX2_SEH 0 -# endif -#endif - // special macro which disables inlining on functions that require their own function stackframe. // This is due to how Win32 handles structured exception handling. Linux uses signals instead // of SEH, and so these functions can be inlined. diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 5d4a92a624..871e1c30f4 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -40,11 +40,7 @@ #include "DebugTools/Breakpoints.h" #include "Patch.h" -#if !PCSX2_SEH - #include "common/FastJmp.h" -#endif - - +#include "common/FastJmp.h" #include "common/MemsetFast.inl" #include "common/Perf.h" @@ -700,36 +696,26 @@ void recStep() { } -#if !PCSX2_SEH - #define SETJMP_CODE(x) x - static fastjmp_buf m_SetJmp_StateCheck; - static std::unique_ptr m_cpuException; - static ScopedExcept m_Exception; -#else - #define SETJMP_CODE(x) -#endif - +static fastjmp_buf m_SetJmp_StateCheck; +static std::unique_ptr m_cpuException; +static ScopedExcept m_Exception; static void recExitExecution() { -#if PCSX2_SEH - throw Exception::ExitCpuExecute(); -#else // Without SEH we'll need to hop to a safehouse point outside the scope of recompiled // code. C++ exceptions can't cross the mighty chasm in the stackframe that the recompiler // creates. However, the longjump is slow so we only want to do one when absolutely // necessary: fastjmp_jmp(&m_SetJmp_StateCheck, 1); -#endif } static void recCheckExecutionState() { #ifndef PCSX2_CORE - if (SETJMP_CODE(m_cpuException || m_Exception ||) eeRecNeedsReset || GetCoreThread().HasPendingStateChangeRequest()) + if (m_cpuException || m_Exception || eeRecNeedsReset || GetCoreThread().HasPendingStateChangeRequest()) #else - if (SETJMP_CODE(m_cpuException || m_Exception ||) eeRecNeedsReset || VMManager::Internal::IsExecutionInterrupted()) + if (m_cpuException || m_Exception || eeRecNeedsReset || VMManager::Internal::IsExecutionInterrupted()) #endif { recExitExecution(); @@ -738,23 +724,6 @@ static void recCheckExecutionState() static void recExecute() { - // Implementation Notes: - // [TODO] fix this comment to explain various code entry/exit points, when I'm not so tired! - -#if PCSX2_SEH - eeRecIsReset = false; - ScopedBool executing(eeCpuExecuting); - - try - { - EnterRecompiledCode(); - } - catch (Exception::ExitCpuExecute&) - { - } - -#else - // Reset before we try to execute any code, if there's one pending. // We need to do this here, because if we reset while we're executing, it sets the "needs reset" // flag, which triggers a JIT exit (the fastjmp_set below), and eventually loops back here. @@ -797,7 +766,6 @@ static void recExecute() // FIXME Warning thread unsafe Perf::dump(); -#endif EE::Profiler.Print(); } @@ -2392,26 +2360,18 @@ StartRecomp: // SEH unwind (MSW) or setjmp/longjmp (GCC). static void recThrowException(const BaseR5900Exception& ex) { -#if PCSX2_SEH - ex.Rethrow(); -#else if (!eeCpuExecuting) ex.Rethrow(); m_cpuException = std::unique_ptr(ex.Clone()); recExitExecution(); -#endif } static void recThrowException(const BaseException& ex) { -#if PCSX2_SEH - ex.Rethrow(); -#else if (!eeCpuExecuting) ex.Rethrow(); m_Exception = ScopedExcept(ex.Clone()); recExitExecution(); -#endif } static void recSetCacheReserve(uint reserveInMegs)