From c0d3aef28c0a0c68c18de30228f29e30f0e52533 Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 30 Dec 2020 23:01:08 -0800 Subject: core: hle: kernel: Rename Thread to KThread. --- src/core/cpu_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/cpu_manager.cpp') diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 373395047..122edb588 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()); @@ -245,7 +245,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()); @@ -256,7 +256,7 @@ void CpuManager::SingleCoreRunSuspendThread() { void CpuManager::PreemptSingleCore(bool from_running_enviroment) { { auto& scheduler = system.Kernel().Scheduler(current_core); - Kernel::Thread* current_thread = scheduler.GetCurrentThread(); + Kernel::KThread* current_thread = scheduler.GetCurrentThread(); if (idle_count >= 4 || from_running_enviroment) { if (!from_running_enviroment) { system.CoreTiming().Idle(); -- cgit v1.2.3 From eea346ba8eed49111d34e2fb1eee8a1ad53c4614 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 31 Dec 2020 00:46:09 -0800 Subject: hle: kernel: KThread: Remove thread types that do not exist. --- src/core/cpu_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/cpu_manager.cpp') diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 122edb588..018cd2e25 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -279,7 +279,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 (!currrent_thread2->IsKernelThread()) { idle_count = 0; } } -- cgit v1.2.3 From 47829850131f04075950b733cb93a3688e8afb5b Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 31 Dec 2020 02:13:02 -0800 Subject: hle: kernel: Move single core "phantom mode" out of KThread. - This is a workaround that does not belong in a kernel primitive. --- src/core/cpu_manager.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/core/cpu_manager.cpp') diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 018cd2e25..719258250 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -217,9 +217,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); @@ -255,22 +255,23 @@ void CpuManager::SingleCoreRunSuspendThread() { void CpuManager::PreemptSingleCore(bool from_running_enviroment) { { - auto& scheduler = system.Kernel().Scheduler(current_core); + 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()); } -- cgit v1.2.3 From cdd14b03e5c8e29bc6cd11bbde0ef726d2f166ce Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 20 Jan 2021 13:42:27 -0800 Subject: hle: kernel: Recode implementation of KThread to be more accurate. --- src/core/cpu_manager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/cpu_manager.cpp') diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 719258250..9bbb82b97 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -279,8 +279,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->IsKernelThread()) { + if (!scheduler.IsIdle()) { idle_count = 0; } } -- cgit v1.2.3 From 89a5ae92bdeb451943665868f59e364259368f11 Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 20 Jan 2021 17:18:04 -0800 Subject: core: cpu_manager: Remove unused variable. --- src/core/cpu_manager.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/core/cpu_manager.cpp') diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 9bbb82b97..8f04fb8f5 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -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(); -- cgit v1.2.3