usersystemlib: sceKernelGetTlsAddr NID and doc

This commit is contained in:
Clément G 2014-04-25 21:58:38 +01:00
parent 0fabd9914a
commit 41bd039ab6
5 changed files with 13 additions and 15 deletions

View File

@ -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 */

Binary file not shown.

Binary file not shown.

View File

@ -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)

View File

@ -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;
}