diff options
Diffstat (limited to 'src/core/cpu_manager.cpp')
| -rw-r--r-- | src/core/cpu_manager.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 5d43c6e5d..cbcc54891 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -117,17 +117,18 @@ void CpuManager::MultiCoreRunGuestLoop() { | |||
| 117 | physical_core = &kernel.CurrentPhysicalCore(); | 117 | physical_core = &kernel.CurrentPhysicalCore(); |
| 118 | } | 118 | } |
| 119 | system.ExitDynarmicProfile(); | 119 | system.ExitDynarmicProfile(); |
| 120 | physical_core->ArmInterface().ClearExclusiveState(); | 120 | { |
| 121 | kernel.CurrentScheduler()->RescheduleCurrentCore(); | 121 | Kernel::KScopedDisableDispatch dd(kernel); |
| 122 | physical_core->ArmInterface().ClearExclusiveState(); | ||
| 123 | } | ||
| 122 | } | 124 | } |
| 123 | } | 125 | } |
| 124 | 126 | ||
| 125 | void CpuManager::MultiCoreRunIdleThread() { | 127 | void CpuManager::MultiCoreRunIdleThread() { |
| 126 | auto& kernel = system.Kernel(); | 128 | auto& kernel = system.Kernel(); |
| 127 | while (true) { | 129 | while (true) { |
| 128 | auto& physical_core = kernel.CurrentPhysicalCore(); | 130 | Kernel::KScopedDisableDispatch dd(kernel); |
| 129 | physical_core.Idle(); | 131 | kernel.CurrentPhysicalCore().Idle(); |
| 130 | kernel.CurrentScheduler()->RescheduleCurrentCore(); | ||
| 131 | } | 132 | } |
| 132 | } | 133 | } |
| 133 | 134 | ||
| @@ -135,12 +136,12 @@ void CpuManager::MultiCoreRunSuspendThread() { | |||
| 135 | auto& kernel = system.Kernel(); | 136 | auto& kernel = system.Kernel(); |
| 136 | kernel.CurrentScheduler()->OnThreadStart(); | 137 | kernel.CurrentScheduler()->OnThreadStart(); |
| 137 | while (true) { | 138 | while (true) { |
| 138 | auto core = kernel.GetCurrentHostThreadID(); | 139 | auto core = kernel.CurrentPhysicalCoreIndex(); |
| 139 | auto& scheduler = *kernel.CurrentScheduler(); | 140 | auto& scheduler = *kernel.CurrentScheduler(); |
| 140 | Kernel::KThread* current_thread = scheduler.GetCurrentThread(); | 141 | Kernel::KThread* current_thread = scheduler.GetCurrentThread(); |
| 141 | Common::Fiber::YieldTo(current_thread->GetHostContext(), *core_data[core].host_context); | 142 | Common::Fiber::YieldTo(current_thread->GetHostContext(), *core_data[core].host_context); |
| 142 | ASSERT(scheduler.ContextSwitchPending()); | 143 | ASSERT(scheduler.ContextSwitchPending()); |
| 143 | ASSERT(core == kernel.GetCurrentHostThreadID()); | 144 | ASSERT(core == kernel.CurrentPhysicalCoreIndex()); |
| 144 | scheduler.RescheduleCurrentCore(); | 145 | scheduler.RescheduleCurrentCore(); |
| 145 | } | 146 | } |
| 146 | } | 147 | } |
| @@ -346,13 +347,9 @@ void CpuManager::RunThread(std::stop_token stop_token, std::size_t core) { | |||
| 346 | sc_sync_first_use = false; | 347 | sc_sync_first_use = false; |
| 347 | } | 348 | } |
| 348 | 349 | ||
| 349 | // Abort if emulation was killed before the session really starts | 350 | // Emulation was stopped |
| 350 | if (!system.IsPoweredOn()) { | ||
| 351 | return; | ||
| 352 | } | ||
| 353 | |||
| 354 | if (stop_token.stop_requested()) { | 351 | if (stop_token.stop_requested()) { |
| 355 | break; | 352 | return; |
| 356 | } | 353 | } |
| 357 | 354 | ||
| 358 | auto current_thread = system.Kernel().CurrentScheduler()->GetCurrentThread(); | 355 | auto current_thread = system.Kernel().CurrentScheduler()->GetCurrentThread(); |