feat(libSceAgc): implement static buffers and qwords #8317
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8317"
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 hypermoist on 2026-10-20T09:53:37Z.
What
Implements four absent
libSceAgcexports. The firmware bodies are from the decryptedlibSceAgc.sprx.sceAgcDriverGetReservedDmemForAgc, zeroes its first0x60bytes as six 16-byte slots and checks that the pointer equals0xfe0040000(init code at0xdc90..0xdcd6). This is the same pageLifecycle.cppalready maps asFsTableAddress, where the driver fills slot 0 with the fetch shader table.sceAgcSetStaticBuffer(-pjHhph0ZUc) /sceAgcGetStaticBuffer(OXDc0KCnUhs).(uint32 index, void* buffer). An index above 5 returns0x8a6c000b. Otherwise the call copies 16 bytes to or fromtable + index * 16(vmovups xmmword ptr [rcx + rax]aftershl rax, 4) and returns 0. Firmware also returns0x8a6c002fwhen its init did not get the table. Here the driver maps it on first use or throws, so that path cannot happen.sceAgcSetStaticQword(86rJnbZUpr4) /sceAgcGetStaticQword(NbiQSQ-UL+M).(uint32 index, uint64 value / uint64* value). The call stores or loads at0xfe0040010 + index * 8(movabs rcx, 0xfe0040010; mov qword ptr [rcx + rax*8], rsi) and returns 0. Firmware has no bounds check, and neither does this implementation.docs/dev/debt/libSceAgcDriver.mdno longer says "the other five slots stay zero": slots 1 to 5 are now written by these calls, and staying zero until a title writes them is the console's behaviour.AgcDriverStaticTable_nid_postfix. It is appended toExecution/src/Driver/Lifecycle.cppnext to the existing address constants, and it constructs the driver so the page is mapped.Tested
Linux (CachyOS, GCC, Release). The new
agc_static_buffer_testspasses:0x8a6c000b;+0x10and+0x28, and qword 0 is the first half of static buffer 1;ComputeFsTableCalls.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T09:54:21Z.
Progress report (
eea640a→07ed40b)📈 System libraries: 62.86% (+0.02%, +4 implemented functions)
✅ 4 implemented
sceAgcGetStaticBuffersceAgcGetStaticQwordsceAgcSetStaticBuffersceAgcSetStaticQwordImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T10:20:43Z.
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.
main)docs/dev/debt/libSceAgcDriver.mdL202-203docs/dev/debt/libSceAgcDriver.mdL202-203Some 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.
docs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgc/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgc/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgc/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/Driver.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/include/Driver.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-20T22:04:33Z.
The AGC FS table entry at docs/dev/debt/libSceAgcDriver.md#L190 still ends with "and the other five slots stay zero". This PR makes that untrue. For example,
sceAgcSetStaticBuffer(5, buf)(StaticBuffer.cpp#L25) copiesbufinto slot 5 at 0xF_E0040050.sceAgcSetStaticQword(0, v)(StaticBuffer.cpp#L36) fills the first half of slot 1. The new test checks both writes. The PR description says firmware libSceAgc zeroes all six slots at init (0xdc90..0xdcd6) and that these exports write them. So slots that stay zero until the title writes them are now the modeled console behaviour, not a gap.CONTRIBUTING.md asks a pull request that closes a gap to cut the entry "to what is still open". I'd delete
, and the other five slots stay zeroso the entry ends with: "Sony's routines, which order work before a title'sds_ordered_count, are not modeled."Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T22:05:01Z.
I checked the debt entry at this PR head (
fec563d). It still says “and the other five slots stay zero,” while these new exports write slots 1–5. The suggested edit in the thread is accurate: remove that clause and leave the remaining limitation that Sony’s routines ordering work beforeds_ordered_countare not modeled. The focused test here exercises both a slot-5 buffer write and qword writes into slots 1–2.Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-20T23:12:12Z.
Thanks @nikowolf123 and @MarcZX10. Removed "and the other five slots stay zero" from the AGC FS table entry in
07ed40b7ce. The entry now records only what is still missing: Sony's routines that order work beforeds_ordered_countare not modeled.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T13:34:23Z.
Checked the four exports against the described firmware bodies (index bound 5 with 0x8a6c000b for buffers, qwords at table + 0x10, no bound as in firmware), the table address against
FsTableAddress, the registeredagc_static_buffertest, and the debt entry (stale clause removed in07ed40b); merged.