kern: SvcUnmapPhysicalMemory, cleanup thread pinning

This commit is contained in:
Michael Scire 2020-07-24 15:44:16 -07:00 committed by SciresM
parent cbecda2a27
commit 1b9acc4a6a
10 changed files with 248 additions and 24 deletions

View file

@ -30,6 +30,7 @@ namespace ams::kern {
KInterruptTaskManager *interrupt_task_manager;
s32 core_id;
void *exception_stack_top;
ams::svc::ThreadLocalRegion *tlr;
};
static_assert(std::is_standard_layout<KCurrentContext>::value && std::is_trivially_destructible<KCurrentContext>::value);
static_assert(sizeof(KCurrentContext) <= cpu::DataCacheLineSize);
@ -80,6 +81,10 @@ namespace ams::kern {
return impl::GetCurrentContext().core_id;
}
ALWAYS_INLINE ams::svc::ThreadLocalRegion *GetCurrentThreadLocalRegion() {
return impl::GetCurrentContext().tlr;
}
ALWAYS_INLINE void SetCurrentThread(KThread *new_thread) {
impl::GetCurrentContext().current_thread = new_thread;
}
@ -88,4 +93,8 @@ namespace ams::kern {
impl::GetCurrentContext().current_process = new_process;
}
ALWAYS_INLINE void SetCurrentThreadLocalRegion(void *address) {
impl::GetCurrentContext().tlr = static_cast<ams::svc::ThreadLocalRegion *>(address);
}
}