diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index f764ec66ea..3b6883d972 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1791,44 +1791,6 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load module->nm.name[ARRAY_SIZE(module->nm.name) - 1] = '\0'; if (equals(module->nm.name, "vsh_module")) { - // This is likely firmware-version-specific. - // - // vsh_module's SCE_VSH_GRAPHICS thread runs a scan over a small fixed table of - // "alarm task" categories (2 categories, each with a count followed by that many - // 4-byte item IDs). Category 0's data is legitimate, compiled-in content (count=8, - // items 1..8). Category 1's "count" slot, at this fixed offset, holds leftover - // unrelated float-array data instead of a real (small) count - extensive live tracing - // (see docs/VSHBootInvestigation.md, Attempts 17-19) found nothing that ever writes a - // real value here: no HLE syscall, no other loaded module's own init code (including - // the real kd/rtc.prx and kd/syscon.prx drivers), and real hardware/JPCSP running the - // identical bytes never even reaches this code path in the first place (confirmed via - // instrumenting both emulators - JPCSP's equivalent thread never executes the - // PPSSPP-equivalent 0x08818d14 entry point at all, let alone this scan). Whatever - // precondition real firmware relies on to skip or safely handle this scan isn't - // present here, and hasn't been identified despite substantial investigation - so - // zero this specific "count" out directly, matching what an empty/absent category - // would look like (the scan's own code already handles count<=0 as "nothing to do" - // for category 0 the same way). This is a narrow, targeted patch of one 4-byte value - // vsh_module itself never properly initializes, not a general vsh_module patch. - // - // This offset is into rodata rather than at a fixed - // distance from gp, and it moves with the build - so check that what's there is the - // value we identified before overwriting it, rather than writing blind into a firmware - // we haven't looked at. 6.60 and 6.61 ship byte-identical builds of vshmain.prx and - // both have the same float here; anything else is a version this patch wasn't derived - // from, and those don't reach an XMB for other reasons anyway. - const u32 vshAlarmCategory1CountOffset = 0x455C4; // Offset from module base. - const u32 vshAlarmCategory1CountExpected = 0x3F666666; // Leftover 0.9f from a float array. - u32 patchAddr = module->memoryBlockAddr + vshAlarmCategory1CountOffset; - if (!Memory::IsValid4AlignedAddress(patchAddr)) { - WARN_LOG(Log::sceModule, "Failed to patch vsh_module alarm category 1 count"); - } else if (Memory::ReadUnchecked_U32(patchAddr) != vshAlarmCategory1CountExpected) { - WARN_LOG(Log::sceModule, "vsh_module isn't the build the alarm-category patch was derived from (%08x at +%x), leaving it alone", - Memory::ReadUnchecked_U32(patchAddr), vshAlarmCategory1CountOffset); - } else { - Memory::WriteUnchecked_U32(0, patchAddr); - } - ApplyVshHomebrewPatches(module->memoryBlockAddr, module->memoryBlockAddr + module->memoryBlockSize); } diff --git a/docs/VSHBootInvestigation.md b/docs/VSHBootInvestigation.md index 86d99be2c5..f50cb97660 100644 --- a/docs/VSHBootInvestigation.md +++ b/docs/VSHBootInvestigation.md @@ -211,14 +211,12 @@ vshmain.prx has attribute `0000` - Sony only started setting the flag in 1.52 - bootstrap was skipped and the shell ran with none of its support modules loaded. The check also accepts the module *name* `vsh_module` now. -### The vsh_module alarm-category patch only 6.6x needs +### The vsh_module alarm-category patch only 6.6x needed -That offset is in rodata, so there is no gp anchor for it; instead the patch only fires when the -word at `+0x455C4` is the `0x3F666666` it was derived from. On 6.39 that word is a different -float, and on 6.20/6.00 it is ASCII string data (`5f746c75`, `776f6461`) - the old unconditional -write was corrupting a string table on those. Every version below 6.60 reaches the XMB without the -patch, which is itself a hint that whatever precondition makes that scan safe on real hardware was -lost somewhere between 6.39 and 6.60. +6.60 and 6.61 used to crash in vsh_module's alarm-task scan on a "count" in rodata that nothing +initialized, and a patch zeroed it (only when the word was the `0x3F666666` it was derived from). +It was another effect of the start order above: with the shell's modules started in order, 6.60 +and 6.61 reach the XMB without it, and it's gone. ### Kernel modules with per-model builds @@ -319,9 +317,9 @@ had been missed on two earlier passes because it logs as `: error 8002012e` rath address mirrors (`Core/MemMap.cpp`), dummy COP0 instructions (`Core/MIPS/Interpreter.cpp`), and a GPIO + Syscon serial MMIO model (`Core/HW/GpioMMIO.{h,cpp}`) so `kd/syscon.prx`'s real handshake completes instead of spinning. -- **`vsh_module` alarm-task SIGSEGV**: a targeted data patch zeroing an "alarm category count" - field nothing else initializes (`__KernelLoadELFFromPtr`). Symptom patch, not a principled fix - - why real firmware never reaches that path was never established. +- **`vsh_module` alarm-task SIGSEGV**: was a targeted data patch zeroing an "alarm category count" + field nothing else initialized. Removed once the shell's modules started in order, which made + it unnecessary. - **`SCE_KERNEL_ERROR_NO_MEMORY` in the app build**: the 4MB kernel pool was exhausted by PPGe's ~2MB overlay texture (now skipped when booting VSH) plus 11 driver modules each asking for a 256KB thread stack (now given 32KB).