diff options
author | Liam <byteslice@airmail.cc> | 2022-06-16 16:35:52 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2022-06-23 06:28:00 +0200 |
commit | 2c56e94702e897c609711d82057d8267d8f4d0b3 (patch) | |
tree | b037c6951383408517b460577b709f4383a61da0 /src/core/hle/kernel/kernel.cpp | |
parent | Merge pull request #8491 from Morph1984/extra-assert (diff) | |
download | yuzu-2c56e94702e897c609711d82057d8267d8f4d0b3.tar yuzu-2c56e94702e897c609711d82057d8267d8f4d0b3.tar.gz yuzu-2c56e94702e897c609711d82057d8267d8f4d0b3.tar.bz2 yuzu-2c56e94702e897c609711d82057d8267d8f4d0b3.tar.lz yuzu-2c56e94702e897c609711d82057d8267d8f4d0b3.tar.xz yuzu-2c56e94702e897c609711d82057d8267d8f4d0b3.tar.zst yuzu-2c56e94702e897c609711d82057d8267d8f4d0b3.zip |
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 94953e257..0009193be 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -331,6 +331,8 @@ struct KernelCore::Impl { return is_shutting_down.load(std::memory_order_relaxed); } + static inline thread_local KThread* current_thread{nullptr}; + KThread* GetCurrentEmuThread() { // If we are shutting down the kernel, none of this is relevant anymore. if (IsShuttingDown()) { @@ -341,7 +343,12 @@ struct KernelCore::Impl { if (thread_id >= Core::Hardware::NUM_CPU_CORES) { return GetHostDummyThread(); } - return schedulers[thread_id]->GetCurrentThread(); + + return current_thread; + } + + void SetCurrentEmuThread(KThread* thread) { + current_thread = thread; } void DeriveInitialMemoryLayout() { @@ -1024,6 +1031,10 @@ KThread* KernelCore::GetCurrentEmuThread() const { return impl->GetCurrentEmuThread(); } +void KernelCore::SetCurrentEmuThread(KThread* thread) { + impl->SetCurrentEmuThread(thread); +} + KMemoryManager& KernelCore::MemoryManager() { return *impl->memory_manager; } |