From 7821241356c2f6b159945babf657ffd921957918 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 31 May 2021 04:20:59 -0700 Subject: [PATCH] kern: fix enormous whoops --- libraries/libmesosphere/source/kern_k_scheduler.cpp | 8 ++++---- .../kernel/source/arch/arm64/kern_k_scheduler_asm.s | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libraries/libmesosphere/source/kern_k_scheduler.cpp b/libraries/libmesosphere/source/kern_k_scheduler.cpp index 1773a8a0e..cce622c96 100644 --- a/libraries/libmesosphere/source/kern_k_scheduler.cpp +++ b/libraries/libmesosphere/source/kern_k_scheduler.cpp @@ -231,6 +231,10 @@ namespace ams::kern { next_thread = m_idle_thread; } + if (next_thread->GetCurrentCore() != m_core_id) { + next_thread->SetCurrentCore(m_core_id); + } + /* If we're not actually switching thread, there's nothing to do. */ if (next_thread == cur_thread) { return; @@ -263,10 +267,6 @@ namespace ams::kern { MESOSPHERE_KTRACE_THREAD_SWITCH(next_thread); - if (next_thread->GetCurrentCore() != m_core_id) { - next_thread->SetCurrentCore(m_core_id); - } - /* Switch the current process, if we're switching processes. */ if (KProcess *next_process = next_thread->GetOwnerProcess(); next_process != cur_process) { KProcess::Switch(cur_process, next_process); diff --git a/mesosphere/kernel/source/arch/arm64/kern_k_scheduler_asm.s b/mesosphere/kernel/source/arch/arm64/kern_k_scheduler_asm.s index e19400650..ac5ebc64c 100644 --- a/mesosphere/kernel/source/arch/arm64/kern_k_scheduler_asm.s +++ b/mesosphere/kernel/source/arch/arm64/kern_k_scheduler_asm.s @@ -136,8 +136,7 @@ _ZN3ams4kern10KScheduler12ScheduleImplEv: /* Check if the highest priority thread is the same as the current thread. */ ldr x7, [x1, #(KSCHEDULER_HIGHEST_PRIORITY_THREAD)] - ldr x2, [x18] - cmp x7, x2 + cmp x7, x18 b.ne 1f /* If they're the same, then we can just return as there's nothing to do. */