Merge pull request #22724 from hrydgard/vsh-kernel-fpl

HLE: Resolve the kernel sceKernelAllocateFpl
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2026-10-22 12:09:10 +02:00
commit bf3d9e7388
2 files changed
+19 -14

No files matched your search

+12 -9
View File
@@ -1014,15 +1014,18 @@ const HLEFunction ThreadManForKernel[] =
{0x5F32BEAA, &WrapU_IU<sceKernelReferVTimerStatus>, "sceKernelReferVTimerStatus", 'x', "ix", HLE_KERNEL_SYSCALL },
// Yabause-PSP's me.prx.
{0x30FD48F0, &WrapI_IUUU<sceKernelPollEventFlag>, "sceKernelPollEventFlag", 'i', "ixxp", HLE_KERNEL_SYSCALL },
// NOT added on purpose, even though we implement all four for user mode already:
// sceKernelCreateMutex (0xB7D098C6), sceKernelLockMutex (0xB011B11F), sceKernelUnlockMutex
// (0x6B30100F) and sceKernelAllocateFpl (0xD979E9BF). They are what the real flash0 NAND and
// ID storage drivers use to set themselves up while booting the VSH, and leaving them
// unresolved is load-bearing: the drivers fail their init early and the boot moves on. Resolve
// them and the drivers instead get all the way through to talking to the NAND controller, which
// we don't emulate - sceIdStorage_Service then polls 0xbd101300 forever, no plugin module ever
// starts, and the boot is dead where it used to reach the shell. Adding these needs NAND MMIO
// (or HLE'ing sceIdStorage/sceNand above the driver) to land first.
{0XD979E9BF, &WrapI_IUU<sceKernelAllocateFpl>, "sceKernelAllocateFpl", 'i', "ixx", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED | HLE_KERNEL_SYSCALL },
// HACK WARNING!
//
// NOT added on purpose, even though we implement all three for user mode already:
// sceKernelCreateMutex (0xB7D098C6), sceKernelLockMutex (0xB011B11F) and sceKernelUnlockMutex
// (0x6B30100F). They are what the real flash0 NAND and ID storage drivers use to set themselves
// up while booting the VSH, and leaving them unresolved is load-bearing: the drivers fail their
// init early and the boot moves on. Resolve them and the drivers instead get all the way through
// to talking to the NAND controller, which we don't emulate - sceIdStorage_Service then polls
// 0xbd101300 forever, no plugin module ever starts, and the boot is dead where it used to reach
// the shell. Adding these needs NAND MMIO (or HLE'ing sceIdStorage/sceNand above the driver) to
// land first. sceKernelAllocateFpl (below) was in this list, but the boot reaches the XMB with it.
};
void Register_ThreadManForUser()
+7 -5
View File
@@ -379,11 +379,13 @@ boot *worse*, because a correct implementation lets a real flash0 driver finish
on into hardware PPSSPP does not emulate. Leaving the import unresolved makes the driver fail early
and the boot continues. All three are commented in the source at the point where they'd be added:
- **`ThreadManForKernel` mutex/fpl NIDs** (`0xB7D098C6` `sceKernelCreateMutex`, `0xB011B11F`
`sceKernelLockMutex`, `0x6B30100F` `sceKernelUnlockMutex`, `0xD979E9BF` `sceKernelAllocateFpl`) -
we implement all four for user mode already. Resolve them and the NAND and ID storage drivers
init successfully, then `sceIdStorage_Service` polls the NAND controller at `0xbd101300` forever.
No module starts.
- **`ThreadManForKernel` mutex NIDs** (`0xB7D098C6` `sceKernelCreateMutex`, `0xB011B11F`
`sceKernelLockMutex`, `0x6B30100F` `sceKernelUnlockMutex`) - we implement all three for user
mode already. Resolve them and the NAND and ID storage drivers init successfully, then
`sceIdStorage_Service` polls the NAND controller at `0xbd101300` forever (470k reads in 25
emulated seconds), and only 4 modules start. `sceKernelAllocateFpl` (`0xD979E9BF`) used to be on
this list, but it's the mutexes that do it: with only the FPL resolved, `sceIdStorage_Service`
allocates from its pool and the boot still reaches the XMB.
- **`InterruptManagerForKernel` interrupt registration** (`0x58DD8978`, `0xF987B1F0`, `0x4D6E7305`,
`0xD774BA45`) - JPCSP can honour these because it emulates the interrupt controller as MMIO. We
dispatch the few interrupts we emulate ourselves (`__RegisterIntrHandler`), so success is a lie