libkernel: sceKernelWriteModifyMtypeProtectCommand and sceKernelWriteRemapIntoPrtCommand are not exported (Trails in the Sky 2nd Chapter, PPSA35169) #4214

Closed
opened 2026-10-12 01:35:14 +00:00 by Dextroid17 · 3 comments
Dextroid17 commented 2026-10-12 01:35:14 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T01:35:14Z.


Trails in the Sky 2nd Chapter (PPSA35169) stops at process start on two missing libkernel exports — sceKernelWriteModifyMtypeProtectCommand and sceKernelWriteRemapIntoPrtCommand

Repro. Relinked and launched PPSA35169 (01.003.000) against a fresh build of current upstream/main (7a84b2226):

./app.elf: symbol lookup error: ./app.elf: undefined symbol: hrEIwWDKm-w

Resolved via the project's own tools/nid_names.py against the zecoxao/sce_symbols database: hrEIwWDKm-w = sceKernelWriteModifyMtypeProtectCommand. The import registry's own audit (tools/import_audit.py) already lists this NID and a sibling, RPAHEYSOt1s = sceKernelWriteRemapIntoPrtCommand, as absent, both against libkernel.prx — so the second one will stop the title at the same point once the first is addressed. Confirmed absent from every library in a from-scratch build of current upstream/main (not inferred from a stale checkout — see below).

What's already there. Apr::Opcode (core/libs/prx/libkernel/Apr/include/AprCommandBuffer.hpp:61-64) already declares AmmModifyMtypeProtect = 24 and AmmRemapIntoPrt = 27, and the command-buffer execution side already handles both (core/libs/prx/libkernel/Apr/src/Apr.cpp:586-600: AmmRemapIntoPrt's case, and AmmModifyMtypeProtect dispatching to _ammProtect reading an AmmProtectCommand). docs/dev/TechnicalDebt.md:127 already documents RemapIntoPrt's semantics (moves a fully-mapped range into a PRT range; opcode argument recorded and ignored) as part of the existing PRT entry.

What's missing is purely the recorder side — the title-facing functions that append an AmmModifyMtypeProtect/AmmRemapIntoPrt command into a CommandBufferObject, the same role libSceAmpr/Export.cpp's existing AppendCommand-based functions play for sibling opcodes (e.g. sceAmprCommandBufferWriteAddressOnCompletion → AppendCommand(buffer, Apr::Opcode::WriteAddress, ...), or the static RecordWriteKernelEventQueue helper for WriteKernelEventQueue). One wrinkle: the two missing exports resolve to libkernel.prx, not libSceAmpr.prx — the header's own comment says the buffer format is "shared between libSceAmpr (which records commands) and libkernel (which executes them)," so a libkernel-side recorder is a new naming surface there; there is no existing sceKernelWrite*Command export in libkernel to pattern-match against today, only the AppendCommand mechanism itself in libSceAmpr/Export.cpp.

Also absent, not yet reached at runtime (same title, same registry, libSceAmpr.prx this time): KqiWXLgCVe0 = sceAmprAmmGetUsageStatsData, touqMEt6qXQ = sceAmprAmmSetPageTablePoolOccupancyNotificationThreshold. Noting them here so whoever picks this up doesn't have to re-run the title to find the next two.

No existing claim found — gh search prs/gh search issues for both resolved names and a source grep for WriteModifyMtypeProtectCommand/WriteRemapIntoPrtCommand all come back empty.

A process note on how this was found, in case it saves someone else the same trip: the title was first run against a local branch ~1,500 commits behind upstream/main, which made this look like it might already be fixed upstream (a different NID on the same title turned out to be exactly that). This report is from a from-scratch build and relink against current upstream/main, specifically to rule that out.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5807114354 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4214). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T01:35:14Z. --- **Trails in the Sky 2nd Chapter (PPSA35169) stops at process start on two missing `libkernel` exports — `sceKernelWriteModifyMtypeProtectCommand` and `sceKernelWriteRemapIntoPrtCommand`** **Repro.** Relinked and launched PPSA35169 (01.003.000) against a fresh build of current `upstream/main` (`7a84b2226`): ``` ./app.elf: symbol lookup error: ./app.elf: undefined symbol: hrEIwWDKm-w ``` Resolved via the project's own `tools/nid_names.py` against the `zecoxao/sce_symbols` database: `hrEIwWDKm-w` = `sceKernelWriteModifyMtypeProtectCommand`. The import registry's own audit (`tools/import_audit.py`) already lists this NID and a sibling, `RPAHEYSOt1s` = `sceKernelWriteRemapIntoPrtCommand`, as `absent`, both against `libkernel.prx` — so the second one will stop the title at the same point once the first is addressed. Confirmed absent from every library in a from-scratch build of current `upstream/main` (not inferred from a stale checkout — see below). **What's already there.** `Apr::Opcode` (`core/libs/prx/libkernel/Apr/include/AprCommandBuffer.hpp:61-64`) already declares `AmmModifyMtypeProtect = 24` and `AmmRemapIntoPrt = 27`, and the command-buffer *execution* side already handles both (`core/libs/prx/libkernel/Apr/src/Apr.cpp:586-600`: `AmmRemapIntoPrt`'s case, and `AmmModifyMtypeProtect` dispatching to `_ammProtect` reading an `AmmProtectCommand`). `docs/dev/TechnicalDebt.md:127` already documents `RemapIntoPrt`'s semantics (moves a fully-mapped range into a PRT range; opcode argument recorded and ignored) as part of the existing PRT entry. **What's missing** is purely the *recorder* side — the title-facing functions that append an `AmmModifyMtypeProtect`/`AmmRemapIntoPrt` command into a `CommandBufferObject`, the same role `libSceAmpr/Export.cpp`'s existing `AppendCommand`-based functions play for sibling opcodes (e.g. `sceAmprCommandBufferWriteAddressOnCompletion` → `AppendCommand(buffer, Apr::Opcode::WriteAddress, ...)`, or the static `RecordWriteKernelEventQueue` helper for `WriteKernelEventQueue`). One wrinkle: the two missing exports resolve to `libkernel.prx`, not `libSceAmpr.prx` — the header's own comment says the buffer format is "shared between libSceAmpr (which records commands) and libkernel (which executes them)," so a `libkernel`-side recorder is a new naming surface there; there is no existing `sceKernelWrite*Command` export in `libkernel` to pattern-match against today, only the `AppendCommand` mechanism itself in `libSceAmpr/Export.cpp`. **Also absent, not yet reached at runtime** (same title, same registry, `libSceAmpr.prx` this time): `KqiWXLgCVe0` = `sceAmprAmmGetUsageStatsData`, `touqMEt6qXQ` = `sceAmprAmmSetPageTablePoolOccupancyNotificationThreshold`. Noting them here so whoever picks this up doesn't have to re-run the title to find the next two. **No existing claim found** — `gh search prs`/`gh search issues` for both resolved names and a source grep for `WriteModifyMtypeProtectCommand`/`WriteRemapIntoPrtCommand` all come back empty. **A process note on how this was found**, in case it saves someone else the same trip: the title was first run against a local branch ~1,500 commits behind `upstream/main`, which made this look like it might already be fixed upstream (a different NID on the same title turned out to be exactly that). This report is from a from-scratch build and relink against current `upstream/main`, specifically to rule that out. Written with AI assistance.
Dextroid17 commented 2026-10-12 02:04:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T02:04:28Z.


Implemented and tested: https://github.com/Dextroid17/AnyPS5/tree/fix/libkernel-write-amm-prt-commands

Both exports mirror the existing, tested libSceAmpr recorders byte-for-byte (same AmmProtectCommand/AmmRemapCommand payloads, same opcodes) — only the libkernel-side export surface was missing. Added TestKernelAmmRecorders() covering success, the reserved-field 1011 default/override, invalid-argument/null-buffer/unbound-buffer rejection, and exact-size-then-busy. Full build + ctest pass.

Not opening a PR since intake is still paused — flagging here so the branch is ready to pick up (or I'll open the PR myself once intake reopens). This clears Trails in the Sky 2nd Chapter past this wall; the title now stops at the next absent import noted above (sceAmprAmmGetUsageStatsData), which needs real research (no existing struct/precedent to reference) before anyone should implement it.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116449486 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4214#issuecomment-6116449486). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T02:04:28Z. --- Implemented and tested: https://github.com/Dextroid17/AnyPS5/tree/fix/libkernel-write-amm-prt-commands Both exports mirror the existing, tested `libSceAmpr` recorders byte-for-byte (same `AmmProtectCommand`/`AmmRemapCommand` payloads, same opcodes) — only the `libkernel`-side export surface was missing. Added `TestKernelAmmRecorders()` covering success, the reserved-field 1011 default/override, invalid-argument/null-buffer/unbound-buffer rejection, and exact-size-then-busy. Full build + `ctest` pass. Not opening a PR since intake is still paused — flagging here so the branch is ready to pick up (or I'll open the PR myself once intake reopens). This clears Trails in the Sky 2nd Chapter past this wall; the title now stops at the next absent import noted above (`sceAmprAmmGetUsageStatsData`), which needs real research (no existing struct/precedent to reference) before anyone should implement it. Written with AI assistance.
Dextroid17 commented 2026-10-12 02:15:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T02:15:11Z.


Also implemented: https://github.com/Dextroid17/AnyPS5/tree/fix/libampr-usage-stats-stubs

sceAmprAmmGetUsageStatsData and sceAmprAmmSetPageTablePoolOccupancyNotificationThreshold (KqiWXLgCVe0/touqMEt6qXQ, libSceAmpr.prx) — the other two absent imports noted above. No reference anywhere describes their real semantics, so both throw via the project's existing NotImplemented_nid_no_patch pattern rather than guessing a result.

With all four fixes applied, PPSA35169 clears this entire wall and gets much further: Vulkan device + swapchain created, save data touched, 16 game threads running. It now stops on an unrelated NGS2 audio wall — filed separately so this issue can close once these four are reviewed.

Not opening PRs since intake is still paused — both branches are ready to pick up.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116547964 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4214#issuecomment-6116547964). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T02:15:11Z. --- Also implemented: https://github.com/Dextroid17/AnyPS5/tree/fix/libampr-usage-stats-stubs `sceAmprAmmGetUsageStatsData` and `sceAmprAmmSetPageTablePoolOccupancyNotificationThreshold` (`KqiWXLgCVe0`/`touqMEt6qXQ`, `libSceAmpr.prx`) — the other two absent imports noted above. No reference anywhere describes their real semantics, so both throw via the project's existing `NotImplemented_nid_no_patch` pattern rather than guessing a result. With all four fixes applied, PPSA35169 clears this entire wall and gets **much** further: Vulkan device + swapchain created, save data touched, 16 game threads running. It now stops on an unrelated NGS2 audio wall — filed separately so this issue can close once these four are reviewed. Not opening PRs since intake is still paused — both branches are ready to pick up. Written with AI assistance.
Dextroid17 commented 2026-10-12 02:15:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T02:15:44Z.


Next wall filed separately: #4246 (NGS2 custom module id 0x20).

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116552951 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4214#issuecomment-6116552951). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T02:15:44Z. --- Next wall filed separately: #4246 (NGS2 custom module id 0x20). Written with AI assistance.
Sign in to join this conversation.
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#4214
No description provided.