From bd36eaf15d88c3875aba7032fe5124fbb150bd5d Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Thu, 27 Feb 2020 11:25:42 -0400 Subject: SVC: Correct races on physical core switching. --- src/core/cpu_manager.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/core/cpu_manager.cpp') diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index 241971ff3..904aacd97 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp @@ -79,12 +79,13 @@ void CpuManager::RunGuestThread() { sched.OnThreadStart(); } while (true) { - auto& physical_core = kernel.CurrentPhysicalCore(); - while (!physical_core.IsInterrupted()) { - physical_core.Run(); + auto* physical_core = &kernel.CurrentPhysicalCore(); + while (!physical_core->IsInterrupted()) { + physical_core->Run(); + physical_core = &kernel.CurrentPhysicalCore(); } - physical_core.ClearExclusive(); - auto& scheduler = physical_core.Scheduler(); + physical_core->ClearExclusive(); + auto& scheduler = physical_core->Scheduler(); scheduler.TryDoContextSwitch(); } } -- cgit v1.2.3