summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r--src/core/hle/kernel/kernel.cpp13
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 {
331 return is_shutting_down.load(std::memory_order_relaxed); 331 return is_shutting_down.load(std::memory_order_relaxed);
332 } 332 }
333 333
334 static inline thread_local KThread* current_thread{nullptr};
335
334 KThread* GetCurrentEmuThread() { 336 KThread* GetCurrentEmuThread() {
335 // If we are shutting down the kernel, none of this is relevant anymore. 337 // If we are shutting down the kernel, none of this is relevant anymore.
336 if (IsShuttingDown()) { 338 if (IsShuttingDown()) {
@@ -341,7 +343,12 @@ struct KernelCore::Impl {
341 if (thread_id >= Core::Hardware::NUM_CPU_CORES) { 343 if (thread_id >= Core::Hardware::NUM_CPU_CORES) {
342 return GetHostDummyThread(); 344 return GetHostDummyThread();
343 } 345 }
344 return schedulers[thread_id]->GetCurrentThread(); 346
347 return current_thread;
348 }
349
350 void SetCurrentEmuThread(KThread* thread) {
351 current_thread = thread;
345 } 352 }
346 353
347 void DeriveInitialMemoryLayout() { 354 void DeriveInitialMemoryLayout() {
@@ -1024,6 +1031,10 @@ KThread* KernelCore::GetCurrentEmuThread() const {
1024 return impl->GetCurrentEmuThread(); 1031 return impl->GetCurrentEmuThread();
1025} 1032}
1026 1033
1034void KernelCore::SetCurrentEmuThread(KThread* thread) {
1035 impl->SetCurrentEmuThread(thread);
1036}
1037
1027KMemoryManager& KernelCore::MemoryManager() { 1038KMemoryManager& KernelCore::MemoryManager() {
1028 return *impl->memory_manager; 1039 return *impl->memory_manager;
1029} 1040}