diff options
Diffstat (limited to 'src/core/cpu_manager.cpp')
| -rw-r--r-- | src/core/cpu_manager.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 2aea95a25..2e9dc9dc3 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -129,18 +129,17 @@ void CpuManager::MultiCoreRunGuestThread() { | |||
| 129 | void CpuManager::MultiCoreRunGuestLoop() { | 129 | void CpuManager::MultiCoreRunGuestLoop() { |
| 130 | auto& kernel = system.Kernel(); | 130 | auto& kernel = system.Kernel(); |
| 131 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); | 131 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); |
| 132 | auto host_context = thread->GetHostContext(); | ||
| 133 | host_context->SetRewindPoint(std::function<void(void*)>(GuestRewindFunction), this); | ||
| 134 | host_context.reset(); | ||
| 135 | while (true) { | 132 | while (true) { |
| 136 | auto& physical_core = kernel.CurrentPhysicalCore(); | 133 | auto* physical_core = &kernel.CurrentPhysicalCore(); |
| 134 | auto& arm_interface = thread->ArmInterface(); | ||
| 137 | system.EnterDynarmicProfile(); | 135 | system.EnterDynarmicProfile(); |
| 138 | while (!physical_core.IsInterrupted()) { | 136 | while (!physical_core->IsInterrupted()) { |
| 139 | physical_core.Run(); | 137 | arm_interface.Run(); |
| 138 | physical_core = &kernel.CurrentPhysicalCore(); | ||
| 140 | } | 139 | } |
| 141 | system.ExitDynarmicProfile(); | 140 | system.ExitDynarmicProfile(); |
| 142 | physical_core.ClearExclusive(); | 141 | arm_interface.ClearExclusiveState(); |
| 143 | auto& scheduler = physical_core.Scheduler(); | 142 | auto& scheduler = kernel.CurrentScheduler(); |
| 144 | scheduler.TryDoContextSwitch(); | 143 | scheduler.TryDoContextSwitch(); |
| 145 | } | 144 | } |
| 146 | } | 145 | } |
| @@ -150,7 +149,7 @@ void CpuManager::MultiCoreRunIdleThread() { | |||
| 150 | while (true) { | 149 | while (true) { |
| 151 | auto& physical_core = kernel.CurrentPhysicalCore(); | 150 | auto& physical_core = kernel.CurrentPhysicalCore(); |
| 152 | physical_core.Idle(); | 151 | physical_core.Idle(); |
| 153 | auto& scheduler = physical_core.Scheduler(); | 152 | auto& scheduler = kernel.CurrentScheduler(); |
| 154 | scheduler.TryDoContextSwitch(); | 153 | scheduler.TryDoContextSwitch(); |
| 155 | } | 154 | } |
| 156 | } | 155 | } |
| @@ -229,14 +228,13 @@ void CpuManager::SingleCoreRunGuestThread() { | |||
| 229 | void CpuManager::SingleCoreRunGuestLoop() { | 228 | void CpuManager::SingleCoreRunGuestLoop() { |
| 230 | auto& kernel = system.Kernel(); | 229 | auto& kernel = system.Kernel(); |
| 231 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); | 230 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); |
| 232 | auto host_context = thread->GetHostContext(); | ||
| 233 | host_context->SetRewindPoint(std::function<void(void*)>(GuestRewindFunction), this); | ||
| 234 | host_context.reset(); | ||
| 235 | while (true) { | 231 | while (true) { |
| 236 | auto& physical_core = kernel.CurrentPhysicalCore(); | 232 | auto* physical_core = &kernel.CurrentPhysicalCore(); |
| 233 | auto& arm_interface = thread->ArmInterface(); | ||
| 237 | system.EnterDynarmicProfile(); | 234 | system.EnterDynarmicProfile(); |
| 238 | while (!physical_core.IsInterrupted()) { | 235 | while (!physical_core->IsInterrupted()) { |
| 239 | physical_core.Run(); | 236 | arm_interface.Run(); |
| 237 | physical_core = &kernel.CurrentPhysicalCore(); | ||
| 240 | preemption_count++; | 238 | preemption_count++; |
| 241 | if (preemption_count % max_cycle_runs == 0) { | 239 | if (preemption_count % max_cycle_runs == 0) { |
| 242 | break; | 240 | break; |
| @@ -246,7 +244,7 @@ void CpuManager::SingleCoreRunGuestLoop() { | |||
| 246 | thread->SetPhantomMode(true); | 244 | thread->SetPhantomMode(true); |
| 247 | system.CoreTiming().Advance(); | 245 | system.CoreTiming().Advance(); |
| 248 | thread->SetPhantomMode(false); | 246 | thread->SetPhantomMode(false); |
| 249 | physical_core.ClearExclusive(); | 247 | arm_interface.ClearExclusiveState(); |
| 250 | PreemptSingleCore(); | 248 | PreemptSingleCore(); |
| 251 | auto& scheduler = kernel.Scheduler(current_core); | 249 | auto& scheduler = kernel.Scheduler(current_core); |
| 252 | scheduler.TryDoContextSwitch(); | 250 | scheduler.TryDoContextSwitch(); |