mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-12-02 02:25:40 +00:00
PageFaultHandler: Fix for Intel on MacOS
This commit is contained in:
parent
5cf41a41f3
commit
603531f916
|
@ -121,12 +121,10 @@ static LONG ExceptionHandler(PEXCEPTION_POINTERS exi)
|
||||||
|
|
||||||
#elif defined(USE_SIGSEGV)
|
#elif defined(USE_SIGSEGV)
|
||||||
|
|
||||||
|
static struct sigaction s_old_sigsegv_action;
|
||||||
#if defined(__APPLE__) || defined(__aarch64__)
|
#if defined(__APPLE__) || defined(__aarch64__)
|
||||||
static struct sigaction s_old_sigbus_action;
|
static struct sigaction s_old_sigbus_action;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__APPLE__) || defined(__aarch64__)
|
|
||||||
static struct sigaction s_old_sigsegv_action;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void CallExistingSignalHandler(int signal, siginfo_t* siginfo, void* ctx)
|
static void CallExistingSignalHandler(int signal, siginfo_t* siginfo, void* ctx)
|
||||||
{
|
{
|
||||||
|
@ -262,16 +260,14 @@ bool InstallHandler(Handler handler)
|
||||||
// Don't block the signal from executing recursively, we want to fire the original handler.
|
// Don't block the signal from executing recursively, we want to fire the original handler.
|
||||||
sa.sa_flags |= SA_NODEFER;
|
sa.sa_flags |= SA_NODEFER;
|
||||||
#endif
|
#endif
|
||||||
|
if (sigaction(SIGSEGV, &sa, &s_old_sigsegv_action) != 0)
|
||||||
|
return false;
|
||||||
#if defined(__APPLE__) || defined(__aarch64__)
|
#if defined(__APPLE__) || defined(__aarch64__)
|
||||||
// MacOS uses SIGBUS for memory permission violations
|
// MacOS uses SIGBUS for memory permission violations
|
||||||
if (sigaction(SIGBUS, &sa, &s_old_sigbus_action) != 0)
|
if (sigaction(SIGBUS, &sa, &s_old_sigbus_action) != 0)
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__APPLE__) || defined(__aarch64__)
|
#ifdef __APPLE__
|
||||||
if (sigaction(SIGSEGV, &sa, &s_old_sigsegv_action) != 0)
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
#if defined(__APPLE__) && defined(__aarch64__)
|
|
||||||
task_set_exception_ports(mach_task_self(), EXC_MASK_BAD_ACCESS, MACH_PORT_NULL, EXCEPTION_DEFAULT, 0);
|
task_set_exception_ports(mach_task_self(), EXC_MASK_BAD_ACCESS, MACH_PORT_NULL, EXCEPTION_DEFAULT, 0);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue