diff options
| author | 2020-12-03 15:32:45 -0800 | |
|---|---|---|
| committer | 2020-12-03 15:32:45 -0800 | |
| commit | 69aaad9b9684570284efcdb5921e54d0f5983838 (patch) | |
| tree | 364256228dfcdfc989a597aca2a6c753b173f93a /src/core/cpu_manager.cpp | |
| parent | Merge pull request #5059 from lioncash/mouse (diff) | |
| parent | kernel: scheduler: Minor cleanup to remove duplicated code. (diff) | |
| download | yuzu-69aaad9b9684570284efcdb5921e54d0f5983838.tar.gz yuzu-69aaad9b9684570284efcdb5921e54d0f5983838.tar.xz yuzu-69aaad9b9684570284efcdb5921e54d0f5983838.zip | |
Merge pull request #4996 from bunnei/use-4jits
Kernel: Refactor to use 4-instances of Dynarmic & various cleanups and improvements
Diffstat (limited to 'src/core/cpu_manager.cpp')
| -rw-r--r-- | src/core/cpu_manager.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index eeeb6e8df..0cff985e9 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -113,22 +113,23 @@ void CpuManager::MultiCoreRunGuestThread() { | |||
| 113 | auto& sched = kernel.CurrentScheduler(); | 113 | auto& sched = kernel.CurrentScheduler(); |
| 114 | sched.OnThreadStart(); | 114 | sched.OnThreadStart(); |
| 115 | } | 115 | } |
| 116 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); | ||
| 117 | auto& host_context = thread->GetHostContext(); | ||
| 118 | host_context->SetRewindPoint(GuestRewindFunction, this); | ||
| 116 | MultiCoreRunGuestLoop(); | 119 | MultiCoreRunGuestLoop(); |
| 117 | } | 120 | } |
| 118 | 121 | ||
| 119 | void CpuManager::MultiCoreRunGuestLoop() { | 122 | void CpuManager::MultiCoreRunGuestLoop() { |
| 120 | auto& kernel = system.Kernel(); | 123 | auto& kernel = system.Kernel(); |
| 121 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); | 124 | |
| 122 | while (true) { | 125 | while (true) { |
| 123 | auto* physical_core = &kernel.CurrentPhysicalCore(); | 126 | auto* physical_core = &kernel.CurrentPhysicalCore(); |
| 124 | auto& arm_interface = thread->ArmInterface(); | ||
| 125 | system.EnterDynarmicProfile(); | 127 | system.EnterDynarmicProfile(); |
| 126 | while (!physical_core->IsInterrupted()) { | 128 | while (!physical_core->IsInterrupted()) { |
| 127 | arm_interface.Run(); | 129 | physical_core->Run(); |
| 128 | physical_core = &kernel.CurrentPhysicalCore(); | 130 | physical_core = &kernel.CurrentPhysicalCore(); |
| 129 | } | 131 | } |
| 130 | system.ExitDynarmicProfile(); | 132 | system.ExitDynarmicProfile(); |
| 131 | arm_interface.ClearExclusiveState(); | ||
| 132 | auto& scheduler = kernel.CurrentScheduler(); | 133 | auto& scheduler = kernel.CurrentScheduler(); |
| 133 | scheduler.TryDoContextSwitch(); | 134 | scheduler.TryDoContextSwitch(); |
| 134 | } | 135 | } |
| @@ -209,6 +210,9 @@ void CpuManager::SingleCoreRunGuestThread() { | |||
| 209 | auto& sched = kernel.CurrentScheduler(); | 210 | auto& sched = kernel.CurrentScheduler(); |
| 210 | sched.OnThreadStart(); | 211 | sched.OnThreadStart(); |
| 211 | } | 212 | } |
| 213 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); | ||
| 214 | auto& host_context = thread->GetHostContext(); | ||
| 215 | host_context->SetRewindPoint(GuestRewindFunction, this); | ||
| 212 | SingleCoreRunGuestLoop(); | 216 | SingleCoreRunGuestLoop(); |
| 213 | } | 217 | } |
| 214 | 218 | ||
| @@ -217,17 +221,15 @@ void CpuManager::SingleCoreRunGuestLoop() { | |||
| 217 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); | 221 | auto* thread = kernel.CurrentScheduler().GetCurrentThread(); |
| 218 | while (true) { | 222 | while (true) { |
| 219 | auto* physical_core = &kernel.CurrentPhysicalCore(); | 223 | auto* physical_core = &kernel.CurrentPhysicalCore(); |
| 220 | auto& arm_interface = thread->ArmInterface(); | ||
| 221 | system.EnterDynarmicProfile(); | 224 | system.EnterDynarmicProfile(); |
| 222 | if (!physical_core->IsInterrupted()) { | 225 | if (!physical_core->IsInterrupted()) { |
| 223 | arm_interface.Run(); | 226 | physical_core->Run(); |
| 224 | physical_core = &kernel.CurrentPhysicalCore(); | 227 | physical_core = &kernel.CurrentPhysicalCore(); |
| 225 | } | 228 | } |
| 226 | system.ExitDynarmicProfile(); | 229 | system.ExitDynarmicProfile(); |
| 227 | thread->SetPhantomMode(true); | 230 | thread->SetPhantomMode(true); |
| 228 | system.CoreTiming().Advance(); | 231 | system.CoreTiming().Advance(); |
| 229 | thread->SetPhantomMode(false); | 232 | thread->SetPhantomMode(false); |
| 230 | arm_interface.ClearExclusiveState(); | ||
| 231 | PreemptSingleCore(); | 233 | PreemptSingleCore(); |
| 232 | auto& scheduler = kernel.Scheduler(current_core); | 234 | auto& scheduler = kernel.Scheduler(current_core); |
| 233 | scheduler.TryDoContextSwitch(); | 235 | scheduler.TryDoContextSwitch(); |