feat(libkernel): export sceKernelGetResidentFmemCount #16243

Merged
NevesHenry merged 1 commit from upstream-pr/16243 into main 2026-11-09 04:47:58 +00:00
NevesHenry commented 2026-11-05 22:38:36 +00:00 (Migrated from github.com)

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) from libkernel. On main only libkernel_sys declares it, and nothing this title loads on Linux needs libkernel_sys.prx, so the dynamic loader stops before the entry point:

./PPSA99170: symbol lookup error: ./PPSA99170: undefined symbol: a7DM+5cDkAg

tools/audit_dump.py lists it as an import exported only by another library, which resolves on Linux; that holds only when something else loads libkernel_sys.prx. On Windows the kernel-family search from #12430 should find the libkernel_sys stub. I didn't run it there.

Change:

  • The declaration moves from libkernel_sys to libkernel, 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's sceKernelProtectDirectMemoryForPID.
  • docs/dev/debt/libkernel.md gets an entry with what the title's console notes say: two counts in 16 KiB pages for any pid, resident and mapped, and 0x8002000e with neither written when the second pointer is null.
  • New test guest_kernel_resident_fmem_export: it loads libkernel.prx from 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.zip from mihawk-99/PS5_MihawkOS, SHA-256 de97e45f807991d11fa008e179335ee2dd8695275450302a1f920d4a35428b55, the same as in the homebrew catalog. I converted it with the relinker's default flags (as tools/title_run.py does) and ran it for 40 s under Xvfb in a container with no network, without input, 3 runs each. main e647fe16fd still declares the function only in libkernel_sys.

main dd6efc7f0c This change on dd6efc7f0c
Stop undefined symbol: a7DM+5cDkAg, exit 127, before the entry point (3/3) the shader below, exit 134 (3/3)
Title log nothing webui: listening on port 6767, launcher UI: 30 themes, active=gloss, then the 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 on main.

  • ctest -R guest_kernel_resident_fmem_export: 2/2 pass. With the four library files from main and the test kept, both fail: libkernel.prx does not export sceKernelGetResidentFmemCount and libkernel.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 on dd6efc7f0c). After the rebase onto e647fe16fd (9b352fe820), guest_kernel_resident_fmem_export, _patched, guest_direct_memory_for_app and guest_kernel_sys pass again.
  • tools/progress.py --module: libkernel 703 of 759 (from 703 of 758) and libkernel_sys 160 of 825 (from 160 of 826); the stub moved, nothing was implemented.
  • tools/check_conventions.py passes.
  • Windows and macOS: not built.
  • Overlap: no open PR mentions sceKernelGetResidentFmemCount. tools/pr_overlap.py needs 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 into main one by one: each one merges or conflicts in the same files with both, so this branch adds no conflict.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA99170 #13543
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

AI disclosure: this change and description were written with Claude Code.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5179789964 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16243). Originally posted by [NevesHenry](https://github.com/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`) from `libkernel`. On `main` only `libkernel_sys` declares it, and nothing this title loads on Linux needs `libkernel_sys.prx`, so the dynamic loader stops before the entry point: ``` ./PPSA99170: symbol lookup error: ./PPSA99170: undefined symbol: a7DM+5cDkAg ``` `tools/audit_dump.py` lists it as an import exported only by another library, which resolves on Linux; that holds only when something else loads `libkernel_sys.prx`. On Windows the kernel-family search from #12430 should find the `libkernel_sys` stub. I didn't run it there. Change: - The declaration moves from `libkernel_sys` to `libkernel`, 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`](https://github.com/mihawk-99/PS5_MihawkOS/blob/bc24d44be95f1c26ce297c0463f3bb31a751434a/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's `sceKernelProtectDirectMemoryForPID`. - `docs/dev/debt/libkernel.md` gets an entry with what the title's console notes say: two counts in 16 KiB pages for any pid, resident and mapped, and `0x8002000e` with neither written when the second pointer is null. - New test `guest_kernel_resident_fmem_export`: it loads `libkernel.prx` from 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.zip` from [mihawk-99/PS5_MihawkOS](https://github.com/mihawk-99/PS5_MihawkOS/releases/tag/v8.1.0-alpha-8), SHA-256 `de97e45f807991d11fa008e179335ee2dd8695275450302a1f920d4a35428b55`, the same as in the homebrew catalog. I converted it with the relinker's default flags (as `tools/title_run.py` does) and ran it for 40 s under Xvfb in a container with no network, without input, 3 runs each. `main` e647fe16fd still declares the function only in `libkernel_sys`. | | `main` dd6efc7f0c | This change on dd6efc7f0c | |---|---|---| | Stop | `undefined symbol: a7DM+5cDkAg`, exit 127, before the entry point (3/3) | the shader below, exit 134 (3/3) | | Title log | nothing | `webui: listening on port 6767`, `launcher UI: 30 themes, active=gloss`, then `the 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 on `main`. - `ctest -R guest_kernel_resident_fmem_export`: 2/2 pass. With the four library files from `main` and the test kept, both fail: `libkernel.prx does not export sceKernelGetResidentFmemCount` and `libkernel.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 on dd6efc7f0c). After the rebase onto e647fe16fd (9b352fe820), `guest_kernel_resident_fmem_export`, `_patched`, `guest_direct_memory_for_app` and `guest_kernel_sys` pass again. - `tools/progress.py --module`: `libkernel` 703 of 759 (from 703 of 758) and `libkernel_sys` 160 of 825 (from 160 of 826); the stub moved, nothing was implemented. - `tools/check_conventions.py` passes. - Windows and macOS: not built. - Overlap: no open PR mentions `sceKernelGetResidentFmemCount`. `tools/pr_overlap.py` needs 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 into `main` one by one: each one merges or conflicts in the same files with both, so this branch adds no conflict. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA99170 #13543 - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) AI disclosure: this change and description were written with Claude Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gabichuuuuu commented 2026-11-07 23:27:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-07T23:27:13Z.

Review: COMMENTED


Read 9b352fe820 against main.

Correctness. a7DM+5cDkAg is the NID of sceKernelGetResidentFmemCount, so the patched test resolves the right symbol, and the stub still calls NotImplemented_nid_no_patch, so nothing made up is reported. Moving the stub rather than duplicating it follows #12826 for sceKernelProtectDirectMemoryForPID. An import from libkernel_sys still resolves: on Windows WindowsImportBuilder.cpp:59-63 adds all three kernel-family modules whenever any of them is needed, and on Linux libkernel_sys.prx links libkernel (core/libs/CMakeLists.txt:183), so libkernel.prx is 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 from core/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 in core/libs/CMakeLists.txt (around :1398).

Tests. Both new tests fail on main with "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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5815554978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16243#pullrequestreview-5815554978). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-07T23:27:13Z. **Review:** COMMENTED --- Read `9b352fe820` against `main`. **Correctness.** `a7DM+5cDkAg` is the NID of `sceKernelGetResidentFmemCount`, so the patched test resolves the right symbol, and the stub still calls `NotImplemented_nid_no_patch`, so nothing made up is reported. Moving the stub rather than duplicating it follows #12826 for `sceKernelProtectDirectMemoryForPID`. An import from `libkernel_sys` still resolves: on Windows `WindowsImportBuilder.cpp:59-63` adds all three kernel-family modules whenever any of them is needed, and on Linux `libkernel_sys.prx` links `libkernel` (`core/libs/CMakeLists.txt:183`), so `libkernel.prx` is 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 from `core/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 in `core/libs/CMakeLists.txt` (around :1398). **Tests.** Both new tests fail on `main` with "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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!16243
No description provided.