kern: write thread handle to tls +0x110 on creation

This commit is contained in:
Alula
2026-03-17 10:59:11 +01:00
parent 9cc82c6f80
commit 0ee6277be9
4 changed files with 10 additions and 2 deletions

View File

@@ -27,8 +27,9 @@ namespace ams::svc::arch::arm {
volatile u16 interrupt_flag;
volatile u8 cache_maintenance_flag;
volatile s64 thread_cpu_time;
volatile ams::svc::Handle thread_handle;
/* TODO: Should we bother adding the Nintendo aarch32 thread local context here? */
uintptr_t TODO[(0x200 - 0x110) / sizeof(uintptr_t)];
uintptr_t TODO[(0x200 - 0x114) / sizeof(uintptr_t)];
};
ALWAYS_INLINE ThreadLocalRegion *GetThreadLocalRegion() {

View File

@@ -27,8 +27,9 @@ namespace ams::svc::arch::arm64 {
volatile u16 interrupt_flag;
volatile u8 cache_maintenance_flag;
volatile s64 thread_cpu_time;
volatile ams::svc::Handle thread_handle;
/* TODO: How should we handle libnx vs Nintendo user thread local space? */
uintptr_t TODO[(0x200 - 0x110) / sizeof(uintptr_t)];
uintptr_t TODO[(0x200 - 0x114) / sizeof(uintptr_t)];
};
static_assert(__builtin_offsetof(ThreadLocalRegion, disable_count) == 0x100);
static_assert(__builtin_offsetof(ThreadLocalRegion, interrupt_flag) == 0x102);