feat(libSceAgcDriver): answer a null sceAgcDriverGetRegShadowInfo as firmware 13.42 does #14950

Merged
BunnyFl merged 4 commits from upstream-pr/14950 into main 2026-11-08 18:08:54 +00:00
BunnyFl commented 2026-11-02 03:17:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T03:17:44Z.


What

sceAgcDriverGetRegShadowInfo (CP-kVAMmWVw) and sceAgcDriverGetRegShadowInfoAgr (ME1eUot7+Qw) now return 0x8A6D0003 for a null argument, as firmware 13.42's libSceAgcDriver does, before reading anything else. Every other call still throws. The declarations gain the void* info argument the code tests.

The last commit, fbe0cd6e1b, casts the two entries in main's UnsupportedDiagnostics.cpp export-name table to the table's int (APS5_VABI*)(void) type (core/libs/prx/libSceAgcDriver/tests/UnsupportedDiagnostics.cpp:27-28 at fbe0cd6e1b). That table came to main with #11104 after this branch forked, and with the new declarations (core/libs/prx/libSceAgcDriver/include/AgcDriver.hpp:14-15 at fbe0cd6e1b) the merged tree did not compile; adam25136 found it. The table is only used to check that each name resolves: ExportsResolveByName (core/libs/tests/ExportLookup.hpp:20 at fbe0cd6e1b) tests the pointer for null and looks the name up at lines 35-36, and never calls through it.

The other path depends on state AnyPS5 does not model. Each export checks a field of the module's driver context: nonzero returns 0x8A6D0001, zero copies a 0x28-byte register-shadow record into info. The module constructor (an unexported function at 0x7c90) fills that context at load:

  • the field is the low half of a 32-bit value from a call that receives a pointer into the context, apparently a kernel query;
  • the records are filled only when that half is zero, from imported calls.

So the copied data and the gate are not settled by the module alone. sceAgcDriverIsEsvmProcess reads bit 16 of the same queried value (the constructor stores that half with shr $0x10,%eax at 0x7cf1 and the store to [context+0xc] at 0x7cfa), so it keeps throwing too. The debt entry records this so it need not be traced again.

Source: firmware 13.42 libSceAgcDriver.sprx (sha256 78d5ad5fb70cc874b88841035218963a063199c4513607fa8f87242b66b6277b). Read to the return, disassembly only, not measured on a console.

0x3510 sceAgcDriverGetRegShadowInfo (CP-kVAMmWVw)
  test rdi, rdi ; je null
  lea rcx, [context] ; mov eax, 0x8a6d0001 ; cmp dword [rcx+8], 0 ; je copy ; ret
  null: mov eax, 0x8a6d0003 ; ret
  copy: mov rax, [rcx+0x188] ; mov [rdi+0x20], rax ; xor eax, eax
        vmovups ymm0, [rcx+0x168] ; vmovups [rdi], ymm0 ; ret
0x3550 sceAgcDriverGetRegShadowInfoAgr (ME1eUot7+Qw)
  test rdi, rdi ; je null
  lea rcx, [context] ; mov eax, 0x8a6d0001 ; cmp dword [rcx+8], 0 ; je copy ; ret
  null: mov eax, 0x8a6d0003 ; ret
  copy: mov rax, [rcx+0x1b0] ; mov [rdi+0x20], rax ; xor eax, eax
        vmovups ymm0, [rcx+0x190] ; vmovups [rdi], ymm0 ; ret
0x7c90 module constructor (excerpt)
  lea rdi, [context+4] ; lea rsi, [local] ; call 0x8100 ; cmp eax, 1 ; jne fail
  mov eax, [local] ; movzx ecx, ax ; shr eax, 16
  mov [context+8], ecx ; mov [context+0xc], eax
  ...
  mov eax, [context+8] ; test eax, eax ; jne skip
  xor edi, edi ; call 0x690 ; mov [context+0x168], rax ; xor edi, edi ; call 0x6c0 ; mov [context+0x170], eax ; ...

Tested

Windows 11 Pro 10.0.26300, WinLibs GCC, Release, head fbe0cd6e1b (main dd00a9c54e merged in at a08d4c99fc, then the cast):

  • Before the cast, the merged tree reproduces the report: building agc_driver_unsupported_diagnostics_tests stops with the two invalid conversion from 'int (*)(void*)' to 'int (*)()' errors at UnsupportedDiagnostics.cpp:45. With a08d4c99fc's file put back at this head, the same build fails again with those 2 errors.
  • 3 of 3 pass, none Not Run, with both test executables rebuilt at this head: agc_driver_reg_shadow_info, agc_driver_unsupported_diagnostics and public_headers. The libSceAgcDriver library target builds too.
  • Every target that uses the two changed declarations on this tree builds: agc_driver_reg_shadow_info_tests, agc_driver_unsupported_diagnostics_tests and libSceAgcDriver (found by grepping the merged tree for both names and mapping each file to its CMake target).
  • AGC validation run, same machine, this head and main dd00a9c54e: AMD Radeon RX 9070 XT (Windows driver version 32.0.32015.12012, from Win32_VideoController), ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V: this head 3/3 (agc_driver_graphics, agc_driver_unsupported_diagnostics, agc_driver_reg_shadow_info), main 2/2 (the first two; main has no agc_driver_reg_shadow_info). Neither log has the missing-layer message, a VUID- id or a SYNC-HAZARD id.
  • tools/check_conventions.py --base upstream/main on the committed head fbe0cd6e1b: all checks pass. git merge-tree with main dd00a9c54e is clean.

Windows 11, WinLibs GCC 15.2.0 r7, Release, on upstream/main 93dbd0f82a:

  • New agc_driver_reg_shadow_info (tests/RegShadowInfo.cpp, registered in its own tests/cmake fragment) passes. It checks that both exports return 0x8A6D0003 for null.
  • Mutation check: with the null path returning 0x8A6D0001, the test fails.
  • public_headers passes.
  • AGC validation run, same machine, this branch and main 93dbd0f82a: AMD Radeon RX 9070 XT (driver 32.0.32015.7029), Vulkan SDK 1.4.363 validation layer, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V for agc_driver_graphics and agc_driver_unsupported_diagnostics: 2/2 pass on both, none skipped. Neither log has the missing-layer message, a VUID- or a SYNC-HAZARD ID. The new test passes under the same settings with no validation output.
  • python3 tools/check_conventions.py --base upstream/main: all checks pass.
  • python3 tools/pr_overlap.py --branch feat/agcdriver-regshadow-null: no shared exports. The checks first went into UnsupportedDiagnostics.cpp, which #11104 also edits, so they now live in their own file, and this branch merges cleanly with #11104. 35 open PRs that conflict with main share only docs/dev/debt/libSceAgcDriver.md; none of their diffs names these exports.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 9070 XT, Windows 11; driver 32.0.32015.12012 for the run at fbe0cd6e1b, 32.0.32015.7029 for the first run
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5114409977 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14950). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T03:17:44Z. --- ### What `sceAgcDriverGetRegShadowInfo` (`CP-kVAMmWVw`) and `sceAgcDriverGetRegShadowInfoAgr` (`ME1eUot7+Qw`) now return 0x8A6D0003 for a null argument, as firmware 13.42's libSceAgcDriver does, before reading anything else. Every other call still throws. The declarations gain the `void* info` argument the code tests. The last commit, `fbe0cd6e1b`, casts the two entries in `main`'s `UnsupportedDiagnostics.cpp` export-name table to the table's `int (APS5_VABI*)(void)` type (`core/libs/prx/libSceAgcDriver/tests/UnsupportedDiagnostics.cpp:27-28` at `fbe0cd6e1b`). That table came to `main` with #11104 after this branch forked, and with the new declarations (`core/libs/prx/libSceAgcDriver/include/AgcDriver.hpp:14-15` at `fbe0cd6e1b`) the merged tree did not compile; adam25136 found it. The table is only used to check that each name resolves: `ExportsResolveByName` (`core/libs/tests/ExportLookup.hpp:20` at `fbe0cd6e1b`) tests the pointer for null and looks the name up at lines 35-36, and never calls through it. The other path depends on state AnyPS5 does not model. Each export checks a field of the module's driver context: nonzero returns 0x8A6D0001, zero copies a 0x28-byte register-shadow record into `info`. The module constructor (an unexported function at 0x7c90) fills that context at load: - the field is the low half of a 32-bit value from a call that receives a pointer into the context, apparently a kernel query; - the records are filled only when that half is zero, from imported calls. So the copied data and the gate are not settled by the module alone. `sceAgcDriverIsEsvmProcess` reads bit 16 of the same queried value (the constructor stores that half with `shr $0x10,%eax` at `0x7cf1` and the store to `[context+0xc]` at `0x7cfa`), so it keeps throwing too. The debt entry records this so it need not be traced again. Source: firmware 13.42 `libSceAgcDriver.sprx` (sha256 `78d5ad5fb70cc874b88841035218963a063199c4513607fa8f87242b66b6277b`). Read to the return, disassembly only, not measured on a console. ``` 0x3510 sceAgcDriverGetRegShadowInfo (CP-kVAMmWVw) test rdi, rdi ; je null lea rcx, [context] ; mov eax, 0x8a6d0001 ; cmp dword [rcx+8], 0 ; je copy ; ret null: mov eax, 0x8a6d0003 ; ret copy: mov rax, [rcx+0x188] ; mov [rdi+0x20], rax ; xor eax, eax vmovups ymm0, [rcx+0x168] ; vmovups [rdi], ymm0 ; ret 0x3550 sceAgcDriverGetRegShadowInfoAgr (ME1eUot7+Qw) test rdi, rdi ; je null lea rcx, [context] ; mov eax, 0x8a6d0001 ; cmp dword [rcx+8], 0 ; je copy ; ret null: mov eax, 0x8a6d0003 ; ret copy: mov rax, [rcx+0x1b0] ; mov [rdi+0x20], rax ; xor eax, eax vmovups ymm0, [rcx+0x190] ; vmovups [rdi], ymm0 ; ret 0x7c90 module constructor (excerpt) lea rdi, [context+4] ; lea rsi, [local] ; call 0x8100 ; cmp eax, 1 ; jne fail mov eax, [local] ; movzx ecx, ax ; shr eax, 16 mov [context+8], ecx ; mov [context+0xc], eax ... mov eax, [context+8] ; test eax, eax ; jne skip xor edi, edi ; call 0x690 ; mov [context+0x168], rax ; xor edi, edi ; call 0x6c0 ; mov [context+0x170], eax ; ... ``` ### Tested Windows 11 Pro 10.0.26300, WinLibs GCC, Release, head `fbe0cd6e1b` (`main` `dd00a9c54e` merged in at `a08d4c99fc`, then the cast): - **Before the cast**, the merged tree reproduces the report: building `agc_driver_unsupported_diagnostics_tests` stops with the two `invalid conversion from 'int (*)(void*)' to 'int (*)()'` errors at `UnsupportedDiagnostics.cpp:45`. With `a08d4c99fc`'s file put back at this head, the same build fails again with those 2 errors. - **3 of 3 pass, none Not Run**, with both test executables rebuilt at this head: `agc_driver_reg_shadow_info`, `agc_driver_unsupported_diagnostics` and `public_headers`. The `libSceAgcDriver` library target builds too. - Every target that uses the two changed declarations on this tree builds: `agc_driver_reg_shadow_info_tests`, `agc_driver_unsupported_diagnostics_tests` and `libSceAgcDriver` (found by grepping the merged tree for both names and mapping each file to its CMake target). - AGC validation run, same machine, this head and `main` `dd00a9c54e`: AMD Radeon RX 9070 XT (Windows driver version 32.0.32015.12012, from `Win32_VideoController`), `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V`: this head 3/3 (`agc_driver_graphics`, `agc_driver_unsupported_diagnostics`, `agc_driver_reg_shadow_info`), `main` 2/2 (the first two; `main` has no `agc_driver_reg_shadow_info`). Neither log has the missing-layer message, a `VUID-` id or a `SYNC-HAZARD` id. - `tools/check_conventions.py --base upstream/main` on the committed head `fbe0cd6e1b`: all checks pass. `git merge-tree` with `main` `dd00a9c54e` is clean. Windows 11, WinLibs GCC 15.2.0 r7, Release, on upstream/main 93dbd0f82a: - New `agc_driver_reg_shadow_info` (`tests/RegShadowInfo.cpp`, registered in its own `tests/cmake` fragment) passes. It checks that both exports return 0x8A6D0003 for null. - Mutation check: with the null path returning 0x8A6D0001, the test fails. - `public_headers` passes. - AGC validation run, same machine, this branch and main 93dbd0f82a: AMD Radeon RX 9070 XT (driver 32.0.32015.7029), Vulkan SDK 1.4.363 validation layer, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V` for `agc_driver_graphics` and `agc_driver_unsupported_diagnostics`: 2/2 pass on both, none skipped. Neither log has the missing-layer message, a `VUID-` or a `SYNC-HAZARD` ID. The new test passes under the same settings with no validation output. - `python3 tools/check_conventions.py --base upstream/main`: all checks pass. - `python3 tools/pr_overlap.py --branch feat/agcdriver-regshadow-null`: no shared exports. The checks first went into `UnsupportedDiagnostics.cpp`, which #11104 also edits, so they now live in their own file, and this branch merges cleanly with #11104. 35 open PRs that conflict with main share only `docs/dev/debt/libSceAgcDriver.md`; none of their diffs names these exports. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 9070 XT, Windows 11; driver 32.0.32015.12012 for the run at `fbe0cd6e1b`, 32.0.32015.7029 for the first run - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!14950
No description provided.