mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-14 06:50:29 +02:00
Add PPSSPP_PLATFORM(TVOS), skip sigaltstack on tvOS
tvOS doesn't have sigaltstack, which broke the libretro tvOS build. The exception handler now runs on the faulting thread's stack there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dd6bd1a53d
commit
7c9765d02c
2 files changed
+17
-2
No files matched your search
@@ -263,14 +263,18 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler, bool logStackTra
|
||||
g_badAccessHandler = badAccessHandler;
|
||||
return;
|
||||
}
|
||||
|
||||
g_badAccessHandler = badAccessHandler;
|
||||
|
||||
#if PPSSPP_PLATFORM(TVOS)
|
||||
// tvOS has no sigaltstack, so the handler runs on the faulting thread's stack.
|
||||
INFO_LOG(Log::System, "Installed exception handler (no alt stack).");
|
||||
#else
|
||||
size_t altStackSize = SIGSTKSZ;
|
||||
|
||||
// Add some extra room.
|
||||
altStackSize += 65536;
|
||||
|
||||
INFO_LOG(Log::System, "Installed exception handler. stack size: %d", (int)altStackSize);
|
||||
g_badAccessHandler = badAccessHandler;
|
||||
|
||||
stack_t signal_stack{};
|
||||
if (sigaltstack(nullptr, &old_signal_stack) == 0) {
|
||||
@@ -287,6 +291,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler, bool logStackTra
|
||||
if (sigaltstack(&signal_stack, nullptr)) {
|
||||
_assert_msg_(false, "sigaltstack failed");
|
||||
}
|
||||
#endif
|
||||
struct sigaction sa{};
|
||||
sa.sa_handler = nullptr;
|
||||
sa.sa_sigaction = &sigsegv_handler;
|
||||
@@ -302,6 +307,7 @@ void UninstallExceptionHandler() {
|
||||
if (!g_badAccessHandler) {
|
||||
return;
|
||||
}
|
||||
#if !PPSSPP_PLATFORM(TVOS)
|
||||
if (old_signal_stack_valid) {
|
||||
// Darwin fails with ENOMEM on a size below MINSIGSTKSZ, even with SS_DISABLE.
|
||||
if ((old_signal_stack.ss_flags & SS_DISABLE) && old_signal_stack.ss_size < MINSIGSTKSZ) {
|
||||
@@ -312,6 +318,7 @@ void UninstallExceptionHandler() {
|
||||
}
|
||||
old_signal_stack_valid = false;
|
||||
}
|
||||
#endif
|
||||
if (altStack) {
|
||||
free(altStack);
|
||||
altStack = nullptr;
|
||||
|
||||
@@ -97,6 +97,14 @@
|
||||
#endif
|
||||
#elif defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
// tvOS is iOS with some APIs removed, so it also gets PPSSPP_PLATFORM_IOS.
|
||||
// Check PPSSPP_PLATFORM(TVOS) for the differences.
|
||||
#if TARGET_OS_TV
|
||||
#define PPSSPP_PLATFORM_TVOS 1
|
||||
#if TARGET_OS_SIMULATOR
|
||||
#define PPSSPP_PLATFORM_TVOS_SIMULATOR 1
|
||||
#endif
|
||||
#endif
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
#define PPSSPP_PLATFORM_IOS 1
|
||||
#define PPSSPP_PLATFORM_IOS_SIMULATOR 1
|
||||
|
||||
Reference in new issue
Block a user