feat(libScePsml): port bundled-module dispatch validation for MFSR packet 1000 #14102

Merged
akkadbakkad89 merged 3 commits from upstream-pr/14102 into main 2026-11-06 22:28:44 +00:00
akkadbakkad89 commented 2026-10-31 19:02:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-31T19:02:17Z.


What

Ports the bundled libScePsml.sprx (PPSA13197 sce_module, disassembly not a console oracle) validation order for scePsmlMfsrGetDispatchMfsrPacket1000 (0x2C490 -> shared submit core 0x2BEA0): 0x8A810001 uninitialized, engine id 0xA9C4/0x9231 or null context -> 0x8A810005 (the object-map lookup is our equivalent), null command buffer -> 0x8A810009, then the module-state combination that yields 0x8A810016 — low-latency module-param flag (global 0x16ec10, written at 0x2A6FE from bit 30 of the module's own parameter dword) clear while the sync-submit flag (global 0x16ec39, set at 0x2E01F from sceVideoOutGetPipelineStatus field +0 == 1) is set, with an always-zero pending counter folded. param itself is never inspected before emission — it only feeds the 0x158-byte -> 0x1D8-byte descriptor copy — so the flags are modeled as g_mfsrLowLatencySubmit/g_mfsrSyncSubmit (unmodeled sources default false) and no caller input reaches the error. The AGC packet emission (0x4E0, PM4 writes into the command-buffer dmem ring at context +0x4A8) still throws NotImplemented.

The bundled module's scePsmlMfsrInit chain (already-initialized -> 0x8A810002, AGC probe 0x8A810010, component registration 0x8A810011, worker, flag) and its scePsmlMfsrGetSharedResourcesInitRequirement size-table math (0x28DE0, type-indexed u64 table at 0x6CC28 loaded via movsxd+r13*8, yielding 0x3E000 blocks for type 0) are documented in the debt file with the load instructions quoted. Both are kept at their console-measured behavior — init throws past the Trinity check rather than fabricate the engine, and the requirement keeps the measured 52 blocks for type 0 and the throw for gated types 1/2 — because the bundled revision's fill contradicts the 13.40 console measurement and no caller-visible input distinguishes the revisions.

Tested

guest_psml rebuilt and passes (the new paths are unreachable while sceKernelIsTrinityMode reports 0 on the modelled base console; the reachable init gate is exercised twice by Mfsr1OnBaseConsole). python3 tools/check_conventions.py --base origin/main clean. Behavior verified against disassembly of the bundled module; no console oracle run.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5100616577 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14102). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-31T19:02:17Z. --- ### What Ports the bundled `libScePsml.sprx` (PPSA13197 `sce_module`, disassembly not a console oracle) validation order for `scePsmlMfsrGetDispatchMfsrPacket1000` (0x2C490 -> shared submit core `0x2BEA0`): `0x8A810001` uninitialized, engine id `0xA9C4`/`0x9231` or null context -> `0x8A810005` (the object-map lookup is our equivalent), null command buffer -> `0x8A810009`, then the module-state combination that yields `0x8A810016` — low-latency module-param flag (global `0x16ec10`, written at `0x2A6FE` from bit 30 of the module's own parameter dword) clear while the sync-submit flag (global `0x16ec39`, set at `0x2E01F` from `sceVideoOutGetPipelineStatus` field +0 == 1) is set, with an always-zero pending counter folded. `param` itself is never inspected before emission — it only feeds the 0x158-byte -> 0x1D8-byte descriptor copy — so the flags are modeled as `g_mfsrLowLatencySubmit`/`g_mfsrSyncSubmit` (unmodeled sources default false) and no caller input reaches the error. The AGC packet emission (`0x4E0`, PM4 writes into the command-buffer dmem ring at context `+0x4A8`) still throws `NotImplemented`. The bundled module's `scePsmlMfsrInit` chain (already-initialized -> `0x8A810002`, AGC probe `0x8A810010`, component registration `0x8A810011`, worker, flag) and its `scePsmlMfsrGetSharedResourcesInitRequirement` size-table math (`0x28DE0`, type-indexed u64 table at `0x6CC28` loaded via `movsxd`+`r13*8`, yielding `0x3E000` blocks for type 0) are documented in the debt file with the load instructions quoted. Both are kept at their console-measured behavior — init throws past the Trinity check rather than fabricate the engine, and the requirement keeps the measured 52 blocks for type 0 and the throw for gated types 1/2 — because the bundled revision's fill contradicts the 13.40 console measurement and no caller-visible input distinguishes the revisions. ### Tested `guest_psml` rebuilt and passes (the new paths are unreachable while `sceKernelIsTrinityMode` reports 0 on the modelled base console; the reachable init gate is exercised twice by `Mfsr1OnBaseConsole`). `python3 tools/check_conventions.py --base origin/main` clean. Behavior verified against disassembly of the bundled module; no console oracle run. ### 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
MarcZX10 commented 2026-10-31 19:08:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T19:08:45Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The dispatch validation described in this PR is incomplete: the new implementation ignores the parameter and throws before checking the documented parameter-flag error.

What I ran

Reviewed head 83e79e6e6f60da13593299c0ca0eaa73befe8f58 against base 16452da93473aa42d8054da95f89e44a2a1d8d97. The PR merge preview against current main was clean. Environment: Debian 12, Python 3.11.2, GCC 12.2.0. I inspected the exact diff and ran no build or C++ tests.

git diff --check 16452da93473aa42d8054da95f89e44a2a1d8d97...83e79e6e6f60da13593299c0ca0eaa73befe8f58
python3 tools/check_conventions.py --base 16452da93473aa42d8054da95f89e44a2a1d8d97 --head 83e79e6e6f60da13593299c0ca0eaa73befe8f58
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14102
gh pr checks 14102 -R boykopovar/AnyPS5

Results

Check Result
Diff check and conventions Passed
Dependency/merge preview Passed
Eligibility, intake, report and library portability Passed
Windows In progress at final refresh
Linux and specialized jobs Skipped
Local C++ tests/build Not run
Optional ABI/test-quality helpers in isolated precheck checkout Could not execute because the local-only scripts are absent from that checkout
Unedited command output
All conventions checks passed.
conventions	pass	16s	https://github.com/boykopovar/AnyPS5/actions/runs/41232277942/job/124628778886
windows	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629520428
linux	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629522193
register-context	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629521844
relinker	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629521326
relinker-asan	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629521579
write-watch	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629521491
eligibility	pass	6s	https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124628778015
intake	pass	3s	https://github.com/boykopovar/AnyPS5/actions/runs/41232278065/job/124628779968
library-portability	pass	1m44s	https://github.com/boykopovar/AnyPS5/actions/runs/41232278084/job/124628778192
report	pass	52s	https://github.com/boykopovar/AnyPS5/actions/runs/41232278017/job/124628778064
labels	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41232278033/job/124628779286

The precheck report confirms that the head and base stayed unchanged. Its ABI-audit and test-quality helper invocations could not run because those local-only scripts are absent from the isolated PR checkout.

Findings

Blocking

In scePsmlMfsrGetDispatchMfsrPacket1000, param is explicitly discarded, and after the initialized/context/command-buffer checks the function immediately calls NotImplemented_nid_no_patch. The PR description and debt entry say the parameter flag combination that yields 0x8A810016 is validated before packet emission. That input currently throws instead of returning the documented error. Please implement that known parameter validation before the unsupported packet-emission path, and add focused coverage for the error result.

Not verified

The author reports guest_psml was rebuilt and passed, but the PR description says the newly added paths are unreachable with the current modeled sceKernelIsTrinityMode result. I did not independently run that test or verify the documented flag combination against a console.

To get this to a good state

Implement and test the documented 0x8A810016 validation while retaining the throw for packet emission that remains unimplemented. I will rerun the same no-build checks on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724457968 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14102#pullrequestreview-5724457968). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T19:08:45Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The dispatch validation described in this PR is incomplete: the new implementation ignores the parameter and throws before checking the documented parameter-flag error. ## What I ran Reviewed head `83e79e6e6f60da13593299c0ca0eaa73befe8f58` against base `16452da93473aa42d8054da95f89e44a2a1d8d97`. The PR merge preview against current `main` was clean. Environment: Debian 12, Python 3.11.2, GCC 12.2.0. I inspected the exact diff and ran no build or C++ tests. ```sh git diff --check 16452da93473aa42d8054da95f89e44a2a1d8d97...83e79e6e6f60da13593299c0ca0eaa73befe8f58 python3 tools/check_conventions.py --base 16452da93473aa42d8054da95f89e44a2a1d8d97 --head 83e79e6e6f60da13593299c0ca0eaa73befe8f58 python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14102 gh pr checks 14102 -R boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Diff check and conventions | Passed | | Dependency/merge preview | Passed | | Eligibility, intake, report and library portability | Passed | | Windows | In progress at final refresh | | Linux and specialized jobs | Skipped | | Local C++ tests/build | Not run | | Optional ABI/test-quality helpers in isolated precheck checkout | Could not execute because the local-only scripts are absent from that checkout | <details> <summary>Unedited command output</summary> ```text All conventions checks passed. conventions pass 16s https://github.com/boykopovar/AnyPS5/actions/runs/41232277942/job/124628778886 windows pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629520428 linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629522193 register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629521844 relinker skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629521326 relinker-asan skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629521579 write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124629521491 eligibility pass 6s https://github.com/boykopovar/AnyPS5/actions/runs/41232278035/job/124628778015 intake pass 3s https://github.com/boykopovar/AnyPS5/actions/runs/41232278065/job/124628779968 library-portability pass 1m44s https://github.com/boykopovar/AnyPS5/actions/runs/41232278084/job/124628778192 report pass 52s https://github.com/boykopovar/AnyPS5/actions/runs/41232278017/job/124628778064 labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41232278033/job/124628779286 ``` The precheck report confirms that the head and base stayed unchanged. Its ABI-audit and test-quality helper invocations could not run because those local-only scripts are absent from the isolated PR checkout. </details> ## Findings ### Blocking In [`scePsmlMfsrGetDispatchMfsrPacket1000`](https://github.com/boykopovar/AnyPS5/blob/83e79e6e6f60da13593299c0ca0eaa73befe8f58/core/libs/prx/libScePsml_debug/Export.cpp#L292-L299), `param` is explicitly discarded, and after the initialized/context/command-buffer checks the function immediately calls `NotImplemented_nid_no_patch`. The PR description and [debt entry](https://github.com/boykopovar/AnyPS5/blob/83e79e6e6f60da13593299c0ca0eaa73befe8f58/docs/dev/debt/libScePsml_debug.md#L10) say the parameter flag combination that yields `0x8A810016` is validated before packet emission. That input currently throws instead of returning the documented error. Please implement that known parameter validation before the unsupported packet-emission path, and add focused coverage for the error result. ## Not verified The author reports `guest_psml` was rebuilt and passed, but the PR description says the newly added paths are unreachable with the current modeled `sceKernelIsTrinityMode` result. I did not independently run that test or verify the documented flag combination against a console. ## To get this to a good state Implement and test the documented `0x8A810016` validation while retaining the throw for packet emission that remains unimplemented. I will rerun the same no-build checks on the updated head.
MarcZX10 commented 2026-10-31 20:27:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T20:27:25Z.

Review: APPROVED


Re-checked — new head, looks good

The new head now keeps the measured 52-block result and unsupported initialization behavior, and adds the documented 0x8A810016 check before the still-unimplemented packet emission.

What I ran

Reviewed head badfea09b69e98d6611007ec5ffd9fbc38b441cb against PR base 16452da93473aa42d8054da95f89e44a2a1d8d97; the merge preview against current main 0836dfdf4fecb1e0326100c490476e15d3a74da5 was clean. Environment: Debian Linux, Python 3.11.2, GCC 12.2.0. No local C++ build was run.

git diff --check 16452da93473aa42d8054da95f89e44a2a1d8d97...badfea09b69e98d6611007ec5ffd9fbc38b441cb
python3 tools/check_conventions.py --base 16452da93473aa42d8054da95f89e44a2a1d8d97 --head badfea09b69e98d6611007ec5ffd9fbc38b441cb --title 'feat(libScePsml): port bundled-module dispatch validation for MFSR packet 1000' --body /tmp/anyps5-14102-review/pr-body.md
python3 tools/pr_abi_audit.py --base 16452da93473aa42d8054da95f89e44a2a1d8d97 --head badfea09b69e98d6611007ec5ffd9fbc38b441cb --json
python3 tools/pr_stack_check.py 14102 --repo boykopovar/AnyPS5

Results

Check Result
Diff and repository conventions/template Passed
Export/declaration audit Passed: changed exports have matching declarations and definitions; lexical audit only
Current-main merge preview Clean; no declared dependencies
Hosted Windows Passed
Eligibility, library portability, progress report Passed
Hosted Linux and specialized jobs Skipped; relinker not selected; labels job was queued at review time
Local C++ build/test Not run
Unedited local output
All conventions checks passed.

The ABI audit returned "status": "passed" and "findings": [].

Negative control

No negative-control run was available. The new validation is after the initialized/context checks, but initialization intentionally remains unimplemented on the modeled console, so a focused runtime test cannot reach this branch in the current environment.

Findings

Blocking: None found in the update.

Non-blocking: The author reports guest_psml passed, but that result was not independently reproduced here. The new error branch is supported by the documented bundled-module disassembly but remains unreachable in the current model. The AGC packet-emission path still throws as documented.

Sources

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724788681 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14102#pullrequestreview-5724788681). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T20:27:25Z. **Review:** APPROVED --- # Re-checked — new head, looks good The new head now keeps the measured 52-block result and unsupported initialization behavior, and adds the documented `0x8A810016` check before the still-unimplemented packet emission. ## What I ran Reviewed head `badfea09b69e98d6611007ec5ffd9fbc38b441cb` against PR base `16452da93473aa42d8054da95f89e44a2a1d8d97`; the merge preview against current `main` `0836dfdf4fecb1e0326100c490476e15d3a74da5` was clean. Environment: Debian Linux, Python 3.11.2, GCC 12.2.0. No local C++ build was run. ```sh git diff --check 16452da93473aa42d8054da95f89e44a2a1d8d97...badfea09b69e98d6611007ec5ffd9fbc38b441cb python3 tools/check_conventions.py --base 16452da93473aa42d8054da95f89e44a2a1d8d97 --head badfea09b69e98d6611007ec5ffd9fbc38b441cb --title 'feat(libScePsml): port bundled-module dispatch validation for MFSR packet 1000' --body /tmp/anyps5-14102-review/pr-body.md python3 tools/pr_abi_audit.py --base 16452da93473aa42d8054da95f89e44a2a1d8d97 --head badfea09b69e98d6611007ec5ffd9fbc38b441cb --json python3 tools/pr_stack_check.py 14102 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Diff and repository conventions/template | Passed | | Export/declaration audit | Passed: changed exports have matching declarations and definitions; lexical audit only | | Current-main merge preview | Clean; no declared dependencies | | Hosted Windows | Passed | | Eligibility, library portability, progress report | Passed | | Hosted Linux and specialized jobs | Skipped; relinker not selected; labels job was queued at review time | | Local C++ build/test | Not run | <details><summary>Unedited local output</summary> ```text All conventions checks passed. ``` The ABI audit returned `"status": "passed"` and `"findings": []`. </details> ## Negative control No negative-control run was available. The new validation is after the initialized/context checks, but initialization intentionally remains unimplemented on the modeled console, so a focused runtime test cannot reach this branch in the current environment. ## Findings **Blocking:** None found in the update. **Non-blocking:** The author reports `guest_psml` passed, but that result was not independently reproduced here. The new error branch is supported by the documented bundled-module disassembly but remains unreachable in the current model. The AGC packet-emission path still throws as documented. ## Sources - [Updated dispatch validation and initialization at this PR head](https://github.com/boykopovar/AnyPS5/blob/badfea09b69e98d6611007ec5ffd9fbc38b441cb/core/libs/prx/libScePsml_debug/Export.cpp) - [Updated PSML debt notes, including the source of the flag condition](https://github.com/boykopovar/AnyPS5/blob/badfea09b69e98d6611007ec5ffd9fbc38b441cb/docs/dev/debt/libScePsml_debug.md) - [Hosted checks for this head](https://github.com/boykopovar/AnyPS5/actions/runs/41236994849)
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!14102
No description provided.