diff options
author | bunnei <bunneidev@gmail.com> | 2021-01-30 08:06:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-30 08:06:40 +0100 |
commit | a4526c4e1acb50808bbe205952101142288e1c60 (patch) | |
tree | 7109edf89606c43352da9de40d0e3a920a08b659 /src/core/cpu_manager.cpp | |
parent | Merge pull request #5795 from ReinUsesLisp/bytes-to-map-end (diff) | |
parent | hle: kernel: KLightLock: Fix several bugs. (diff) | |
download | yuzu-a4526c4e1acb50808bbe205952101142288e1c60.tar yuzu-a4526c4e1acb50808bbe205952101142288e1c60.tar.gz yuzu-a4526c4e1acb50808bbe205952101142288e1c60.tar.bz2 yuzu-a4526c4e1acb50808bbe205952101142288e1c60.tar.lz yuzu-a4526c4e1acb50808bbe205952101142288e1c60.tar.xz yuzu-a4526c4e1acb50808bbe205952101142288e1c60.tar.zst yuzu-a4526c4e1acb50808bbe205952101142288e1c60.zip |
Diffstat (limited to 'src/core/cpu_manager.cpp')
-rw-r--r-- | src/core/cpu_manager.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 373395047..8f04fb8f5 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -11,9 +11,9 @@ #include "core/core_timing.h" #include "core/cpu_manager.h" #include "core/hle/kernel/k_scheduler.h" +#include "core/hle/kernel/k_thread.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/physical_core.h" -#include "core/hle/kernel/thread.h" #include "video_core/gpu.h" namespace Core { @@ -147,7 +147,7 @@ void CpuManager::MultiCoreRunSuspendThread() { while (true) { auto core = kernel.GetCurrentHostThreadID(); auto& scheduler = *kernel.CurrentScheduler(); - Kernel::Thread* current_thread = scheduler.GetCurrentThread(); + Kernel::KThread* current_thread = scheduler.GetCurrentThread(); Common::Fiber::YieldTo(current_thread->GetHostContext(), core_data[core].host_context); ASSERT(scheduler.ContextSwitchPending()); ASSERT(core == kernel.GetCurrentHostThreadID()); @@ -208,7 +208,6 @@ void CpuManager::SingleCoreRunGuestThread() { void CpuManager::SingleCoreRunGuestLoop() { auto& kernel = system.Kernel(); - auto* thread = kernel.CurrentScheduler()->GetCurrentThread(); while (true) { auto* physical_core = &kernel.CurrentPhysicalCore(); system.EnterDynarmicProfile(); @@ -217,9 +216,9 @@ void CpuManager::SingleCoreRunGuestLoop() { physical_core = &kernel.CurrentPhysicalCore(); } system.ExitDynarmicProfile(); - thread->SetPhantomMode(true); + kernel.SetIsPhantomModeForSingleCore(true); system.CoreTiming().Advance(); - thread->SetPhantomMode(false); + kernel.SetIsPhantomModeForSingleCore(false); physical_core->ArmInterface().ClearExclusiveState(); PreemptSingleCore(); auto& scheduler = kernel.Scheduler(current_core); @@ -245,7 +244,7 @@ void CpuManager::SingleCoreRunSuspendThread() { while (true) { auto core = kernel.GetCurrentHostThreadID(); auto& scheduler = *kernel.CurrentScheduler(); - Kernel::Thread* current_thread = scheduler.GetCurrentThread(); + Kernel::KThread* current_thread = scheduler.GetCurrentThread(); Common::Fiber::YieldTo(current_thread->GetHostContext(), core_data[0].host_context); ASSERT(scheduler.ContextSwitchPending()); ASSERT(core == kernel.GetCurrentHostThreadID()); @@ -255,22 +254,23 @@ void CpuManager::SingleCoreRunSuspendThread() { void CpuManager::PreemptSingleCore(bool from_running_enviroment) { { - auto& scheduler = system.Kernel().Scheduler(current_core); - Kernel::Thread* current_thread = scheduler.GetCurrentThread(); + auto& kernel = system.Kernel(); + auto& scheduler = kernel.Scheduler(current_core); + Kernel::KThread* current_thread = scheduler.GetCurrentThread(); if (idle_count >= 4 || from_running_enviroment) { if (!from_running_enviroment) { system.CoreTiming().Idle(); idle_count = 0; } - current_thread->SetPhantomMode(true); + kernel.SetIsPhantomModeForSingleCore(true); system.CoreTiming().Advance(); - current_thread->SetPhantomMode(false); + kernel.SetIsPhantomModeForSingleCore(false); } current_core.store((current_core + 1) % Core::Hardware::NUM_CPU_CORES); system.CoreTiming().ResetTicks(); scheduler.Unload(scheduler.GetCurrentThread()); - auto& next_scheduler = system.Kernel().Scheduler(current_core); + auto& next_scheduler = kernel.Scheduler(current_core); Common::Fiber::YieldTo(current_thread->GetHostContext(), next_scheduler.ControlContext()); } @@ -278,8 +278,7 @@ void CpuManager::PreemptSingleCore(bool from_running_enviroment) { { auto& scheduler = system.Kernel().Scheduler(current_core); scheduler.Reload(scheduler.GetCurrentThread()); - auto* currrent_thread2 = scheduler.GetCurrentThread(); - if (!currrent_thread2->IsIdleThread()) { + if (!scheduler.IsIdle()) { idle_count = 0; } } |