From e28c2a390c8fad3d65b0463854f0657546f09b76 Mon Sep 17 00:00:00 2001 From: GPUCode <47210458+GPUCode@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:31:25 +0200 Subject: [PATCH] core: Make running_core always match kernel current_cpu (#7159) --- src/core/core.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index ddd3f4c5b..a4d66335e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -158,7 +158,8 @@ System::ResultStatus System::RunLoop(bool tight_loop) { for (auto& cpu_core : cpu_cores) { if (cpu_core->GetTimer().GetTicks() < global_ticks) { s64 delay = global_ticks - cpu_core->GetTimer().GetTicks(); - kernel->SetRunningCPU(cpu_core.get()); + running_core = cpu_core.get(); + kernel->SetRunningCPU(running_core); cpu_core->GetTimer().Advance(); cpu_core->PrepareReschedule(); kernel->GetThreadManager(cpu_core->GetID()).Reschedule(); @@ -199,7 +200,8 @@ System::ResultStatus System::RunLoop(bool tight_loop) { // TODO: Make special check for idle since we can easily revert the time of idle cores s64 max_slice = Timing::MAX_SLICE_LENGTH; for (const auto& cpu_core : cpu_cores) { - kernel->SetRunningCPU(cpu_core.get()); + running_core = cpu_core.get(); + kernel->SetRunningCPU(running_core); cpu_core->GetTimer().Advance(); cpu_core->PrepareReschedule(); kernel->GetThreadManager(cpu_core->GetID()).Reschedule();