core: Make running_core always match kernel current_cpu (#7159)

This commit is contained in:
GPUCode 2023-11-14 14:31:25 +02:00 committed by GitHub
parent 63d1830429
commit e28c2a390c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,7 +158,8 @@ System::ResultStatus System::RunLoop(bool tight_loop) {
for (auto& cpu_core : cpu_cores) { for (auto& cpu_core : cpu_cores) {
if (cpu_core->GetTimer().GetTicks() < global_ticks) { if (cpu_core->GetTimer().GetTicks() < global_ticks) {
s64 delay = global_ticks - cpu_core->GetTimer().GetTicks(); 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->GetTimer().Advance();
cpu_core->PrepareReschedule(); cpu_core->PrepareReschedule();
kernel->GetThreadManager(cpu_core->GetID()).Reschedule(); 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 // TODO: Make special check for idle since we can easily revert the time of idle cores
s64 max_slice = Timing::MAX_SLICE_LENGTH; s64 max_slice = Timing::MAX_SLICE_LENGTH;
for (const auto& cpu_core : cpu_cores) { 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->GetTimer().Advance();
cpu_core->PrepareReschedule(); cpu_core->PrepareReschedule();
kernel->GetThreadManager(cpu_core->GetID()).Reschedule(); kernel->GetThreadManager(cpu_core->GetID()).Reschedule();