aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_scheduler.cpp
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-11-28 14:30:39 -0500
committerLiam <byteslice@airmail.cc>2023-12-04 10:37:16 -0500
commit45c87c7e6e841c11def43e5ab25160006dab6d77 (patch)
tree04a3ea0bd8c07389e17741aa28615e3b32ace2f7 /src/core/hle/kernel/k_scheduler.cpp
parent90e87c40e8628f2ed00a0e0272a9652b7fdb9a96 (diff)
core: refactor emulated cpu core activation
Diffstat (limited to 'src/core/hle/kernel/k_scheduler.cpp')
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp16
1 files changed, 2 insertions, 14 deletions
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<u32>(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) {