feat(libkernel): record APR memory protection and remap commands #4244
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4244"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T02:10:51Z.
What
Carries Dextroid17's single commit from #4214, preserving the original commit author. Adds the missing libkernel recorders for
sceKernelWriteModifyMtypeProtectCommandandsceKernelWriteRemapIntoPrtCommand. They validate the guest range/protection arguments and append the existing APR command structures and opcodes that libkernel already executes. The remap recorder retains the established default opcode value when the caller supplies zero.The regression cases are added to
GuestAmpr.cpp. Open #4207 also edits this test file for separate libSceAmpr functions; the current PR heads merge cleanly, and this PR has no dependency on it. The other absent exports mentioned in #4214 are outside this change.Tested
Linux x86-64, GCC 12.2, Release/Ninja:
guest_ampr_testsand its dependencies successfully./tmp/AnyPS5-4214-build/tests/guest_ampr_tests: passed (exit 0), including the new recorder checks.ctest -R '^guest_ampr$'found no registered tests in this build configuration; the built test executable was run directly.tools/check_conventions.py --base upstream/main --head HEAD: passed.git diff --check upstream/main...HEAD: passed.Checklist
main; no other open PR implements these two exportsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (n/a).mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T02:11:16Z.
Progress report (
ceb342b→7a3e7b1)📈 System libraries: 86.48% (+0.01%, +2 implemented functions)
✅ 2 implemented
sceKernelWriteModifyMtypeProtectCommandsceKernelWriteRemapIntoPrtCommandImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T03:25:00Z.
Thanks for carrying this — it is my commit from #4214, and the title behind it is Trails in the Sky 2nd Chapter (PPSA35169, 01.003.000). Two details from my run of it that may be useful here:
guest_ampr_markers(core/libs/prx/libSceAmpr/CMakeLists.txt), notguest_ampr— the newTestKernelAmmRecorders()cases run under it, alongsideguest_ampr_threads. An anchoredctest -R '^guest_ampr$'matches neither, which is what your run saw, andctest -N | grep -i amprlists them.ctestof the branch pass here (Linux, CachyOS, GCC 16.2.1, Release), and with this change plus the twolibSceAmprexports of the same set the title clears the wall in #4214 and reaches its Vulkan device, swapchain, save data and 16 game threads (measured); the next stop is the unrelated NGS2 audio wall filed as #4246.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-12T05:20:37Z.
Since #4258 was closed as a duplicate of this PR, here is my note from there again, because it applies here too: on the console these two are the libkernel writers that libSceAmpr's AMM command buffer calls, not recorders into a
CommandBufferObject. drakmor/ampr_emu hooks them as(void* dst, va, size, type, prot, protMask, uint64_t* outSize)and(uint32_t* dst, va, remapVa, size, prot, opcode, uint64_t* outSize). libSceAmpr calls each one twice: first withdst = nullptrto get the size, then to write (L327-L403). With theCommandBufferObject*form, the size call returnsEINVAL, and the write call reads itsbase/size/offsetout of the title's raw buffer bytes.#4266 (ducloc080202) already uses the raw-destination form with
outSize, so maintainers may want to compare the two before merging either.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T07:36:42Z.
Closing in favour of #4266. These two take a raw destination and an
outSize, like the othersceKernelWrite*Commandwriters (ampr_emu hook targets), and are called with a null destination to measure. WithApr::CommandBufferObject*that call returnsEINVAL, and the write call would readbase/size/offsetout of the title's buffer.Pull request closed