feat(libkernel): implement sceKernelGetLibkernelTextLocation #4567

Merged
jagrat04 merged 1 commit from upstream-pr/4567 into main 2026-10-12 20:57:32 +00:00
jagrat04 commented 2026-10-12 15:51:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-12T15:51:11Z.


What

Implements sceKernelGetLibkernelTextLocation (NID AmJ0mn2l4lM) in libkernel. It writes the base address and size of the main executable's primary load segment, following fpPS4's reference implementation. Throws std::invalid_argument on null pointer arguments and verifies segment existence. Adds guest unit tests in GuestModuleInfo.cpp and documents Technical Debt.

Fixes #4560

Tested

ools/check_conventions.py --base origin/main
ools/nid_names.py --nid AmJ0mn2l4lM

Guest unit tests in core/libs/tests/GuestModuleInfo.cpp

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
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4831797495 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4567). Originally posted by [jagrat04](https://github.com/jagrat04) on 2026-10-12T15:51:11Z. --- ### What Implements sceKernelGetLibkernelTextLocation (NID AmJ0mn2l4lM) in libkernel. It writes the base address and size of the main executable\'s primary load segment, following fpPS4\'s reference implementation. Throws std::invalid_argument on null pointer arguments and verifies segment existence. Adds guest unit tests in GuestModuleInfo.cpp and documents Technical Debt. Fixes #4560 ### Tested ools/check_conventions.py --base origin/main ools/nid_names.py --nid AmJ0mn2l4lM Guest unit tests in core/libs/tests/GuestModuleInfo.cpp ### 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 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] Unblocks: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-12 16:03:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T16:03:53Z.


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/prx/libkernel/Module/src/ModuleInfo.cpp L430
core/libs/tests/GuestModuleInfo.cpp L20, L98
#4675 sceKernelGetLibkernelTextLocation_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127942209 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4567#issuecomment-6127942209). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T16:03:53Z. --- <!-- 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/prx/libkernel/Module/src/ModuleInfo.cpp` [L430](https://github.com/boykopovar/AnyPS5/blob/529f7bfd4aa6d54b082d6c27ccaa0c66b74aad08/core/libs/prx/libkernel/Module/src/ModuleInfo.cpp#L430)<br>`core/libs/tests/GuestModuleInfo.cpp` [L20](https://github.com/boykopovar/AnyPS5/blob/529f7bfd4aa6d54b082d6c27ccaa0c66b74aad08/core/libs/tests/GuestModuleInfo.cpp#L20), [L98](https://github.com/boykopovar/AnyPS5/blob/529f7bfd4aa6d54b082d6c27ccaa0c66b74aad08/core/libs/tests/GuestModuleInfo.cpp#L98) | | | | #4675 | | `sceKernelGetLibkernelTextLocation_nid_postfix` | |
github-actions[bot] commented 2026-10-12 16:07:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T16:07:08Z.


Progress report (a60f52e → dbce472)

📈 System libraries: 86.37% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel sceKernelGetLibkernelTextLocation_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127994493 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4567#issuecomment-6127994493). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T16:07:08Z. --- <!-- progress-report --> ### Progress report (a60f52e → dbce472) 📈 **System libraries**: 86.37% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `sceKernelGetLibkernelTextLocation_nid_postfix` | </details>
adriadam10 commented 2026-10-12 20:57:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:57:28Z.


Checked against fpPS4's ps4_sceKernelGetLibkernelTextLocation (first segment of the main program, 0 on success, null arguments rejected): same behaviour. It reuses the sceKernelGetModuleInfo lookup on Linux and Windows, guest_module_info passes and fails to link without the change, and the TechnicalDebt line states what is unverified. Merging.

Note: #4675 implements the same export later than this PR; it will need closing as a duplicate.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132481903 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4567#issuecomment-6132481903). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T20:57:28Z. --- Checked against fpPS4's `ps4_sceKernelGetLibkernelTextLocation` (first segment of the main program, 0 on success, null arguments rejected): same behaviour. It reuses the `sceKernelGetModuleInfo` lookup on Linux and Windows, `guest_module_info` passes and fails to link without the change, and the TechnicalDebt line states what is unverified. Merging. Note: #4675 implements the same export later than this PR; it will need closing as a duplicate.
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!4567
No description provided.