From 45c87c7e6e841c11def43e5ab25160006dab6d77 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 28 Nov 2023 14:30:39 -0500 Subject: core: refactor emulated cpu core activation --- src/core/hle/kernel/k_scheduler.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/core/hle/kernel/k_scheduler.cpp') diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp index 1bce63a56..27d1c3846 100644 --- a/src/core/hle/kernel/k_scheduler.cpp +++ b/src/core/hle/kernel/k_scheduler.cpp @@ -494,12 +494,7 @@ void KScheduler::ScheduleImplFiber() { } void KScheduler::Unload(KThread* thread) { - auto& cpu_core = m_kernel.System().ArmInterface(m_core_id); - cpu_core.SaveContext(thread->GetContext32()); - cpu_core.SaveContext(thread->GetContext64()); - // Save the TPIDR_EL0 system register in case it was modified. - thread->SetTpidrEl0(cpu_core.GetTPIDR_EL0()); - cpu_core.ClearExclusiveState(); + m_kernel.PhysicalCore(m_core_id).SaveContext(thread); // Check if the thread is terminated by checking the DPC flags. if ((thread->GetStackParameters().dpc_flags & static_cast(DpcFlag::Terminated)) == 0) { @@ -509,14 +504,7 @@ void KScheduler::Unload(KThread* thread) { } void KScheduler::Reload(KThread* thread) { - auto& cpu_core = m_kernel.System().ArmInterface(m_core_id); - auto* process = thread->GetOwnerProcess(); - cpu_core.LoadContext(thread->GetContext32()); - cpu_core.LoadContext(thread->GetContext64()); - cpu_core.SetTlsAddress(GetInteger(thread->GetTlsAddress())); - cpu_core.SetTPIDR_EL0(thread->GetTpidrEl0()); - cpu_core.LoadWatchpointArray(process ? &process->GetWatchpoints() : nullptr); - cpu_core.ClearExclusiveState(); + m_kernel.PhysicalCore(m_core_id).LoadContext(thread); } void KScheduler::ClearPreviousThread(KernelCore& kernel, KThread* thread) { -- cgit v1.2.3