diff --git a/include/usersystemlib_kernel.h b/include/usersystemlib_kernel.h index 8732f55..28a1a61 100644 --- a/include/usersystemlib_kernel.h +++ b/include/usersystemlib_kernel.h @@ -101,13 +101,13 @@ s32 sceKernelGetThreadId(void); s32 sceKernelCheckThreadStack(void); /** - * \fixme Unknown. + * Gets a tls address. * - * @param arg0 Unknown. + * @param uid Unique tls identifier. * * @return A pointer, otherwise NULL on error. */ -void *Kernel_Library_FA835CDE(s32 arg0); +void *sceKernelGetTlsAddr(SceUID uid); /* Lightweight Mutex */ diff --git a/lib/libKernel_Library.a b/lib/libKernel_Library.a index 2fe6fae..67c6ce6 100644 Binary files a/lib/libKernel_Library.a and b/lib/libKernel_Library.a differ diff --git a/lib/libsceGe_lazy.a b/lib/libsceGe_lazy.a index 2e2f631..8346c30 100644 Binary files a/lib/libsceGe_lazy.a and b/lib/libsceGe_lazy.a differ diff --git a/src/usersystemlib/exports.exp b/src/usersystemlib/exports.exp index 06ab84d..cebdc53 100644 --- a/src/usersystemlib/exports.exp +++ b/src/usersystemlib/exports.exp @@ -26,7 +26,7 @@ PSP_EXPORT_FUNC_HASH(sceKernelReferLwMutexStatus) # avoid name collision with ThreadMan PSP_EXPORT_FUNC_NID(_sceKernelCheckThreadStack, 0xD13BDE95) PSP_EXPORT_FUNC_HASH(sceKernelTryLockLwMutex) -PSP_EXPORT_FUNC_NID(Kernel_Library_FA835CDE, 0xFA835CDE) +PSP_EXPORT_FUNC_HASH(sceKernelGetTlsAddr) PSP_EXPORT_END PSP_EXPORT_START(sceGe_lazy, 0x0011, 0x0001) diff --git a/src/usersystemlib/thread.c b/src/usersystemlib/thread.c index 4bef4bc..56b52bb 100644 --- a/src/usersystemlib/thread.c +++ b/src/usersystemlib/thread.c @@ -37,10 +37,11 @@ s32 _sceKernelCheckThreadStack(void) } // Kernel_Library_FA835CDE -void *Kernel_Library_FA835CDE(s32 arg0) +void *sceKernelGetTlsAddr(SceUID uid) { - void *ptr; + void *addr; s32 *k0; + s32 res; // SceThread* ? k0 = (s32*)pspGetK0(); @@ -58,23 +59,20 @@ void *Kernel_Library_FA835CDE(s32 arg0) return NULL; } - if (arg0 < 0) { + if (uid < 0) { return NULL; } // range k0[16-31] - ptr = (void*)k0[((arg0 >> 3) & 0xF) + 16]; + addr = (void*)k0[((uid >> 3) & 0xF) + 16]; - // this is why I think that a pointer is returned - if (ptr == NULL) { // loc_000004FC - s32 ret; + if (addr == NULL) { // loc_000004FC + res = _sceKernelAllocateTlspl(uid, &addr, 0); - ret = _sceKernelAllocateTlspl(arg0, &ptr, 0); - - if (ret < 0) { + if (res < 0) { return NULL; } } - return ptr; + return addr; }