diff --git a/nx/include/switch/kernel/thread.h b/nx/include/switch/kernel/thread.h index 4a858f6c..2b6c488c 100644 --- a/nx/include/switch/kernel/thread.h +++ b/nx/include/switch/kernel/thread.h @@ -73,3 +73,9 @@ Result threadResume(Thread* t); * @warning Official kernel will not dump x0..x18 if the thread is currently executing a system call, and prior to 6.0.0 doesn't dump TPIDR_EL0. */ Result threadDumpContext(ThreadContext* ctx, Thread* t); + +/** + * @brief Gets the raw handle to the current thread. + * @return The current thread's handle. + */ +Handle threadGetCurHandle(void); diff --git a/nx/source/kernel/thread.c b/nx/source/kernel/thread.c index dabb039d..74c1380a 100644 --- a/nx/source/kernel/thread.c +++ b/nx/source/kernel/thread.c @@ -138,3 +138,7 @@ Result threadResume(Thread* t) { Result threadDumpContext(ThreadContext* ctx, Thread* t) { return svcGetThreadContext3(ctx, t->handle); } + +Handle threadGetCurHandle(void) { + return getThreadVars()->handle; +}