kern: write cpu tick differential to tls +0x108 on thread switch

This commit is contained in:
Michael Scire authored and SciresM committed 2025-11-15 12:31:07 -07:00
1 parent 18bb1fdea0
commit e36051359c
3 files changed
+13 -3

No files matched your search

@@ -270,7 +270,13 @@ namespace ams::kern {
m_current_thread = next_thread;
/* Set the new Thread Local region. */
cpu::SwitchThreadLocalRegion(GetInteger(next_thread->GetThreadLocalRegionAddress()));
const auto tls_address = GetInteger(next_thread->GetThreadLocalRegionAddress());
cpu::SwitchThreadLocalRegion(tls_address);
/* Update the thread's cpu time differential in TLS, if relevant. */
if (tls_address != 0) {
static_cast<ams::svc::ThreadLocalRegion *>(next_thread->GetThreadLocalRegionHeapAddress())->thread_cpu_time = next_thread->GetCpuTime() - cur_tick;
}
}
void KScheduler::ClearPreviousThread(KThread *thread) {