summaryrefslogtreecommitdiffstats
path: root/src/core/cpu_manager.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-28 20:23:28 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:36:01 +0200
commitf5e32935ca9d1727624c86ca78aff91027caf819 (patch)
treea041186cd47fcea90880b300af3351a56fb819aa /src/core/cpu_manager.cpp
parentScheduler: Correct Reload/Unload (diff)
downloadyuzu-f5e32935ca9d1727624c86ca78aff91027caf819.tar
yuzu-f5e32935ca9d1727624c86ca78aff91027caf819.tar.gz
yuzu-f5e32935ca9d1727624c86ca78aff91027caf819.tar.bz2
yuzu-f5e32935ca9d1727624c86ca78aff91027caf819.tar.lz
yuzu-f5e32935ca9d1727624c86ca78aff91027caf819.tar.xz
yuzu-f5e32935ca9d1727624c86ca78aff91027caf819.tar.zst
yuzu-f5e32935ca9d1727624c86ca78aff91027caf819.zip
Diffstat (limited to 'src/core/cpu_manager.cpp')
-rw-r--r--src/core/cpu_manager.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index 2e9dc9dc3..604405060 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -232,13 +232,10 @@ void CpuManager::SingleCoreRunGuestLoop() {
auto* physical_core = &kernel.CurrentPhysicalCore();
auto& arm_interface = thread->ArmInterface();
system.EnterDynarmicProfile();
- while (!physical_core->IsInterrupted()) {
+ if (!physical_core->IsInterrupted()) {
+ system.CoreTiming().ResetTicks();
arm_interface.Run();
physical_core = &kernel.CurrentPhysicalCore();
- preemption_count++;
- if (preemption_count % max_cycle_runs == 0) {
- break;
- }
}
system.ExitDynarmicProfile();
thread->SetPhantomMode(true);
@@ -255,7 +252,7 @@ void CpuManager::SingleCoreRunIdleThread() {
auto& kernel = system.Kernel();
while (true) {
auto& physical_core = kernel.CurrentPhysicalCore();
- PreemptSingleCore();
+ PreemptSingleCore(false);
idle_count++;
auto& scheduler = physical_core.Scheduler();
scheduler.TryDoContextSwitch();
@@ -279,12 +276,15 @@ void CpuManager::SingleCoreRunSuspendThread() {
}
}
-void CpuManager::PreemptSingleCore() {
- preemption_count = 0;
+void CpuManager::PreemptSingleCore(bool from_running_enviroment) {
std::size_t old_core = current_core;
auto& scheduler = system.Kernel().Scheduler(old_core);
Kernel::Thread* current_thread = scheduler.GetCurrentThread();
- if (idle_count >= 4) {
+ if (idle_count >= 4 || from_running_enviroment) {
+ if (!from_running_enviroment) {
+ system.CoreTiming().Idle();
+ idle_count = 0;
+ }
current_thread->SetPhantomMode(true);
system.CoreTiming().Advance();
current_thread->SetPhantomMode(false);