feat(libkernel): implement sceKernelGetModuleList2 and sceKernelGetModuleInfo2 #4544

Merged
poonasor merged 1 commit from upstream-pr/4544 into main 2026-10-12 18:33:09 +00:00
poonasor commented 2026-10-12 15:15:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by poonasor on 2026-10-12T15:15:31Z.


What

A commercial title does not load on current main (c6efe068a); it converts with relinker --windows --module-dir . and stops at start-up:

FAIL: unresolved ELF import QgsKEUfkqMA from libkernel.prx

QgsKEUfkqMA is sceKernelGetModuleInfo2. With it exported the next stop is the same line for ZzzC3ZGVAkc, sceKernelGetModuleList2 (seen on d146ec1b6), so both are here.

They are the title-module variants of sceKernelGetModuleInfo and sceKernelGetModuleList. Source: shadPS4 process.cpp, where sceKernelGetModuleList2 skips system libraries and sceKernelGetModuleInfo2 returns EPERM for one, after the same EFAULT, EINVAL and ESRCH checks.

  • A system library is a loaded .prx image that is not a relinked title module (.guest.prx). The main program and the title's own modules are listed.
  • The existing functions keep their behaviour; the four share two helpers.
  • Not verified on a console; recorded in TechnicalDebt.

Tested

Windows 11, MinGW-w64 GCC 15.2, AMD RX 6700 XT.

  • guest_module_info extended: sceKernelGetModuleList2 returns the main program first and a strict subset of sceKernelGetModuleList; every listed handle gives the same name and segment count through both info calls; every handle only the full list has gives EPERM and leaves the buffer untouched; ENOMEM, EFAULT, EINVAL and ESRCH cases. It does not build on main (the functions are missing) and passes with this change.
  • ctest -R "module|dynamic_loader": 13 of 13 pass.
  • The title: with this change the title loads its modules and starts its threads; it then stops at sceAudioOut2UserGetSupportedAttributes not implemented, which is a separate topic.
  • python tools/check_conventions.py --base origin/main passes.
  • Full ctest on this machine: guest_kernel_sys does not finish (it loops opening file.txt; stopped by hand), guest_filesystem aborts and several agc_driver_* tests crash or fail. None of them touch this code; I did not compare them against a run of main itself.

Not tested: Linux (the link_map name check is untested there), macOS.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4831389297 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4544). Originally posted by [poonasor](https://github.com/poonasor) on 2026-10-12T15:15:31Z. --- ### What A commercial title does not load on current `main` (`c6efe068a`); it converts with `relinker --windows --module-dir .` and stops at start-up: ``` FAIL: unresolved ELF import QgsKEUfkqMA from libkernel.prx ``` `QgsKEUfkqMA` is `sceKernelGetModuleInfo2`. With it exported the next stop is the same line for `ZzzC3ZGVAkc`, `sceKernelGetModuleList2` (seen on `d146ec1b6`), so both are here. They are the title-module variants of `sceKernelGetModuleInfo` and `sceKernelGetModuleList`. Source: [shadPS4 `process.cpp`](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/kernel/process.cpp), where `sceKernelGetModuleList2` skips system libraries and `sceKernelGetModuleInfo2` returns `EPERM` for one, after the same `EFAULT`, `EINVAL` and `ESRCH` checks. - A system library is a loaded `.prx` image that is not a relinked title module (`.guest.prx`). The main program and the title's own modules are listed. - The existing functions keep their behaviour; the four share two helpers. - Not verified on a console; recorded in TechnicalDebt. ### Tested Windows 11, MinGW-w64 GCC 15.2, AMD RX 6700 XT. - `guest_module_info` extended: `sceKernelGetModuleList2` returns the main program first and a strict subset of `sceKernelGetModuleList`; every listed handle gives the same name and segment count through both info calls; every handle only the full list has gives `EPERM` and leaves the buffer untouched; `ENOMEM`, `EFAULT`, `EINVAL` and `ESRCH` cases. It does not build on `main` (the functions are missing) and passes with this change. - `ctest -R "module|dynamic_loader"`: 13 of 13 pass. - The title: with this change the title loads its modules and starts its threads; it then stops at `sceAudioOut2UserGetSupportedAttributes not implemented`, which is a separate topic. - `python tools/check_conventions.py --base origin/main` passes. - Full `ctest` on this machine: `guest_kernel_sys` does not finish (it loops opening `file.txt`; stopped by hand), `guest_filesystem` aborts and several `agc_driver_*` tests crash or fail. None of them touch this code; I did not compare them against a run of `main` itself. Not tested: Linux (the `link_map` name check is untested there), macOS. ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-12 15:15:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T15:15:57Z.


Progress report (d592d54 → 08824f3)

📈 System libraries: 86.34% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libkernel sceKernelGetModuleInfo2
libkernel sceKernelGetModuleList2
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127139325 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4544#issuecomment-6127139325). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T15:15:57Z. --- <!-- progress-report --> ### Progress report (d592d54 → 08824f3) 📈 **System libraries**: 86.34% (+0.01%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libkernel | `sceKernelGetModuleInfo2` | | libkernel | `sceKernelGetModuleList2` | </details>
github-actions[bot] commented 2026-10-12 15:37:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T15:37:28Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4193 core/libs/tests/GuestModuleInfo.cpp L18
#4524 core/libs/tests/GuestModuleInfo.cpp L18
#4566 core/libs/prx/libkernel/Module/src/ModuleInfo.cpp L207-208, L381-398
#4567 core/libs/tests/GuestModuleInfo.cpp L18
docs/dev/TechnicalDebt.md L207
#4599 core/libs/prx/libkernel/Module/src/ModuleInfo.cpp L207-208, L381-398
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127503646 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4544#issuecomment-6127503646). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T15:37:28Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #4193 | `core/libs/tests/GuestModuleInfo.cpp` [L18](https://github.com/boykopovar/AnyPS5/blob/4756c051eff1c702dbfc678ddba314b19770fae6/core/libs/tests/GuestModuleInfo.cpp#L18) | | | | #4524 | `core/libs/tests/GuestModuleInfo.cpp` [L18](https://github.com/boykopovar/AnyPS5/blob/4756c051eff1c702dbfc678ddba314b19770fae6/core/libs/tests/GuestModuleInfo.cpp#L18) | | | | #4566 | `core/libs/prx/libkernel/Module/src/ModuleInfo.cpp` [L207-208](https://github.com/boykopovar/AnyPS5/blob/4756c051eff1c702dbfc678ddba314b19770fae6/core/libs/prx/libkernel/Module/src/ModuleInfo.cpp#L207-L208), [L381-398](https://github.com/boykopovar/AnyPS5/blob/4756c051eff1c702dbfc678ddba314b19770fae6/core/libs/prx/libkernel/Module/src/ModuleInfo.cpp#L381-L398) | | | | #4567 | `core/libs/tests/GuestModuleInfo.cpp` [L18](https://github.com/boykopovar/AnyPS5/blob/4756c051eff1c702dbfc678ddba314b19770fae6/core/libs/tests/GuestModuleInfo.cpp#L18)<br>`docs/dev/TechnicalDebt.md` [L207](https://github.com/boykopovar/AnyPS5/blob/4756c051eff1c702dbfc678ddba314b19770fae6/docs/dev/TechnicalDebt.md#L207) | | | | #4599 | `core/libs/prx/libkernel/Module/src/ModuleInfo.cpp` [L207-208](https://github.com/boykopovar/AnyPS5/blob/4756c051eff1c702dbfc678ddba314b19770fae6/core/libs/prx/libkernel/Module/src/ModuleInfo.cpp#L207-L208), [L381-398](https://github.com/boykopovar/AnyPS5/blob/4756c051eff1c702dbfc678ddba314b19770fae6/core/libs/prx/libkernel/Module/src/ModuleInfo.cpp#L381-L398) | | |
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!4544
No description provided.