Repository navigation
feat(libkernel): implement sceKernelGetModuleInfoFromAddr on Windows - #1188
adriadam10 merged 2 commits into
Conversation
2a385ad to
17a59d7
Compare
Read the module layout from the PE image that holds the address. A relinked image reports its .elf sections as segments and the eh_frame_hdr recorded in .ehmeta; any other image reports its sections with memory access and its .ehfram section. The eh_frame_hdr and eh_frame helpers are shared with the Linux path, and the guest module info test now also runs on Windows. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
17a59d7 to
77ef75c
Compare
|
Rebased onto main. Since #1188 was opened, Should this be a follow up PR or should i do the work here? @adriadam10 @oneandonlydean |
|
Here, please. Move the |
…alls sceKernelGetModuleInfoForUnwind and sceKernelGetModuleInfoFromAddr each parsed .ehmeta and the eh_frame_hdr it names. Both now read them through Module/EhFrame.hpp, so a bad table fails the same way in both: an eh_frame_hdr version other than 1, an indirect or non-absptr/pcrel encoding, a 64-bit record length or anything outside the image throws. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JkiyF6p7oDAaTtVe8ci5zP
|
@oneandonlydean Done in 9abc931. Both Both calls now throw on the same bad tables: a version other than 1, an indirect or non-absptr/pcrel encoding, a 64-bit record length, or anything outside the image. What changes per call:
Tested: |
|
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.
|
|
Checked on Linux (merged onto current main): build and full ctest green (522/522, |
What
sceKernelGetModuleInfoFromAddrwas not implemented on Windows: it calledNotImplemented_nid_no_patch, so any title whoselibc.prxasks which module an address belongs to aborted at startup.On Windows the module is now the PE image that holds the address (
VirtualQuery,MEM_IMAGE):.guest.prx, as on LinuxsceKernelLoadStartModulehandle from the dynamic loader, otherwise a stable id from the same range (ModuleIdForImage_nid_no_patch, as on Linux).elfNsections (the ELF load pages); for any other image, its first 4 sections with memory access. Protection comes from the section characteristics.ehmeta, with its size computed from the header encodings and table; for a host image, the.ehframsection thatconfigure_windows_unwindproduces, without an eh_frame_hdrinit_proc_addrandfini_proc_addrstay 0;ref_countis 1. Addresses outside any image returnSCE_KERNEL_ERROR_ESRCHThe eh_frame_hdr/eh_frame decoding (pointer encodings, record walk) is shared between the Linux and Windows paths instead of being duplicated. The Linux path behaves the same, and its eh_frame_ptr decoding now accepts every standard encoding instead of only
0x1b,0x03and0x00.guest_module_infonow runs on Windows too. The fixture and test binary go throughconfigure_windows_unwind, and only the eh_frame_hdr check stays Linux-only. The TechnicalDebt entry describes the Windows behaviour instead of saying "Not implemented on Windows".Tested
guest_module_infoandguest_dynamic_loaderpasstools/check_conventions.py --base mainpassesChecklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs).mdfiles or images added to the repository (attach them to this PR)