Implement _sceKernelAllocateTlspl

This is the syscall usersystemlib's sceKernelGetTlsAddr makes when the
thread's cached TLS address is null, as (uid, &addr, 0). Code that has to
run before usersystemlib.prx is loaded (like plugins built with a Rust SDK)
inlines sceKernelGetTlsAddr and imports this directly.

Shares the allocation with sceKernelGetTlsAddr. A thread waiting on a full
pool stores its address pointer as the wait value, so no state changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-25 10:04:44 -06:00
1 parent 47730e0eb0
commit ac39c55c36
3 files changed
+87 -36

No files matched your search

+3 -2
View File
@@ -884,8 +884,7 @@ const HLEFunction ThreadManForUser[] =
{0X721067F3, &WrapI_IU<sceKernelReferTlsplStatus>, "sceKernelReferTlsplStatus", 'i', "xp" },
// Not completely certain about args.
{0X4A719FB2, &WrapI_I<sceKernelFreeTlspl>, "sceKernelFreeTlspl", 'i', "i" },
// Internal. Takes (uid, &addr) as parameters... probably.
//{0x65F54FFB, nullptr, "_sceKernelAllocateTlspl", 'v', "" },
// _sceKernelAllocateTlspl is added at the end of the table.
// NOTE: sceKernelGetTlsAddr is in Kernel_Library, see sceKernelInterrupt.cpp.
// Not sure if these should be hooked up. See below.
@@ -899,6 +898,8 @@ const HLEFunction ThreadManForUser[] =
{0X91E4F6A7, &WrapU_V<sceKernelLibcClock>, "sceKernelLibcClock", 'x', "" },
{0XB435DEC5, &WrapI_V<sceKernelDcacheWritebackInvalidateAll>, "sceKernelDcacheWritebackInvalidateAll", 'i', "" },
// Internal, the syscall behind sceKernelGetTlsAddr in usersystemlib.
{0x65F54FFB, &WrapI_IUU<_sceKernelAllocateTlspl>, "_sceKernelAllocateTlspl", 'i', "ixx" },
};
const HLEFunction ThreadManForKernel[] =