From b09d84d1ae86bae26298fc108d243c9e22a3259a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 20 Oct 2026 19:23:41 +0200 Subject: [PATCH] Kernel: A kernel module's threads may have priorities 0x01-0x7E User modules stay at 0x08-0x77. Recorded on a PSP-1000 in the new threads/threads/kernel/priority. ProTrekkr's ME test, a kernel module, creates its audio thread at priority 2. Co-Authored-By: Claude Opus 5.5 (1M context) --- Core/HLE/sceKernelThread.cpp | 5 ++++- pspautotests | 2 +- test.py | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index fd2d2d2cf7..92b21feec2 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -2139,7 +2139,10 @@ int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 WARN_LOG_REPORT(Log::sceKernel, "bogus thread stack size %08x", stacksize); return SCE_KERNEL_ERROR_ILLEGAL_STACK_SIZE; } - if (prio < 0x08 || prio > 0x77) { + // A kernel caller may also use 0x01-0x07 and 0x78-0x7E (threads/threads/kernel/priority). + const u32 minPrio = allowKernel ? 0x01 : 0x08; + const u32 maxPrio = allowKernel ? 0x7E : 0x77; + if (prio < minPrio || prio > maxPrio) { WARN_LOG(Log::sceKernel, "bogus thread priority %08x", prio); return SCE_KERNEL_ERROR_ILLEGAL_PRIORITY; } diff --git a/pspautotests b/pspautotests index 704b88a913..0e251f7c4b 160000 --- a/pspautotests +++ b/pspautotests @@ -1 +1 @@ -Subproject commit 704b88a913311ea6d2beb97cbdd66b2ca5182c72 +Subproject commit 0e251f7c4b12ca461f12de4a608e5acd4463fcc5 diff --git a/test.py b/test.py index 2cc0c7c3b4..c71e10c9bf 100755 --- a/test.py +++ b/test.py @@ -487,6 +487,7 @@ tests_good = [ "threads/tls/create", "threads/tls/partition", "threads/tls/kernel/partition", + "threads/threads/kernel/priority", "threads/tls/delete", "threads/tls/get", "threads/tls/free",