Kernel waits: Fix VPL/FPL and msgpipe waits around callbacks, report timeout left

Verified against pspautotests threads/callbacks/waittypes:

- __KernelThreadingInit() cleared the wait type callback table after
  __KernelMemoryInit() had registered VPL and FPL in it, so a VPL or FPL
  wait interrupted by a callback was never paused or resumed, and could
  hang forever.
- A msgpipe deleted during a callback left its waiter waiting, instead
  of waking it with WAIT_DELETE.
- A wait that got its object during a callback reported no time left;
  put the timer back before trying to unlock, so the unlock writes what
  remains.

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-28 15:59:25 -06:00
1 parent acd2738b7a
commit 24b41d3f23
3 files changed
+21 -10

No files matched your search

+2 -1
View File
@@ -782,7 +782,8 @@ void __KernelThreadingInit() {
u32 blockSize = sizeof(idleThreadCode) + ARRAY_SIZE(threadHacks) * 2 * 4; // The thread code above plus 8 bytes per "hack"
dispatchEnabled = true;
memset(waitTypeFuncs, 0, sizeof(waitTypeFuncs));
// Don't clear waitTypeFuncs here: __KernelMemoryInit() registers VPL and FPL before this runs.
// Every entry is set again by its module's init anyway.
__SetCurrentThread(NULL, 0, NULL);
g_inCbCount = 0;