diff options
author | Liam <byteslice@airmail.cc> | 2022-07-07 18:34:46 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2022-07-15 04:47:18 +0200 |
commit | da07e13e0798a4ebd423595830f04e2234a03942 (patch) | |
tree | 2e2a88eb2fd2a5ae6f070609040418f9c1df4c35 /src/core/hle/kernel/k_scheduler.cpp | |
parent | kernel: fix issues with single core mode (diff) | |
download | yuzu-da07e13e0798a4ebd423595830f04e2234a03942.tar yuzu-da07e13e0798a4ebd423595830f04e2234a03942.tar.gz yuzu-da07e13e0798a4ebd423595830f04e2234a03942.tar.bz2 yuzu-da07e13e0798a4ebd423595830f04e2234a03942.tar.lz yuzu-da07e13e0798a4ebd423595830f04e2234a03942.tar.xz yuzu-da07e13e0798a4ebd423595830f04e2234a03942.tar.zst yuzu-da07e13e0798a4ebd423595830f04e2234a03942.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/k_scheduler.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp index cac96a780..230ca3b95 100644 --- a/src/core/hle/kernel/k_scheduler.cpp +++ b/src/core/hle/kernel/k_scheduler.cpp @@ -103,7 +103,20 @@ void KScheduler::ScheduleOnInterrupt() { GetCurrentThread(kernel).EnableDispatch(); } +void KScheduler::PreemptSingleCore() { + GetCurrentThread(kernel).DisableDispatch(); + + auto* thread = GetCurrentThreadPointer(kernel); + auto& previous_scheduler = kernel.Scheduler(thread->GetCurrentCore()); + previous_scheduler.Unload(thread); + + Common::Fiber::YieldTo(thread->GetHostContext(), *m_switch_fiber); + + GetCurrentThread(kernel).EnableDispatch(); +} + void KScheduler::RescheduleCurrentCore() { + ASSERT(!kernel.IsPhantomModeForSingleCore()); ASSERT(GetCurrentThread(kernel).GetDisableDispatchCount() == 1); GetCurrentThread(kernel).EnableDispatch(); |