diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-03-10 16:50:33 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-27 17:35:43 +0200 |
commit | a439cdf22ea50f0e39cb51f6dff15fee3b495d16 (patch) | |
tree | 2c88310d7cca08ef451107d9ae6bd5191e7d72e5 /src/core/cpu_manager.cpp | |
parent | Synchronization: Correct wide Assertion. (diff) | |
download | yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.tar yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.tar.gz yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.tar.bz2 yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.tar.lz yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.tar.xz yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.tar.zst yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.zip |
Diffstat (limited to 'src/core/cpu_manager.cpp')
-rw-r--r-- | src/core/cpu_manager.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index e72f89808..95842aad1 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -225,7 +225,7 @@ void CpuManager::SingleCoreRunGuestLoop() { } physical_core.ClearExclusive(); PreemptSingleCore(); - auto& scheduler = physical_core.Scheduler(); + auto& scheduler = kernel.Scheduler(current_core); scheduler.TryDoContextSwitch(); } } @@ -260,11 +260,15 @@ void CpuManager::SingleCoreRunSuspendThread() { void CpuManager::PreemptSingleCore() { preemption_count = 0; std::size_t old_core = current_core; - current_core = (current_core + 1) % Core::Hardware::NUM_CPU_CORES; + current_core.store((current_core + 1) % Core::Hardware::NUM_CPU_CORES); auto& scheduler = system.Kernel().Scheduler(old_core); - Kernel::Thread* current_thread = system.Kernel().Scheduler(old_core).GetCurrentThread(); - Kernel::Thread* next_thread = system.Kernel().Scheduler(current_core).GetCurrentThread(); - Common::Fiber::YieldTo(current_thread->GetHostContext(), next_thread->GetHostContext()); + Kernel::Thread* current_thread = scheduler.GetCurrentThread(); + scheduler.Unload(); + auto& next_scheduler = system.Kernel().Scheduler(current_core); + Common::Fiber::YieldTo(current_thread->GetHostContext(), next_scheduler.ControlContext()); + /// May have changed scheduler + auto& current_scheduler = system.Kernel().Scheduler(current_core); + current_scheduler.Reload(); } void CpuManager::SingleCorePause(bool paused) { |