feat(libkernel): export sceKernelGetResidentFmemCount #16243
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16243"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by NevesHenry on 2026-11-05T22:38:36Z.
What
PS5_MihawkOS (PPSA99170) 8.1.0-alpha-8, the homebrew catalog's release of 2026-11-04 (content version 01.003.000), imports
sceKernelGetResidentFmemCount(a7DM+5cDkAg) fromlibkernel. Onmainonlylibkernel_sysdeclares it, and nothing this title loads on Linux needslibkernel_sys.prx, so the dynamic loader stops before the entry point:tools/audit_dump.pylists it as an import exported only by another library, which resolves on Linux; that holds only when something else loadslibkernel_sys.prx. On Windows the kernel-family search from #12430 should find thelibkernel_sysstub. I didn't run it there.Change:
libkernel_systolibkernel, with the prototype the title declares (int pid, uint64_t* resident, uint64_t* mapped), and it still throws. The title calls it only in its memory helper's census (src/pw_memory_helper.c#L255), which this run doesn't reach, so no value is made up. #12826 did the same for this title'ssceKernelProtectDirectMemoryForPID.docs/dev/debt/libkernel.mdgets an entry with what the title's console notes say: two counts in 16 KiB pages for any pid, resident and mapped, and0x8002000ewith neither written when the second pointer is null.guest_kernel_resident_fmem_export: it loadslibkernel.prxfrom the unpatched and the patched library directories and resolves the export by name and by its NID.Tested
Linux: Ubuntu 24.04 container on WSL2, Ryzen 9 7900, GCC 13.3, Release, llvmpipe (the only Vulkan device here).
Title: MihawkOS 8.1.0-alpha-8,
PS5_MihawkOS-v8.1.0-alpha-8.zipfrom mihawk-99/PS5_MihawkOS, SHA-256de97e45f807991d11fa008e179335ee2dd8695275450302a1f920d4a35428b55, the same as in the homebrew catalog. I converted it with the relinker's default flags (astools/title_run.pydoes) and ran it for 40 s under Xvfb in a container with no network, without input, 3 runs each.maine647fe16fdstill declares the function only inlibkernel_sys.maindd6efc7f0cdd6efc7f0cundefined symbol: a7DM+5cDkAg, exit 127, before the entry point (3/3)webui: listening on port 6767,launcher UI: 30 themes, active=gloss, thenthe payload checklist refuses entry(it needs console payloads, see #13543)After the launcher UI it stops on a shader this host's llvmpipe can't take:
barycentric emulation on the mesh path needs 36864 bytes of mesh output memory, the device allows 32768. Seedee5 (PPSA99142), PSSwanStation (PPSA99248) and Art Swap (PPSA99318) stop on the same line here onmain.ctest -R guest_kernel_resident_fmem_export: 2/2 pass. With the four library files frommainand the test kept, both fail:libkernel.prx does not export sceKernelGetResidentFmemCountandlibkernel.prx does not export a7DM+5cDkAg.ctest -R "kernel|resident|direct_memory|public_headers|progress_|conventions_|patched_libraries|tools_headers|nid_" -E "^agc_": 203/203 pass on c8c35725a9 (the same change ondd6efc7f0c). After the rebase ontoe647fe16fd(9b352fe820),guest_kernel_resident_fmem_export,_patched,guest_direct_memory_for_appandguest_kernel_syspass again.tools/progress.py --module:libkernel703 of 759 (from 703 of 758) andlibkernel_sys160 of 825 (from 160 of 826); the stub moved, nothing was implemented.tools/check_conventions.pypasses.sceKernelGetResidentFmemCount.tools/pr_overlap.pyneeds git 2.38 and this host has 2.34, so I merged the heads of the 155 open PRs that change these files into this branch and intomainone by one: each one merges or conflicts in the same files with both, so this branch adds no conflict.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI disclosure: this change and description were written with Claude Code.
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-07T23:27:13Z.
Review: COMMENTED
Read
9b352fe820againstmain.Correctness.
a7DM+5cDkAgis the NID ofsceKernelGetResidentFmemCount, so the patched test resolves the right symbol, and the stub still callsNotImplemented_nid_no_patch, so nothing made up is reported. Moving the stub rather than duplicating it follows #12826 forsceKernelProtectDirectMemoryForPID. An import fromlibkernel_sysstill resolves: on WindowsWindowsImportBuilder.cpp:59-63adds all three kernel-family modules whenever any of them is needed, and on Linuxlibkernel_sys.prxlinkslibkernel(core/libs/CMakeLists.txt:183), solibkernel.prxis in the global lookup scope.Build note, not blocking.
guest_kernel_resident_fmem_export_libraries(core/libs/prx/libkernel/CMakeLists.txt:139) depends on${PATCHED_DIR}/libkernel.prx, a custom-command OUTPUT created fromcore/libs/CMakeLists.txt. That works with Ninja; with Makefiles a custom-command output from another directory isn't guaranteed to be wired. The other such targets live incore/libs/CMakeLists.txt(around :1398).Tests. Both new tests fail on
mainwith "does not export" and pass with the change; they check that the export exists, not its current refusal. The hosted Linux job is skipped and macOS isn't built, so the evidence is the author's runs.Not run here; this is from reading the code.
AI-assisted: yes.