Browse Source

[nce] don't use static const for global variables

remotes/1785372757367212240/tmp_refs/heads/variable-page-size
Exverge 4 weeks ago
parent
commit
84e9fe0828
No known key found for this signature in database GPG Key ID: DAD399BCC5FB77E4
  1. 8
      src/core/arm/nce/arm_nce.cpp
  2. 6
      src/core/arm/nce/arm_nce.h

8
src/core/arm/nce/arm_nce.cpp

@ -137,8 +137,6 @@ HaltReason ArmNce::ReturnToRunCodeByExceptionLevelChange(int tid, void *tpidr) {
YUZU_NAKED_END
#else
HaltReason ArmNce::ReturnToRunCodeByExceptionLevelChange(void* tid, void *tpidr) {
DEBUG_ASSERT(TlsGetValue(ContextKey) == tpidr);
RaiseException(ExceptionLevelChangeSignal, 0, 0, nullptr); // TODO: pass tpidr through arguments?
__builtin_unreachable();
}
@ -229,7 +227,7 @@ static_assert(offsetof(HostContext, host_sp) == 0xE0); // TODO: don't use magic
void ArmNce::BreakFromRunCodeSignalHandler(int sig, void *info, void *raw_context) {
NativeExecutionParameters* tpidr = static_cast<NativeExecutionParameters *>(GetGuestParameters());
#if defined(__APPLE__)
#if defined(__APPLE__) || defined(_WIN32)
if (tpidr->is_actually_running) {
tpidr->is_actually_running = false;
#else
@ -309,7 +307,7 @@ void ArmNce::GuestMemoryFaultSignalHandler(int sig, void* raw_info, void* raw_co
return;
ret:
#ifndef __APPLE__
#if defined(__linux__)
asm volatile(
"msr TPIDR_EL0, %0\n"
:: "r"(nep));
@ -457,7 +455,7 @@ HaltReason ArmNce::RunThread(Kernel::KThread* thread) {
#if defined(__APPLE__)
ASSERT(pthread_setspecific(ContextKey, &thread_params) == 0);
#elif defined(_WIN32)
ASSERT(TlsSetValue(ContextKey, &thread_params) == 0);
ASSERT_MSG(TlsSetValue(ContextKey, &thread_params) == 0, "Failed to set TLS value: id {}, error {}", ContextKey, GetLastError());
#endif
// Move non-critical operations outside the locked section

6
src/core/arm/nce/arm_nce.h

@ -37,9 +37,9 @@ constexpr pthread_key_t ContextKey = 210;
#define ExceptionLevelChangeSignal 0xE0000001
inline thread_local bool is_host_fault = false;
static const u32 ContextKey = TlsAlloc();
static const u32 NCEStorage = TlsAlloc();
static const u64 TlsSlots = offsetof(TEB, TlsSlots);
inline u32 ContextKey = TlsAlloc();
inline u32 NCEStorage = TlsAlloc();
constexpr u64 TlsSlots = offsetof(TEB, TlsSlots);
#endif

Loading…
Cancel
Save