Browse Source
Keep all nt headers in one place
remotes/1785372757367212240/tmp_refs/heads/variable-page-size
Exverge
4 weeks ago
No known key found for this signature in database
GPG Key ID: DAD399BCC5FB77E4
6 changed files with
23 additions and
16 deletions
-
src/core/arm/nce/arm_nce.cpp
-
src/core/arm/nce/arm_nce.h
-
src/core/arm/nce/guest_context.h
-
src/core/arm/nce/win/exceptions.cpp
-
src/core/arm/nce/win/exceptions.h
-
src/core/arm/nce/win/nt_headers.h
|
|
|
@ -154,7 +154,6 @@ HaltReason ArmNce::ReturnToRunCodeByExceptionLevelChange(int tid, void *tpidr) { |
|
|
|
void ArmNce::ReturnToRunCodeByExceptionLevelChangeSignalHandler(int sig, void *info, void *raw_context) { |
|
|
|
auto tpidr = static_cast<NativeExecutionParameters*>(RestoreGuestContext(raw_context)); |
|
|
|
|
|
|
|
RestoreGuestContext(raw_context); |
|
|
|
#if !defined(__APPLE__) && !defined(__WIN32)
|
|
|
|
// Save old value of TPIDR_EL0, load guest one
|
|
|
|
u64 tpidr_el0; |
|
|
|
@ -452,9 +451,9 @@ HaltReason ArmNce::RunThread(Kernel::KThread* thread) { |
|
|
|
auto* thread_params = &thread->GetNativeExecutionParameters(); |
|
|
|
auto* process = thread->GetOwnerProcess(); |
|
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
#if defined(__APPLE__)
|
|
|
|
ASSERT(pthread_setspecific(ContextKey, &thread_params) == 0); |
|
|
|
#elif
|
|
|
|
#elif defined(__WIN32)
|
|
|
|
ASSERT(TlsSetValue(ContextKey, &thread_params) == 0); |
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
@ -30,14 +30,6 @@ class System; |
|
|
|
constexpr pthread_key_t ContextKey = 210; |
|
|
|
#elif __WIN32 |
|
|
|
|
|
|
|
namespace os { |
|
|
|
extern "C" { |
|
|
|
#include <winternl.h> |
|
|
|
#include <processthreadsapi.h> |
|
|
|
#include <errhandlingapi.h> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static const u32 ContextKey = os::TlsAlloc(); |
|
|
|
static const u32 NCEStorage = os::TlsAlloc(); |
|
|
|
static const u64 TlsSlots = offsetof(os::TEB, TlsSlots); |
|
|
|
|
|
|
|
@ -14,6 +14,8 @@ |
|
|
|
|
|
|
|
#ifdef __linux__ |
|
|
|
#include <signal.h> |
|
|
|
#elif __WIN32 |
|
|
|
#include "core/arm/nce/win/nt_headers.h" |
|
|
|
#endif |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
@ -115,7 +117,7 @@ public: |
|
|
|
return &ptr->__ss.__cpsr; |
|
|
|
} |
|
|
|
#elif defined(__WIN32) |
|
|
|
KernelContext(void* ptr) : ptr(static_cast<ARM64_NT_CONTEXT*>(ptr)) {} |
|
|
|
KernelContext(void* ptr) : ptr(static_cast<os::CONTEXT*>(ptr)) {} |
|
|
|
|
|
|
|
u64* pc() { |
|
|
|
return ptr->Pc; |
|
|
|
@ -162,7 +164,7 @@ private: |
|
|
|
return reinterpret_cast<fpsimd_context*>(header); |
|
|
|
} |
|
|
|
#elif defined(__WIN32) |
|
|
|
CONTEXT* ptr; |
|
|
|
os::CONTEXT* ptr; |
|
|
|
#endif |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -7,7 +7,7 @@ |
|
|
|
|
|
|
|
namespace Core { |
|
|
|
|
|
|
|
static s32 WINAPI VectoredExecptionHandler(EXCEPTION_POINTERS* info) { |
|
|
|
static s32 WINAPI VectoredExecptionHandler(os::EXCEPTION_POINTERS* info) { |
|
|
|
u32 code = info->ExceptionRecord->ExceptionCode; |
|
|
|
|
|
|
|
if (code == SIGSEGV || code == SIGBUS) { |
|
|
|
|
|
|
|
@ -3,7 +3,7 @@ |
|
|
|
|
|
|
|
#pragma once |
|
|
|
|
|
|
|
#include <windows.h> |
|
|
|
#include "core/arm/nce/arm_nce.h" |
|
|
|
|
|
|
|
#define SIGBUS EXCEPTION_DATATYPE_MISALIGNMENT |
|
|
|
#define SIGSEGV EXCEPTION_ACCESS_VIOLATION |
|
|
|
@ -13,6 +13,6 @@ namespace Core { |
|
|
|
|
|
|
|
thread_local bool is_host_fault = false; |
|
|
|
|
|
|
|
static s32 WINAPI VectoredExecptionHandler(EXCEPTION_POINTERS* info); |
|
|
|
static s32 WINAPI VectoredExecptionHandler(os::EXCEPTION_POINTERS* info); |
|
|
|
|
|
|
|
} // namespace Core |
|
|
|
@ -0,0 +1,14 @@ |
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project |
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later |
|
|
|
|
|
|
|
#pragma once |
|
|
|
|
|
|
|
// Use a separate namespace to not add Windows headers to the global path in header files |
|
|
|
// We can't directly add Windows.h because of winternl.h |
|
|
|
namespace os { |
|
|
|
extern "C" { |
|
|
|
#include <winternl.h> |
|
|
|
#include <processthreadsapi.h> |
|
|
|
#include <errhandlingapi.h> |
|
|
|
} |
|
|
|
} // namespace os |