kernel: use per-thread signal stacks for guest stack faults

This commit is contained in:
nmzik
2026-09-06 09:28:19 +04:00
parent 6ae5cb7b64
commit 211242452b
4 changed files with 128 additions and 2 deletions
+14
View File
@@ -4,6 +4,7 @@
#include "common/common.h"
#include "common/dateTime.h"
#include "common/emulatorConfig.h"
#include "common/hostException.h"
#include "common/logging/log.h"
#include "common/singleton.h"
#include "common/stringUtils.h"
@@ -1061,6 +1062,12 @@ void PthreadDeleteStaticObjects(Loader::Program* program) {
void PthreadInitSelfForMainThread() {
EXIT_IF(g_pthread_self != nullptr);
#if KYTY_PLATFORM == KYTY_PLATFORM_LINUX
if (!Common::HostException::InitializeThreadSignalStack()) {
EXIT("Failed to initialize the thread signal stack\n");
}
#endif
g_pthread_self = new PthreadPrivate {};
PthreadAttrInit(&g_pthread_self->attr);
UpdateCurrentThreadStackAttr(&g_pthread_self->attr);
@@ -3382,6 +3389,13 @@ static void CleanupThread(void* arg) {
}
static void* RunThread(void* arg) {
#if KYTY_PLATFORM == KYTY_PLATFORM_LINUX
if (!Common::HostException::InitializeThreadSignalStack()) {
EXIT("Failed to initialize the thread signal stack\n");
}
#endif
auto* thread = static_cast<Pthread>(arg);
void* ret = nullptr;