summaryrefslogtreecommitdiff
path: root/src/core/cpu_manager.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2021-08-06 23:22:52 -0700
committerGravatar bunnei2021-08-07 12:18:47 -0700
commitcbe4e32d38c6cc844f5fbf4fc59831a7abea08a9 (patch)
tree839a7060b5f91953cf4c1a1eba24a3e3cba551e1 /src/core/cpu_manager.cpp
parentcore: hle: kernel: Use CurrentPhysicalCoreIndex as appropriate. (diff)
downloadyuzu-cbe4e32d38c6cc844f5fbf4fc59831a7abea08a9.tar.gz
yuzu-cbe4e32d38c6cc844f5fbf4fc59831a7abea08a9.tar.xz
yuzu-cbe4e32d38c6cc844f5fbf4fc59831a7abea08a9.zip
core: cpu_manager: Use KScopedDisableDispatch.
Diffstat (limited to 'src/core/cpu_manager.cpp')
-rw-r--r--src/core/cpu_manager.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index 77efcabf0..e2c4f0e07 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -118,17 +118,18 @@ void CpuManager::MultiCoreRunGuestLoop() {
118 physical_core = &kernel.CurrentPhysicalCore(); 118 physical_core = &kernel.CurrentPhysicalCore();
119 } 119 }
120 system.ExitDynarmicProfile(); 120 system.ExitDynarmicProfile();
121 physical_core->ArmInterface().ClearExclusiveState(); 121 {
122 kernel.CurrentScheduler()->RescheduleCurrentCore(); 122 Kernel::KScopedDisableDispatch dd(kernel);
123 physical_core->ArmInterface().ClearExclusiveState();
124 }
123 } 125 }
124} 126}
125 127
126void CpuManager::MultiCoreRunIdleThread() { 128void CpuManager::MultiCoreRunIdleThread() {
127 auto& kernel = system.Kernel(); 129 auto& kernel = system.Kernel();
128 while (true) { 130 while (true) {
129 auto& physical_core = kernel.CurrentPhysicalCore(); 131 Kernel::KScopedDisableDispatch dd(kernel);
130 physical_core.Idle(); 132 kernel.CurrentPhysicalCore().Idle();
131 kernel.CurrentScheduler()->RescheduleCurrentCore();
132 } 133 }
133} 134}
134 135
@@ -136,12 +137,12 @@ void CpuManager::MultiCoreRunSuspendThread() {
136 auto& kernel = system.Kernel(); 137 auto& kernel = system.Kernel();
137 kernel.CurrentScheduler()->OnThreadStart(); 138 kernel.CurrentScheduler()->OnThreadStart();
138 while (true) { 139 while (true) {
139 auto core = kernel.GetCurrentHostThreadID(); 140 auto core = kernel.CurrentPhysicalCoreIndex();
140 auto& scheduler = *kernel.CurrentScheduler(); 141 auto& scheduler = *kernel.CurrentScheduler();
141 Kernel::KThread* current_thread = scheduler.GetCurrentThread(); 142 Kernel::KThread* current_thread = scheduler.GetCurrentThread();
142 Common::Fiber::YieldTo(current_thread->GetHostContext(), *core_data[core].host_context); 143 Common::Fiber::YieldTo(current_thread->GetHostContext(), *core_data[core].host_context);
143 ASSERT(scheduler.ContextSwitchPending()); 144 ASSERT(scheduler.ContextSwitchPending());
144 ASSERT(core == kernel.GetCurrentHostThreadID()); 145 ASSERT(core == kernel.CurrentPhysicalCoreIndex());
145 scheduler.RescheduleCurrentCore(); 146 scheduler.RescheduleCurrentCore();
146 } 147 }
147} 148}