feat(libkernel): declare physhm_open and physhm_unlink #6915

Merged
Nixitov merged 1 commit from upstream-pr/6915 into main 2026-10-19 13:18:42 +00:00
Nixitov commented 2026-10-16 18:00:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Nixitov on 2026-10-16T18:00:02Z.


What

Declare physhm_open and physhm_unlink in libkernel. Forever Launcher (bizkut/ps5-forever, PPSA99030) stops at physhm_open on current main:

FAIL: unresolved ELF import n371J5cP+uo from libkernel.prx

The PS5 physical shared memory API is not documented, and shadPS4's module generator also declares both with no arguments and returns ORBIS_OK, so the no-argument int signature follows shadPS4 and the console's behaviour is unmeasured. The relinker resolves no call site for either in this title, so both are declared as throwing exports (NotImplemented_nid_no_patch) rather than fabricating a handle, like the declaration-only exports already in this file; recorded in docs/dev/debt/libkernel.md.

Tested

Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.

  • Forever Launcher (bizkut/ps5-forever, PPSA99030, v01.000.006), eboot.bin unwrapped and relinked with the built relinker --windows: on current main it stops at n371J5cP+uo (physhm_open); with this change it passes physhm_open and physhm_unlink and stops at b7uXQmnfB2s (sysarch, libkernel), which this PR does not cover.
  • python tools/check_conventions.py --base origin/main passes.

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
  • Unblocks: Forever Launcher (bizkut/ps5-forever, PPSA99030) — removes its current start-up stop; it then stops at sysarch
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4892313163 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6915). Originally posted by [Nixitov](https://github.com/Nixitov) on 2026-10-16T18:00:02Z. --- ### What Declare `physhm_open` and `physhm_unlink` in libkernel. Forever Launcher (`bizkut/ps5-forever`, PPSA99030) stops at `physhm_open` on current `main`: ``` FAIL: unresolved ELF import n371J5cP+uo from libkernel.prx ``` The PS5 physical shared memory API is not documented, and [shadPS4's module generator](https://github.com/shadps4-emu/moduleGenerator/blob/main/libraries/kernel.cpp) also declares both with no arguments and returns `ORBIS_OK`, so the no-argument `int` signature follows shadPS4 and the console's behaviour is unmeasured. The relinker resolves no call site for either in this title, so both are declared as throwing exports (`NotImplemented_nid_no_patch`) rather than fabricating a handle, like the declaration-only exports already in this file; recorded in `docs/dev/debt/libkernel.md`. ### Tested Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. - Forever Launcher (`bizkut/ps5-forever`, PPSA99030, v01.000.006), `eboot.bin` unwrapped and relinked with the built relinker `--windows`: on current `main` it stops at `n371J5cP+uo` (`physhm_open`); with this change it passes `physhm_open` and `physhm_unlink` and stops at `b7uXQmnfB2s` (`sysarch`, libkernel), which this PR does not cover. - `python tools/check_conventions.py --base origin/main` passes. ### 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 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] Unblocks: Forever Launcher (`bizkut/ps5-forever`, PPSA99030) — removes its current start-up stop; it then stops at `sysarch` - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-16 18:00:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T18:00:39Z.


Progress report (134a351 → ce8f328)

📉 System libraries: 91.44% (-0.05%, +2 declared functions)

🆕 2 declared as stubs
Library Name
libkernel physhm_open_nid_postfix
libkernel physhm_unlink_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6221613497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6915#issuecomment-6221613497). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T18:00:39Z. --- <!-- progress-report --> ### Progress report (134a351 → ce8f328) 📉 **System libraries**: 91.44% (-0.05%, +2 declared functions) <details> <summary>🆕 2 declared as stubs</summary> | Library | Name | | - | - | | libkernel | `physhm_open_nid_postfix` | | libkernel | `physhm_unlink_nid_postfix` | </details>
github-actions[bot] commented 2026-10-16 18:44:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T18:44:46Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/libkernel.md
PR 6149 docs/dev/debt/libkernel.md
PR 6446 docs/dev/debt/libkernel.md
PR 6469 docs/dev/debt/libkernel.md
PR 6519 docs/dev/debt/libkernel.md
PR 6740 docs/dev/debt/libkernel.md
PR 6936 docs/dev/debt/libkernel.md
PR 6977 core/libs/prx/libkernel/Unimplemented.cpp
docs/dev/debt/libkernel.md
PR 7049 docs/dev/debt/libkernel.md
PR 7088 docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7121 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 docs/dev/debt/libkernel.md
PR 7299 docs/dev/debt/libkernel.md
PR 7332 docs/dev/debt/libkernel.md
PR 7509 docs/dev/debt/libkernel.md
PR 7554 docs/dev/debt/libkernel.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222383759 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6915#issuecomment-6222383759). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T18:44:46Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `docs/dev/debt/libkernel.md` | | [PR 6149](https://www.github.com/boykopovar/AnyPS5/pull/6149) | `docs/dev/debt/libkernel.md` | | [PR 6446](https://www.github.com/boykopovar/AnyPS5/pull/6446) | `docs/dev/debt/libkernel.md` | | [PR 6469](https://www.github.com/boykopovar/AnyPS5/pull/6469) | `docs/dev/debt/libkernel.md` | | [PR 6519](https://www.github.com/boykopovar/AnyPS5/pull/6519) | `docs/dev/debt/libkernel.md` | | [PR 6740](https://www.github.com/boykopovar/AnyPS5/pull/6740) | `docs/dev/debt/libkernel.md` | | [PR 6936](https://www.github.com/boykopovar/AnyPS5/pull/6936) | `docs/dev/debt/libkernel.md` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libkernel/Unimplemented.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7049](https://www.github.com/boykopovar/AnyPS5/pull/7049) | `docs/dev/debt/libkernel.md` | | [PR 7088](https://www.github.com/boykopovar/AnyPS5/pull/7088) | `docs/dev/debt/libkernel.md` | | [PR 7105](https://www.github.com/boykopovar/AnyPS5/pull/7105) | `docs/dev/debt/libkernel.md` | | [PR 7121](https://www.github.com/boykopovar/AnyPS5/pull/7121) | `docs/dev/debt/libkernel.md` | | [PR 7149](https://www.github.com/boykopovar/AnyPS5/pull/7149) | `docs/dev/debt/libkernel.md` | | [PR 7192](https://www.github.com/boykopovar/AnyPS5/pull/7192) | `docs/dev/debt/libkernel.md` | | [PR 7299](https://www.github.com/boykopovar/AnyPS5/pull/7299) | `docs/dev/debt/libkernel.md` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `docs/dev/debt/libkernel.md` | | [PR 7509](https://www.github.com/boykopovar/AnyPS5/pull/7509) | `docs/dev/debt/libkernel.md` | | [PR 7554](https://www.github.com/boykopovar/AnyPS5/pull/7554) | `docs/dev/debt/libkernel.md` |
milescoviello commented 2026-10-16 20:20:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T20:20:45Z.


A Linux check of Forever Launcher (PPSA99030, 01.000.006, catalog build), Ubuntu 24.04, GCC 13.3, Release, main 1b1f8483c:

  • On main, it stops at load on n371J5cP+uo (physhm_open).
  • With this PR and #6028 (sysarch, your next stop), it gets past both. nm then lists three imports that no library exports: the two libSceSystemService PsmKit exports (cltshBrDLC0, 7cTc7seJLfQ, now #6939) and K1A7IJp5xYc (sceKeyboardSetProcessPrivilege, #6787).
  • With all four merged, 2 of 2 60 s runs load and reach the next stop, sysctl_nid_postfix: unsupported MIB 1.14.32.3 (kern.proc.vmmap).

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223963312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6915#issuecomment-6223963312). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-16T20:20:45Z. --- A Linux check of Forever Launcher (PPSA99030, 01.000.006, catalog build), Ubuntu 24.04, GCC 13.3, Release, `main` 1b1f8483c: - On `main`, it stops at load on `n371J5cP+uo` (`physhm_open`). - With this PR and #6028 (`sysarch`, your next stop), it gets past both. `nm` then lists three imports that no library exports: the two libSceSystemService PsmKit exports (`cltshBrDLC0`, `7cTc7seJLfQ`, now #6939) and `K1A7IJp5xYc` (`sceKeyboardSetProcessPrivilege`, #6787). - With all four merged, 2 of 2 60 s runs load and reach the next stop, `sysctl_nid_postfix: unsupported MIB 1.14.32.3` (kern.proc.vmmap). AI-assisted: yes
milescoviello commented 2026-10-17 10:05:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T10:05:15Z.


An update for the current catalog build of Forever Launcher (PPSA99030, 01.000.012), Linux, main bf20538169:

  • On main it still stops at load on n371J5cP+uo (physhm_open).
  • With this PR, #6028, #6939 and #6787 merged locally, it loads and stops at 0 s on sysctl_nid_postfix: unsupported MIB 1.14.32.3 (kern.proc.vmmap), 2 of 2 runs. I opened #7070 for that.
  • With #7070 as well, its Wine runtime starts (ntdll.so loads and wineboot.exe -i begins), then exits with status 1 when Wine maps its shared user data at 0x7ffe0000, below the guest arena.

One note for whoever merges second: this PR and #6028 both add a declaration at the same place in libkernel/Unimplemented.cpp, so the second one needs a rebase. I'll rebase #6028 if this one goes in first.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232618988 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6915#issuecomment-6232618988). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-17T10:05:15Z. --- An update for the current catalog build of Forever Launcher (PPSA99030, 01.000.012), Linux, `main` bf20538169: - On `main` it still stops at load on `n371J5cP+uo` (`physhm_open`). - With this PR, #6028, #6939 and #6787 merged locally, it loads and stops at 0 s on `sysctl_nid_postfix: unsupported MIB 1.14.32.3` (`kern.proc.vmmap`), 2 of 2 runs. I opened #7070 for that. - With #7070 as well, its Wine runtime starts (`ntdll.so` loads and `wineboot.exe -i` begins), then exits with status 1 when Wine maps its shared user data at 0x7ffe0000, below the guest arena. One note for whoever merges second: this PR and #6028 both add a declaration at the same place in `libkernel/Unimplemented.cpp`, so the second one needs a rebase. I'll rebase #6028 if this one goes in first. AI-assisted: yes (Claude Code)
babyhuey commented 2026-10-18 15:53:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-18T15:53:59Z.


Windows runs of Forever Launcher (PPSA99030, catalog 01.000.012). Windows 11, RTX 3080, WinLibs GCC 15.2, Release, on main e5f18ea99. Plain merges, no conflicts; Unimplemented.cpp merged cleanly. No warnings in Unimplemented.cpp. This PR adds no test, so none was run.

  • main: fails to load (0xC0000139, no window). The Windows loader reports every missing import at once: n371J5cP+uo and AUqJNkobQ1c (libkernel), 7cTc7seJLfQ and cltshBrDLC0 (libSceSystemService), K1A7IJp5xYc (libSceKeyboard).
  • This PR alone (44e9c138f): n371J5cP+uo and AUqJNkobQ1c resolve. It still fails to load on the other three, which #6939 and #6787 provide.
  • With #6939 (f69e6c093), #6787 (cc941b976) and #7070 (5fcb7e8a8) as well (#6028 is already in main), 2 of 2 60 s runs load with every import resolved. Its Wine runtime starts: the psmkit-wine start-up stages all return 0, and wineboot.exe -i begins in /data/forever/prefix. It then exits 1 on err:virtual:virtual_alloc_first_teb wine: failed to map the shared user data: c0000018.

That is the same stop as on Linux: Wine fails to place its shared user data at 0x7ffe0000. A memory trace on Windows shows the guest never asks the emulator for a fixed mapping there: every anonymous map request on this path reaches DoMapAnon with no address and no MAP_FIXED, and each succeeds inside the guest arena. c0000018 is Wine's own result after the page lands elsewhere. (An earlier version of this comment blamed Windows' own KUSER_SHARED_DATA page; the trace doesn't show that.)

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251944225 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6915#issuecomment-6251944225). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-18T15:53:59Z. --- Windows runs of Forever Launcher (PPSA99030, catalog 01.000.012). Windows 11, RTX 3080, WinLibs GCC 15.2, Release, on `main` `e5f18ea99`. Plain merges, no conflicts; `Unimplemented.cpp` merged cleanly. No warnings in `Unimplemented.cpp`. This PR adds no test, so none was run. - `main`: fails to load (`0xC0000139`, no window). The Windows loader reports every missing import at once: `n371J5cP+uo` and `AUqJNkobQ1c` (libkernel), `7cTc7seJLfQ` and `cltshBrDLC0` (libSceSystemService), `K1A7IJp5xYc` (libSceKeyboard). - This PR alone (`44e9c138f`): `n371J5cP+uo` and `AUqJNkobQ1c` resolve. It still fails to load on the other three, which #6939 and #6787 provide. - With #6939 (`f69e6c093`), #6787 (`cc941b976`) and #7070 (`5fcb7e8a8`) as well (#6028 is already in `main`), 2 of 2 60 s runs load with every import resolved. Its Wine runtime starts: the psmkit-wine start-up stages all return 0, and `wineboot.exe -i` begins in `/data/forever/prefix`. It then exits 1 on `err:virtual:virtual_alloc_first_teb wine: failed to map the shared user data: c0000018`. That is the same stop as on Linux: Wine fails to place its shared user data at `0x7ffe0000`. A memory trace on Windows shows the guest never asks the emulator for a fixed mapping there: every anonymous map request on this path reaches `DoMapAnon` with no address and no `MAP_FIXED`, and each succeeds inside the guest arena. `c0000018` is Wine's own result after the page lands elsewhere. (An earlier version of this comment blamed Windows' own `KUSER_SHARED_DATA` page; the trace doesn't show that.) AI-assisted: yes
milescoviello commented 2026-10-19 01:22:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T01:22:12Z.


@babyhuey thanks for the Windows runs, and sorry for the slow answer. That's the same stop I hit on Linux. On Linux it goes away with #6469 (QRMOE, still a draft), which honours a low mapping hint, so Wine's shared user data lands at 0x7ffe0000.

On main with #6915, #6939, #6787, #7070 and #6469, the next stop is sendmsg with SCM_RIGHTS (#7090). After that, Forever Launcher ran the whole 60 s, 2 of 2, on Linux; NOTE_LOWAT (#7092) and sysarch (#7095) are already in main. It then reaches its own prefix setup and Wine exits with 0xC0000135, because the prefix "must be initialized by payload Wine". On Windows, #7090 still refuses SCM_RIGHTS (control data is not supported on Windows), so that's likely the next stop there after #6469.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6257648669 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6915#issuecomment-6257648669). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T01:22:12Z. --- @babyhuey thanks for the Windows runs, and sorry for the slow answer. That's the same stop I hit on Linux. On Linux it goes away with #6469 (QRMOE, still a draft), which honours a low mapping hint, so Wine's shared user data lands at `0x7ffe0000`. On `main` with #6915, #6939, #6787, #7070 and #6469, the next stop is `sendmsg` with `SCM_RIGHTS` (#7090). After that, Forever Launcher ran the whole 60 s, 2 of 2, on Linux; `NOTE_LOWAT` (#7092) and `sysarch` (#7095) are already in `main`. It then reaches its own prefix setup and Wine exits with 0xC0000135, because the prefix "must be initialized by payload Wine". On Windows, #7090 still refuses `SCM_RIGHTS` (`control data is not supported on Windows`), so that's likely the next stop there after #6469. AI-assisted: yes (Claude Code)
adriadam10 commented 2026-10-19 13:19:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T13:19:56Z.


Checked the NIDs against the name table, the throwing-stub pattern used by the neighbouring exports and the debt entry; Linux and Windows runs from @milescoviello and @babyhuey confirm both imports now resolve; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6268202441 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6915#issuecomment-6268202441). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T13:19:56Z. --- Checked the NIDs against the name table, the throwing-stub pattern used by the neighbouring exports and the debt entry; Linux and Windows runs from @milescoviello and @babyhuey confirm both imports now resolve; merged.
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!6915
No description provided.