From a68798225a02b8aa1fced1e52c8bca7982a07722 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 14 Apr 2013 12:52:56 -0700 Subject: [PATCH] Give ThreadManForUser_8DAFF657 and friends a name. Calling allocate on the same thread gives the same ptr, but on a different one it waits or returns a new ptr. Let's call it thread local storage for now. --- Core/HLE/sceKernel.cpp | 11 +++++++++-- Core/HLE/sceKernelInterrupt.cpp | 3 ++- Core/HLE/sceKernelMemory.cpp | 24 ++++++++++++++++++------ Core/HLE/sceKernelMemory.h | 8 +++++--- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 09523d8f1d..bee9bab094 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -779,8 +779,15 @@ const HLEFunction ThreadManForUser[] = {0xd8b299ae,WrapU_UUUU,"sceKernelSetVTimerHandler"}, {0x53B00E9A,WrapU_UU64UU,"sceKernelSetVTimerHandlerWide"}, - {0x8daff657,WrapI_CUUUUU,"ThreadManForUser_8DAFF657"}, - {0x32bf938e,WrapI_I,"ThreadManForUser_32BF938E"}, + // Names are just guesses, not correct. + {0x8daff657,WrapI_CUUUUU, "sceKernelCreateTls"}, + {0x32bf938e,WrapI_I, "sceKernelDeleteTls"}, + {0x721067F3,WrapI_IU, "sceKernelReferTlsStatus"}, + // Not completely certain about args. + {0x4A719FB2,WrapI_I, "sceKernelFreeTls"}, + // Probably internal, not sure. Takes (uid, &addr) as parameters... probably. + //{0x65F54FFB,0, "_sceKernelAllocateTls"}, + // NOTE: sceKernelAllocateTls is in Kernel_Library, see sceKernelInterrupt.cpp. // Not sure if these should be hooked up. See below. {0x0E927AED, _sceKernelReturnFromTimerHandler, "_sceKernelReturnFromTimerHandler"}, diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index e026962fc9..540275b89a 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -575,7 +575,8 @@ const HLEFunction Kernel_Library[] = {0x293b45b8,WrapI_V, "sceKernelGetThreadId"}, {0xD13BDE95,WrapI_V, "sceKernelCheckThreadStack"}, {0x1839852A,WrapU_UUU, "sce_paf_private_memcpy"}, - {0xfa835cde,WrapI_I, "Kernel_Library_FA835CDE"}, + // Name is only a guess. + {0xfa835cde,WrapI_I, "sceKernelAllocateTls"}, }; void Register_Kernel_Library() diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index c72cd92d85..f829cfbb0a 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -1175,28 +1175,40 @@ u32 GetMemoryBlockPtr(u32 uid, u32 addr) { // These aren't really in sysmem, but they are memory related? -SceUID ThreadManForUser_8DAFF657(const char *name, u32 partitionid, u32 attr, u32 size, u32 count, u32 optionsPtr) +SceUID sceKernelCreateTls(const char *name, u32 partitionid, u32 attr, u32 size, u32 count, u32 optionsPtr) { u32 totalSize = size * count; u32 blockPtr = userMemory.Alloc(totalSize, (attr & 0x4000) != 0, name); userMemory.ListBlocks(); - ERROR_LOG(HLE, "UNIMPL %08x=ThreadManForUser_8DAFF657(%s, %d, %08x, %d, %d, %08x)", blockPtr, name, partitionid, attr, size, count, optionsPtr); + ERROR_LOG(HLE, "UNIMPL %08x=sceKernelCreateTls(%s, %d, %08x, %d, %d, %08x)", blockPtr, name, partitionid, attr, size, count, optionsPtr); return blockPtr; } -int ThreadManForUser_32BF938E(SceUID uid) +int sceKernelDeleteTls(SceUID uid) { - ERROR_LOG(HLE, "UNIMPL ThreadManForUser_32BF938E(%08x)", uid); + ERROR_LOG(HLE, "UNIMPL sceKernelDeleteTls(%08x)", uid); userMemory.Free(uid); return 0; } -int Kernel_Library_FA835CDE(SceUID uid) +int sceKernelAllocateTls(SceUID uid) { - ERROR_LOG(HLE, "UNIMPL Kernel_Library_FA835CDE(%08x)", uid); + ERROR_LOG(HLE, "UNIMPL sceKernelAllocateTls(%08x)", uid); return uid; } +int sceKernelFreeTls(SceUID uid) +{ + ERROR_LOG(HLE, "UNIMPL sceKernelFreeTls(%08x)", uid); + return 0; +} + +int sceKernelReferTlsStatus(SceUID uid, u32 infoPtr) +{ + ERROR_LOG(HLE, "UNIMPL sceKernelReferTlsStatus(%08x, %08x)", uid, infoPtr); + return 0; +} + const HLEFunction SysMemUserForUser[] = { {0xA291F107,sceKernelMaxFreeMemSize,"sceKernelMaxFreeMemSize"}, {0xF919F628,sceKernelTotalFreeMemSize,"sceKernelTotalFreeMemSize"}, diff --git a/Core/HLE/sceKernelMemory.h b/Core/HLE/sceKernelMemory.h index 7c843c6928..91c9dcaa81 100644 --- a/Core/HLE/sceKernelMemory.h +++ b/Core/HLE/sceKernelMemory.h @@ -56,8 +56,10 @@ void sceKernelReferFplStatus(); int sceKernelGetCompiledSdkVersion(); -SceUID ThreadManForUser_8DAFF657(const char *name, u32 partitionid, u32 attr, u32 size, u32 count, u32 optionsPtr); -int ThreadManForUser_32BF938E(SceUID uid); -int Kernel_Library_FA835CDE(SceUID uid); +SceUID sceKernelCreateTls(const char *name, u32 partitionid, u32 attr, u32 size, u32 count, u32 optionsPtr); +int sceKernelDeleteTls(SceUID uid); +int sceKernelAllocateTls(SceUID uid); +int sceKernelFreeTls(SceUID uid); +int sceKernelReferTlsStatus(SceUID uid, u32 infoPtr); void Register_SysMemUserForUser();