Tlspl partitions: 1-6 in both privilege levels, and document kernel-mode tests

threads/tls/kernel/partition now records the sweep from a kernel module, which settles the range
question the user-mode recording couldn't: privilege changes the permission check, not the range.
Partitions 1, 3 and 4 are ILLEGAL_PERM from user mode and fine from kernel mode, while 7 and up
are ILLEGAL_ARGUMENT either way. So the check goes back to a plain 1-6 for both, and the
kernel-mode carve-out from the last commit - which would have let 8 and 9 through - is gone.

The hardware doc gains a section on kernel-mode tests: what COMMON_KERNEL does, why the stock
crt0 makes a kernel PRX unloadable, which libraries can't be imported, and how much room there
actually is in the kernel partition.
This commit is contained in:
Henrik Rydgård committed 2026-09-08 15:18:02 -06:00
1 parent 705ea7eb02
commit a676eecba7
3 files changed
+54 -12

No files matched your search

+6 -11
View File
@@ -1863,17 +1863,12 @@ SceUID sceKernelCreateTlspl(const char *name, u32 partition, u32 attr, u32 block
return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "invalid name");
if ((attr & ~PSP_TLSPL_ATTR_KNOWN) >= 0x100)
return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr);
// From user mode only 1-6 exist: threads/tls/partition records 7 and up all returning
// ILLEGAL_ARGUMENT on a real PSP, where 1, 3 and 4 fall through to ILLEGAL_PERM below. Note
// this differs from sceKernelCreateVpl above, which does let 8 and 9 reach the permission
// check - the two used to share a range that was only ever right for Vpl.
//
// The kernel-mode range is left as it was, since 8 and 10 map to the user partition for a
// kernel caller and there's no hardware recording from kernel mode to check it against - a
// test PRX built on this suite's common code doesn't fit in the kernel partition alongside
// PSPLink.
const u32 highestPartition = hleIsKernelMode() ? 9 : 6;
if (partition < 1 || partition == 7 || partition > highestPartition)
// Only 1-6 exist, in either privilege level: threads/tls/partition and its kernel-mode twin
// both record 7 and up returning ILLEGAL_ARGUMENT on a real PSP. What the privilege changes
// is the permission check below - 1, 3 and 4 are ILLEGAL_PERM from user mode and fine from
// kernel mode. Note this differs from sceKernelCreateVpl above, which lets 8 and 9 reach the
// permission check; the two used to share a range that was only ever right for Vpl.
if (partition < 1 || partition > 6)
return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", partition);
BlockAllocator *allocator = BlockAllocatorFromID(partition);