fix(libSceAjm.native): refuse a nonzero reserved in sceAjmModuleRegister as firmware 13.42 does #15491

Merged
BunnyFl merged 1 commit from upstream-pr/15491 into main 2026-11-07 13:17:12 +00:00
BunnyFl commented 2026-11-03 15:27:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-03T15:27:37Z.


What

sceAjmModuleRegister returned 0 whatever its third argument (reserved) held. Firmware 13.42 refuses a nonzero value with 0x80930005 (INVALID_PARAMETER) before it sends its driver request, and this change does the same. A zero reserved still returns 0 without recording the codec, as before; that silent stub stays in the debt file, which now names the one check.

Firmware 13.42 system/common/lib/libSceAjm.native.sprx (sha256 8eea270172e7ea177e69fa7865493b72131670f87afa91798d7d749ac183d5c0), sceAjmModuleRegister (Q3dyFuwGn64), read from disassembly, not measured on a console:

addr: 0x560
560: mov $0x80930005,%r12d
56e: test %rdx,%rdx
571: jne  0x5d7            ; return 0x80930005
577: mov $0xc0288903,%esi  ; otherwise the driver ioctl on the context

The test at 0x56e reads all 64 bits of rdx; the change compares the int64_t parameter whole as well.

Tested

  • Windows 11, WinLibs GCC 15.2.0, Release: guest_ajm passes (1 of 1). The new rows in core/libs/tests/GuestAjm.cpp check reserved 1 and -1 (refused), 0 (accepted), and sceAjmModuleUnregister after it.
  • Negative control: the same test built against main's core/libs/prx/libSceAjm.native/src/Ajm.cpp aborts (0xc0000409, 1 of 1 failed).
  • tools/check_conventions.py --base upstream/main: all checks pass.
  • tools/pr_overlap.py --branch: 7 PRs share files. Two couldn't be compared automatically (they conflict with main), and I checked those by hand: #13486 (relinker) and #14212 (debt formatting) don't touch sceAjmModuleRegister or the changed lines. #14212 reformats debt files; whichever lands second may need a trivial rebase of the debt line.
  • No title was run. The titles listed in the debt entry call sceAjmModuleRegister; I haven't checked what they pass as reserved.

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: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5139891938 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15491). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-03T15:27:37Z. --- ### What `sceAjmModuleRegister` returned 0 whatever its third argument (`reserved`) held. Firmware 13.42 refuses a nonzero value with `0x80930005` (`INVALID_PARAMETER`) before it sends its driver request, and this change does the same. A zero `reserved` still returns 0 without recording the codec, as before; that silent stub stays in the debt file, which now names the one check. Firmware 13.42 `system/common/lib/libSceAjm.native.sprx` (sha256 `8eea270172e7ea177e69fa7865493b72131670f87afa91798d7d749ac183d5c0`), `sceAjmModuleRegister` (`Q3dyFuwGn64`), read from disassembly, not measured on a console: ``` addr: 0x560 560: mov $0x80930005,%r12d 56e: test %rdx,%rdx 571: jne 0x5d7 ; return 0x80930005 577: mov $0xc0288903,%esi ; otherwise the driver ioctl on the context ``` The test at `0x56e` reads all 64 bits of `rdx`; the change compares the `int64_t` parameter whole as well. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Windows 11, WinLibs GCC 15.2.0, Release: `guest_ajm` passes (1 of 1). The new rows in `core/libs/tests/GuestAjm.cpp` check `reserved` 1 and -1 (refused), 0 (accepted), and `sceAjmModuleUnregister` after it. - **Negative control:** the same test built against `main`'s `core/libs/prx/libSceAjm.native/src/Ajm.cpp` aborts (`0xc0000409`, 1 of 1 failed). - `tools/check_conventions.py --base upstream/main`: all checks pass. - `tools/pr_overlap.py --branch`: 7 PRs share files. Two couldn't be compared automatically (they conflict with `main`), and I checked those by hand: #13486 (relinker) and #14212 (debt formatting) don't touch `sceAjmModuleRegister` or the changed lines. #14212 reformats debt files; whichever lands second may need a trivial rebase of the debt line. - No title was run. The titles listed in the debt entry call `sceAjmModuleRegister`; I haven't checked what they pass as `reserved`. ### 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: n/a - [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!15491
No description provided.