fix(libSceAgc): make the AGC patch functions validate like their emitters #16194
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16194"
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-11-05T20:36:38Z.
What
Makes the libSceAgc PATCH functions apply the same checks as the command emitters they patch. Each packet fix is followed by its regression test commit.
sceAgcWaitRegMemPatchAddress(commits91d1563b5f,c65ee83001,e343e023db,ff8ea1a23d): applies WriteWait's alignment check (4 bytes for a 32-bit wait, 8 for a 64-bit one; null accepted) and the 48-bit address check. Before, a misaligned address split the wait's low word from the wrapper's, and an address above 2^48 was silently truncated.sceAgcWaitRegMemPatchCompareFunction(ae406e0ca5,d69587fc52): rejects values above 6 as WriteWait does, instead of masking with 7.sceAgcWriteDataPatchSetAddressOrOffset(56118fd82f,e6b5b508be): checks 4-byte alignment for graphics packets only, as WriteData does; the async (compute) variant is unchanged.sceAgcQueueEndOfPipeActionPatchData(2a79c6078d,272c4f251b): a GDS release (data select 5) rejects nonzero data and keeps the offset and size words the emitter encoded (55282e8d46,7970b144fb): an interrupt-only release rejects data and a set address, as the emitter does.Existing tests pinned the old behaviour (the wait-address test used a misaligned address above 2^48, and the comparison loop covered 0 to 255); those assertions were updated in the fix commits. Unsure points: the GDS zero-data patch is written as "keep the encoded words" rather than writing zero, which is what the emitter produces for zero data; I believe this is equivalent but have not confirmed it on hardware. The interrupt-only address check depends on the patch order, since the address patch itself does not check the interrupt select. Open PR 13940 compiles the same Patch sources and is not changed by this PR.
Tested
Run:
python3 tools/check_conventions.py --base upstream/main(passed) andgit diff --check upstream/main(clean).Not yet run: the build and ctest of
agc_command_testsandagc_write_data_patch_tests(build queued under the build lock, not yet run). The negative controls (each fix removed to show its test fails) have not run. Results will be added to this PR once they finish.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