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.
This commit is contained in:
Unknown W. Brackets 2013-04-14 12:52:56 -07:00
parent 88b8df7b7b
commit a68798225a
4 changed files with 34 additions and 12 deletions

View File

@ -779,8 +779,15 @@ const HLEFunction ThreadManForUser[] =
{0xd8b299ae,WrapU_UUUU<sceKernelSetVTimerHandler>,"sceKernelSetVTimerHandler"},
{0x53B00E9A,WrapU_UU64UU<sceKernelSetVTimerHandlerWide>,"sceKernelSetVTimerHandlerWide"},
{0x8daff657,WrapI_CUUUUU<ThreadManForUser_8DAFF657>,"ThreadManForUser_8DAFF657"},
{0x32bf938e,WrapI_I<ThreadManForUser_32BF938E>,"ThreadManForUser_32BF938E"},
// Names are just guesses, not correct.
{0x8daff657,WrapI_CUUUUU<sceKernelCreateTls>, "sceKernelCreateTls"},
{0x32bf938e,WrapI_I<sceKernelDeleteTls>, "sceKernelDeleteTls"},
{0x721067F3,WrapI_IU<sceKernelReferTlsStatus>, "sceKernelReferTlsStatus"},
// Not completely certain about args.
{0x4A719FB2,WrapI_I<sceKernelFreeTls>, "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"},

View File

@ -575,7 +575,8 @@ const HLEFunction Kernel_Library[] =
{0x293b45b8,WrapI_V<sceKernelGetThreadId>, "sceKernelGetThreadId"},
{0xD13BDE95,WrapI_V<sceKernelCheckThreadStack>, "sceKernelCheckThreadStack"},
{0x1839852A,WrapU_UUU<sceKernelMemcpy>, "sce_paf_private_memcpy"},
{0xfa835cde,WrapI_I<Kernel_Library_FA835CDE>, "Kernel_Library_FA835CDE"},
// Name is only a guess.
{0xfa835cde,WrapI_I<sceKernelAllocateTls>, "sceKernelAllocateTls"},
};
void Register_Kernel_Library()

View File

@ -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"},

View File

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