feat(libSceNpCommon): implement sce::np::Semaphore and sceNpWaitSema #13277

Merged
hypermoist merged 7 commits from upstream-pr/13277 into main 2026-11-06 12:13:28 +00:00
hypermoist commented 2026-10-30 11:23:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-30T11:23:30Z.


What

Implements sce::np::Semaphore (11 exports) and the C export sceNpWaitSema from libSceNpCommon.sprx of firmware 13.60 (read from disassembly, not measured on a console).

  • Already stubs on main: 3 of them had placeholder int (void) declarations: Create, Wait and D2.
  • Missing from AnyPS5: the other 9 are exported by the module but were not declared: C1, C2, D0, D1, IsInit, Open, Destroy, Signal and sceNpWaitSema.

sceNpWaitSema(KernelSema sema, KernelUseconds* timeout): calls sceKernelWaitSema(sema, 1, timeout), maps the kernel timeout 0x8002003C to 0x8055800B, and otherwise returns only negative results.

NpSemaphoreObject (declared in Api.hpp, 24 bytes): vtable, KernelSema sema, then int32_t state at +0x10. The state is 0 when uninitialized, 1 when created and 2 when opened. The vtable is {0, 0, D1, D0}.

  • C1/C2: set the vtable and state 0. IsInit is state != 0.
  • D1/D2: reset the vtable and delete a created semaphore with sceKernelDeleteSema. D0 uses sceNpDeleteSema and then frees through sce::np::Object::operator delete(void*).
  • Create(int initial, int maximum, const char* name):
    • returns 0x80559E03 when already initialized;
    • otherwise calls sceNpCreateSema(&sema, 0, initial, maximum, name) and returns its error, or sets state 1 and returns 0.
  • Destroy: releases by state and always clears it.
  • Wait(uint32_t usec): calls sceNpWaitSema, passing a pointer to its own copy of the timeout, or null when usec is 0, so 0 waits without a timeout.
  • Signal: calls sceNpSignalSema. Both Wait and Signal keep only negative results.

Not implemented: Open(const char* name). In the module it calls sceNpOpenSema → sceKernelOpenSema. AnyPS5's libkernel has no named semaphores: sceKernelOpenSema and sceKernelCloseSema are unknown-signature stubs.

  • It returns 0x80559E03 when already initialized, as the module does, and otherwise throws through NotImplemented_nid_no_patch.
  • So no Semaphore ever reaches the opened state. The close branch of Destroy and the destructors throws the same way, and the debt file says so.
  • Implementing named semaphores in libkernel is a separate change.

Where the module halts: before Create, Wait and Signal assert IsInit() and panic. AnyPS5 throws std::invalid_argument, following the libSceJson2 exports, and the debt file records it.

Tested

Linux (CachyOS, GCC 16.2, Release): ctest --test-dir build -R 'np_common|public_headers' --output-on-failure, 70/70 passed. guest_np_common_runtime passed 3 of 3 runs, in 0.03–0.04 s each. TestSemaphoreObjects in GuestNpCommonRuntime.cpp uses real kernel semaphores and a thread to check:

  • the throw before Create;
  • that a refused Create (initial count above the maximum) leaves the object uninitialized;
  • a second Create or Open returning 0x80559E03;
  • a timed-out Wait and sceNpWaitSema's timeout mapping;
  • Signal then Wait with timeout 0;
  • a signal past the maximum being refused, while each signal is taken once;
  • Signal waking a waiter blocked in Wait(0) on another thread;
  • a repeated Destroy;
  • D0 freeing through the allocator stored by Object::operator new.

Mutation check: I changed 8 single lines of the new functions, one at a time, and the test fails for 7. The changes were:

  • the timeout mapping dropped;
  • the timeout ignored;
  • Wait(0) given a timeout;
  • a failed Create counted as created;
  • the double-Create check removed;
  • the initial count swapped for the maximum;
  • Destroy not clearing the state;
  • D0 not deleting the semaphore.

The one survivor is the last: AnyPS5's libkernel does not validate a deleted semaphore handle (a second sceKernelDeleteSema on it never returns), so the test can't observe the deletion safely.

No firmware differential: these methods wrap kernel semaphores. A unicorn run would only exercise the glue against a fake kernel, and I can't swap the kernel under AnyPS5. The contract above comes from the disassembly, including the vtable relocations and the C1/C2 and D1/D2 aliases (one address each).

Windows not built. Not run on a console.

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: #13130, #13270. They land first, in that order (all three are mine); after each lands I merge main here and keep its copy of NP_ERROR_OBJECT_ALREADY_INITIALIZED.
    • This PR lands before #13120. #13120 declares 9 of these exports as NotImplemented stubs (the ones missing from main), so it drops them from InventoryExports.cpp after this lands. Agreed with its author (comment): #13120 has removed these declarations and declares Depends on: #13130, #13270, #13277, #13281.
    • #11601, #12825, #12829, #12830, #12839, #12852, #12859, #12899, #12919 and #13281 touch neighbouring stub, declaration, include, test or debt lines and share no exports. Either order works; whichever lands second needs a trivial merge, and I will do it on mine.
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Assisted With AI: Yes. All tests were run locally on computer hardware (AMD Ryzen 5 5600G, 32 GB RAM, NVIDIA GeForce RTX 3060, CachyOS Linux 7.3, GCC 16.2), not on an actual console.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5083555223 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13277). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-30T11:23:30Z. --- ### What Implements `sce::np::Semaphore` (11 exports) and the C export `sceNpWaitSema` from `libSceNpCommon.sprx` of firmware 13.60 (read from disassembly, not measured on a console). - **Already stubs on `main`:** 3 of them had placeholder `int (void)` declarations: `Create`, `Wait` and `D2`. - **Missing from AnyPS5:** the other 9 are exported by the module but were not declared: `C1`, `C2`, `D0`, `D1`, `IsInit`, `Open`, `Destroy`, `Signal` and `sceNpWaitSema`. **`sceNpWaitSema(KernelSema sema, KernelUseconds* timeout)`:** calls `sceKernelWaitSema(sema, 1, timeout)`, maps the kernel timeout `0x8002003C` to `0x8055800B`, and otherwise returns only negative results. **`NpSemaphoreObject`** (declared in `Api.hpp`, 24 bytes): vtable, `KernelSema sema`, then `int32_t state` at +0x10. The state is 0 when uninitialized, 1 when created and 2 when opened. The vtable is `{0, 0, D1, D0}`. - **C1/C2:** set the vtable and state 0. `IsInit` is `state != 0`. - **D1/D2:** reset the vtable and delete a created semaphore with `sceKernelDeleteSema`. `D0` uses `sceNpDeleteSema` and then frees through `sce::np::Object::operator delete(void*)`. - **`Create(int initial, int maximum, const char* name)`:** - returns `0x80559E03` when already initialized; - otherwise calls `sceNpCreateSema(&sema, 0, initial, maximum, name)` and returns its error, or sets state 1 and returns 0. - **`Destroy`:** releases by state and always clears it. - **`Wait(uint32_t usec)`:** calls `sceNpWaitSema`, passing a pointer to its own copy of the timeout, or null when `usec` is 0, so 0 waits without a timeout. - **`Signal`:** calls `sceNpSignalSema`. Both `Wait` and `Signal` keep only negative results. **Not implemented: `Open(const char* name)`.** In the module it calls `sceNpOpenSema` → `sceKernelOpenSema`. AnyPS5's libkernel has no named semaphores: `sceKernelOpenSema` and `sceKernelCloseSema` are unknown-signature stubs. - It returns `0x80559E03` when already initialized, as the module does, and otherwise throws through `NotImplemented_nid_no_patch`. - So no `Semaphore` ever reaches the opened state. The close branch of `Destroy` and the destructors throws the same way, and the debt file says so. - Implementing named semaphores in libkernel is a separate change. **Where the module halts:** before `Create`, `Wait` and `Signal` assert `IsInit()` and panic. AnyPS5 throws `std::invalid_argument`, following the libSceJson2 exports, and the debt file records it. ### Tested Linux (CachyOS, GCC 16.2, Release): `ctest --test-dir build -R 'np_common|public_headers' --output-on-failure`, 70/70 passed. `guest_np_common_runtime` passed 3 of 3 runs, in 0.03–0.04 s each. `TestSemaphoreObjects` in `GuestNpCommonRuntime.cpp` uses real kernel semaphores and a thread to check: - the throw before `Create`; - that a refused `Create` (initial count above the maximum) leaves the object uninitialized; - a second `Create` or `Open` returning `0x80559E03`; - a timed-out `Wait` and `sceNpWaitSema`'s timeout mapping; - `Signal` then `Wait` with timeout 0; - a signal past the maximum being refused, while each signal is taken once; - `Signal` waking a waiter blocked in `Wait(0)` on another thread; - a repeated `Destroy`; - `D0` freeing through the allocator stored by `Object::operator new`. **Mutation check:** I changed 8 single lines of the new functions, one at a time, and the test fails for 7. The changes were: - the timeout mapping dropped; - the timeout ignored; - `Wait(0)` given a timeout; - a failed `Create` counted as created; - the double-`Create` check removed; - the initial count swapped for the maximum; - `Destroy` not clearing the state; - `D0` not deleting the semaphore. The one survivor is the last: AnyPS5's libkernel does not validate a deleted semaphore handle (a second `sceKernelDeleteSema` on it never returns), so the test can't observe the deletion safely. **No firmware differential:** these methods wrap kernel semaphores. A unicorn run would only exercise the glue against a fake kernel, and I can't swap the kernel under AnyPS5. The contract above comes from the disassembly, including the vtable relocations and the C1/C2 and D1/D2 aliases (one address each). Windows not built. Not run on a console. ### 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: #13130, #13270. They land first, in that order (all three are mine); after each lands I merge `main` here and keep its copy of `NP_ERROR_OBJECT_ALREADY_INITIALIZED`. - **This PR lands before #13120.** #13120 declares 9 of these exports as `NotImplemented` stubs (the ones missing from `main`), so it drops them from `InventoryExports.cpp` after this lands. Agreed with its author ([comment](https://github.com/boykopovar/AnyPS5/pull/13120#issuecomment-6522956813)): #13120 has removed these declarations and declares `Depends on: #13130, #13270, #13277, #13281`. - #11601, #12825, #12829, #12830, #12839, #12852, #12859, #12899, #12919 and #13281 touch neighbouring stub, declaration, include, test or debt lines and share no exports. Either order works; whichever lands second needs a trivial merge, and I will do it on mine. - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes Assisted With AI: Yes. All tests were run locally on computer hardware (AMD Ryzen 5 5600G, 32 GB RAM, NVIDIA GeForce RTX 3060, CachyOS Linux 7.3, GCC 16.2), not on an actual console. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-30 12:02:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T12:02:35Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The implementation and reported test evidence look reasonable, but the overlapping exports with #13120 do not yet have the landing order required by the repository rules.

What I ran

Reviewed head 8007fe1d8b6a79868802a5a05b23b67786f88414 against PR base e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed. The merge preview onto current main 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9 was clean (tree 29ba750a88c4c952cec9c0cefb45cb0840be8a78). Environment: Debian 12 x86-64, Git 2.39.5, Python 3.11.2. I reviewed the semaphore wrappers, object lifecycle, and tests. I did not build or run C++ tests locally.

git diff --check e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed...8007fe1d8b6a79868802a5a05b23b67786f88414
python3 tools/check_conventions.py --base e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed --head 8007fe1d8b6a79868802a5a05b23b67786f88414 --title 'feat(libSceNpCommon): implement sce::np::Semaphore and sceNpWaitSema' --body /tmp/anyps5-pr-13277-body.md
git merge-tree --write-tree 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9 8007fe1d8b6a79868802a5a05b23b67786f88414

Results

Check Result
Diff whitespace and conventions Passed.
Current-main merge preview Clean at 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9.
Source review The semaphore wrapper maps the kernel timeout and keeps the object state transitions consistent with the documented behavior. No code defect found in the inspected paths.
Author-reported tests Linux: 70/70 focused `np_common
Other PR test report A contributor reports a successful Windows Release build and 3/3 focused test runs at this head. I did not run that build.
Hosted checks Eligibility, intake, report, and Windows passed. Conventions and labels were pending at review time; Linux and specialized jobs were skipped.
Unedited local output
All conventions checks passed.
29ba750a88c4c952cec9c0cefb45cb0840be8a78

Findings

Blocking

The PR overlap analysis for #13120 lists nine of the semaphore exports implemented here as duplicate exports. The PR body acknowledges that one side must remove those declarations, but the landing order has not been agreed with #13120's author and #13120 is not listed on this PR's Depends on line. The repository rule requires the authors to agree which PR lands first and record that order with Depends on. Please agree the order with the #13120 author and update the checklist (and the affected PR's declaration list if required) so the second merge cannot introduce duplicate symbol definitions.

Non-blocking

No code blocker found in the reviewed implementation. The local Linux tests and Windows build/test results above are reported by the authors/contributor, not independently reproduced in this review.

Sources

Not verified

I did not compile, run the reported Linux tests, or run on a console. Hosted conventions and labels were still pending at review time; the hosted Linux and specialized jobs were skipped. Firmware behavior is based on the PR's disassembly analysis and was not independently verified on a console.

To get this to a good state

Please agree and record the landing order with #13120's author, then update the relevant Depends on checklist entry and declarations if needed. I will recheck the overlap and conventions on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5711945258 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13277#pullrequestreview-5711945258). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T12:02:35Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The implementation and reported test evidence look reasonable, but the overlapping exports with #13120 do not yet have the landing order required by the repository rules. ## What I ran Reviewed head `8007fe1d8b6a79868802a5a05b23b67786f88414` against PR base `e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed`. The merge preview onto current `main` `51c31ea17e9f66cb36fe9655ec31c81610bfcfc9` was clean (tree `29ba750a88c4c952cec9c0cefb45cb0840be8a78`). Environment: Debian 12 x86-64, Git 2.39.5, Python 3.11.2. I reviewed the semaphore wrappers, object lifecycle, and tests. I did not build or run C++ tests locally. ```sh git diff --check e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed...8007fe1d8b6a79868802a5a05b23b67786f88414 python3 tools/check_conventions.py --base e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed --head 8007fe1d8b6a79868802a5a05b23b67786f88414 --title 'feat(libSceNpCommon): implement sce::np::Semaphore and sceNpWaitSema' --body /tmp/anyps5-pr-13277-body.md git merge-tree --write-tree 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9 8007fe1d8b6a79868802a5a05b23b67786f88414 ``` ## Results | Check | Result | |---|---| | Diff whitespace and conventions | Passed. | | Current-main merge preview | Clean at `51c31ea17e9f66cb36fe9655ec31c81610bfcfc9`. | | Source review | The semaphore wrapper maps the kernel timeout and keeps the object state transitions consistent with the documented behavior. No code defect found in the inspected paths. | | Author-reported tests | Linux: 70/70 focused `np_common|public_headers` tests and 3/3 `guest_np_common_runtime` runs; author also reports mutation checks. Not independently reproduced here. | | Other PR test report | A contributor reports a successful Windows Release build and 3/3 focused test runs at this head. I did not run that build. | | Hosted checks | Eligibility, intake, report, and Windows passed. Conventions and labels were pending at review time; Linux and specialized jobs were skipped. | <details> <summary>Unedited local output</summary> ```text All conventions checks passed. 29ba750a88c4c952cec9c0cefb45cb0840be8a78 ``` </details> ## Findings ### Blocking The PR overlap analysis for #13120 lists nine of the semaphore exports implemented here as duplicate exports. The PR body acknowledges that one side must remove those declarations, but the landing order has not been agreed with #13120's author and #13120 is not listed on this PR's `Depends on` line. The repository rule requires the authors to agree which PR lands first and record that order with `Depends on`. Please agree the order with the #13120 author and update the checklist (and the affected PR's declaration list if required) so the second merge cannot introduce duplicate symbol definitions. ### Non-blocking No code blocker found in the reviewed implementation. The local Linux tests and Windows build/test results above are reported by the authors/contributor, not independently reproduced in this review. ## Sources - [Semaphore implementation and tests at the reviewed head](https://github.com/boykopovar/AnyPS5/tree/8007fe1d8b6a79868802a5a05b23b67786f88414/core/libs/prx/libSceNpCommon) and [runtime tests](https://github.com/boykopovar/AnyPS5/blob/8007fe1d8b6a79868802a5a05b23b67786f88414/core/libs/tests/GuestNpCommonRuntime.cpp). - [Repository overlap-order rule](https://github.com/boykopovar/AnyPS5/blob/51c31ea17e9f66cb36fe9655ec31c81610bfcfc9/CONTRIBUTING.md#L61-L70). - [#13120 overlap and proposed landing order](https://github.com/boykopovar/AnyPS5/pull/13120#issuecomment-6522025174). ## Not verified I did not compile, run the reported Linux tests, or run on a console. Hosted conventions and labels were still pending at review time; the hosted Linux and specialized jobs were skipped. Firmware behavior is based on the PR's disassembly analysis and was not independently verified on a console. ## To get this to a good state Please agree and record the landing order with #13120's author, then update the relevant `Depends on` checklist entry and declarations if needed. I will recheck the overlap and conventions on the updated head.
MarcZX10 commented 2026-10-30 12:24:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T12:24:59Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes still needed

The update records the intended order, but the current head conflicts with main, the declared #13130/#13270 dependency heads are not included, and eligibility now fails on the merge conflict.

What I ran

Head 71e0448f63f7ab494e61ffc217eb1f86071dae00; PR base 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9; current main 42d009f5f37c8f388b01fbfe38d2e704c792c46f. Environment: Linux x86_64, Python 3.11.2. No local build or C++ tests were run.

python3 tools/check_conventions.py --base 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9 --head 71e0448f63f7ab494e61ffc217eb1f86071dae00 --title 'feat(libSceNpCommon): implement sce::np::Semaphore and sceNpWaitSema'
python3 tools/pr_abi_audit.py --base 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9 --head 71e0448f63f7ab494e61ffc217eb1f86071dae00 --json
python3 tools/pr_stack_check.py 13277 --repo boykopovar/AnyPS5
git merge-tree --write-tree 42d009f5f37c8f388b01fbfe38d2e704c792c46f 71e0448f63f7ab494e61ffc217eb1f86071dae00
gh pr checks 13277 --repo boykopovar/AnyPS5

Results

Check Result
Conventions and diff check Passed.
ABI audit passed_with_warnings: 322 symbols; seven lexical warnings for the same private helper definitions, with no semaphore-specific finding.
Stack and current-main preview Conflicts in Runtime.cpp, include/Api.hpp, GuestNpCommonRuntime.cpp, and docs/dev/debt/libSceNpCommon.md. The current heads of #13130 and #13270 are not included in this branch.
Author-reported tests The author reports `np_common
Hosted CI Eligibility failed with: Pull request #13277 does not merge cleanly into main; rebase it first. Report passed; conventions, portability and labels were pending. Windows, Linux and specialized build/test jobs were skipped.
Unedited hosted eligibility output
Error: Pull request #13277 does not merge cleanly into main; rebase it first

Findings

Blocking

  1. The current head has content conflicts in the four files listed above, and hosted eligibility independently fails for that merge conflict. Update the stack after its dependencies are ready and resolve the current-main conflicts.
  2. The stack report says the current heads of #13130 and #13270 are absent from this branch. Preserve the declared order #13130 → #13270 → #13277 by incorporating the appropriate dependency heads, or wait for them to merge before updating this PR.
  3. The nine shared exports with #13120 still lack an agreed landing order. The proposed order is documented, but #13120's author has not confirmed it; please get confirmation and record the agreed order before landing.

Non-blocking

The semaphore implementation is unchanged by the merge update. The focused test results are author-reported and were not reproduced locally.

Sources

Not verified

No local build, C++ test run, Windows/macOS test, or console test. Linux and specialized hosted jobs were skipped. ABI audit warnings are lexical and do not prove binary ABI correctness.

To get this to a good state

After #13130 and #13270 are settled, update this branch in the declared order, resolve current-main conflicts, and obtain #13120's agreement on the shared exports. I will rerun conventions, ABI audit, diff check, the stack/mergeability check, and review the exact new head; report the same focused test command on it.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5712186946 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13277#pullrequestreview-5712186946). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T12:24:59Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes still needed The update records the intended order, but the current head conflicts with `main`, the declared #13130/#13270 dependency heads are not included, and eligibility now fails on the merge conflict. ## What I ran Head `71e0448f63f7ab494e61ffc217eb1f86071dae00`; PR base `51c31ea17e9f66cb36fe9655ec31c81610bfcfc9`; current `main` `42d009f5f37c8f388b01fbfe38d2e704c792c46f`. Environment: Linux x86_64, Python 3.11.2. No local build or C++ tests were run. ```sh python3 tools/check_conventions.py --base 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9 --head 71e0448f63f7ab494e61ffc217eb1f86071dae00 --title 'feat(libSceNpCommon): implement sce::np::Semaphore and sceNpWaitSema' python3 tools/pr_abi_audit.py --base 51c31ea17e9f66cb36fe9655ec31c81610bfcfc9 --head 71e0448f63f7ab494e61ffc217eb1f86071dae00 --json python3 tools/pr_stack_check.py 13277 --repo boykopovar/AnyPS5 git merge-tree --write-tree 42d009f5f37c8f388b01fbfe38d2e704c792c46f 71e0448f63f7ab494e61ffc217eb1f86071dae00 gh pr checks 13277 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Conventions and diff check | Passed. | | ABI audit | `passed_with_warnings`: 322 symbols; seven lexical warnings for the same private helper definitions, with no semaphore-specific finding. | | Stack and current-main preview | Conflicts in `Runtime.cpp`, `include/Api.hpp`, `GuestNpCommonRuntime.cpp`, and `docs/dev/debt/libSceNpCommon.md`. The current heads of #13130 and #13270 are not included in this branch. | | Author-reported tests | The author reports `np_common|public_headers` 70/70 and `guest_np_common_runtime` 3/3 on this head. Not independently run here. | | Hosted CI | Eligibility failed with: `Pull request #13277 does not merge cleanly into main; rebase it first`. Report passed; conventions, portability and labels were pending. Windows, Linux and specialized build/test jobs were skipped. | <details><summary>Unedited hosted eligibility output</summary> ```text Error: Pull request #13277 does not merge cleanly into main; rebase it first ``` </details> ## Findings ### Blocking 1. The current head has content conflicts in the four files listed above, and hosted eligibility independently fails for that merge conflict. Update the stack after its dependencies are ready and resolve the current-main conflicts. 2. The stack report says the current heads of #13130 and #13270 are absent from this branch. Preserve the declared order `#13130 → #13270 → #13277` by incorporating the appropriate dependency heads, or wait for them to merge before updating this PR. 3. The nine shared exports with #13120 still lack an agreed landing order. The proposed order is documented, but #13120's author has not confirmed it; please get confirmation and record the agreed order before landing. ### Non-blocking The semaphore implementation is unchanged by the merge update. The focused test results are author-reported and were not reproduced locally. ## Sources - [Semaphore implementation at the reviewed head](https://github.com/boykopovar/AnyPS5/tree/71e0448f63f7ab494e61ffc217eb1f86071dae00/core/libs/prx/libSceNpCommon) - [Current #13120 landing-order discussion](https://github.com/boykopovar/AnyPS5/pull/13120#issuecomment-6522668428) - [Repository rule for agreeing on overlapping exports](https://github.com/boykopovar/AnyPS5/blob/42d009f5f37c8f388b01fbfe38d2e704c792c46f/CONTRIBUTING.md#L64-L70) ## Not verified No local build, C++ test run, Windows/macOS test, or console test. Linux and specialized hosted jobs were skipped. ABI audit warnings are lexical and do not prove binary ABI correctness. ## To get this to a good state After #13130 and #13270 are settled, update this branch in the declared order, resolve current-main conflicts, and obtain #13120's agreement on the shared exports. I will rerun conventions, ABI audit, diff check, the stack/mergeability check, and review the exact new head; report the same focused test command on it.
MarcZX10 commented 2026-10-30 13:31:25 +00:00 (Migrated from github.com)

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

Review: APPROVED


Re-checked — new head, looks good

The merge conflict and unconfirmed #13120 order from my previous review are resolved; source review and the current-main preview show no remaining blocker in this head.

What I ran

Reviewed head e058de81c03ef381405375b07dd813d5330ee630 against PR base 42d009f5f37c8f388b01fbfe38d2e704c792c46f. The stack preview against current main da026c70655a132031d45e2008c24f993870d801 was clean. The declared order is #13130 → #13270 → #13277; the first two dependency heads are not yet included because they remain open. Environment: Debian GNU/Linux x86_64, Python 3.11.2. I did not configure, build, compile, or run C++ tests.

python3 AnyPS5/tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13277
python3 AnyPS5/tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 42d009f5f37c8f388b01fbfe38d2e704c792c46f --head e058de81c03ef381405375b07dd813d5330ee630 --json | python3 -c 'import json,sys; d=json.load(sys.stdin); print(json.dumps({"status":d["status"],"findings":d["findings"]},indent=2))'
gh pr checks 13277 --repo boykopovar/AnyPS5

Results

Check Result
Patch whitespace and conventions/template Passed in the precheck report.
ABI audit passed_with_warnings; seven lexical warnings concern the same unchanged helper definitions in Runtime.cpp, not semaphore-specific findings.
Dependency/merge preview Current-main preview is clean. #13130 and #13270 heads are absent from #13277 while those dependencies are open; the declared landing order is explicit. #13120's author confirmed the order and removed the overlapping declarations.
Author-reported focused tests On head e058de81c03ef381405375b07dd813d5330ee630, the author reports 70/70 `np_common
Author-reported mutation check Seven of eight one-line mutations were detected; removing the D0 semaphore deletion was not observable in the test. Not independently reproduced.
Hosted CI Eligibility, library-portability and report passed. The exact-head Windows job and current conventions/labels jobs were pending at final refresh. Linux and specialized jobs were skipped.
Full precheck Incomplete because its isolated checkout lacks the workspace-local ABI-audit and test-quality scripts. I ran the ABI audit separately; the test-quality heuristic did not run.
Unedited output from checks I ran
All conventions checks passed.
{
  "status": "passed_with_warnings",
  "findings": [
    {
      "symbol": "CalloutThread",
      "kind": "public-declaration-not-found",
      "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface."
    },
    {
      "symbol": "HeapAllocate",
      "kind": "public-declaration-not-found",
      "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface."
    },
    {
      "symbol": "HeapReallocate",
      "kind": "public-declaration-not-found",
      "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface."
    },
    {
      "symbol": "HeapRelease",
      "kind": "public-declaration-not-found",
      "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface."
    },
    {
      "symbol": "MemoryHeapAllocate",
      "kind": "public-declaration-not-found",
      "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface."
    },
    {
      "symbol": "MemoryHeapReallocate",
      "kind": "public-declaration-not-found",
      "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface."
    },
    {
      "symbol": "MemoryHeapRelease",
      "kind": "public-declaration-not-found",
      "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface."
    }
  ]
}
PR #13130: **clean** against current base; head `686a5ca0be58c50e23a91516dc0a332d45516be0`; changed paths: none reported
PR #13270: **clean** against current base; head `1f264fdc6480396108557b4e2e2f0731212fd65e`; changed paths: none reported
PR #13277: **clean** against current base; head `e058de81c03ef381405375b07dd813d5330ee630`; changed paths: none reported
#13130 → #13270: **current_dependency_head_not_included**
#13130 → #13277: **current_dependency_head_not_included**
#13270 → #13277: **current_dependency_head_not_included**
conventions	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41060466623/job/124078609755
labels	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41060466531/job/124085748413
windows	pending	0	https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070827007
library-portability	pass	1m43s	https://github.com/boykopovar/AnyPS5/actions/runs/41056437836/job/124065034707
report	pass	1m1s	https://github.com/boykopovar/AnyPS5/actions/runs/41056437640/job/124065033995
linux	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070830093
register-context	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070828820
relinker	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070830445
relinker-asan	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070829889
write-watch	skipping	0	https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070829837
eligibility	pass	5s	https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124065035385

The precheck reported these unavailable helper files in its isolated checkout:

/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13277-e058de81c03e/head-e058de81c03e-f0fe78b9/tools/pr_abi_audit.py': [Errno 2] No such file or directory
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13277-e058de81c03e/head-e058de81c03e-f0fe78b9/tools/pr_test_quality.py': [Errno 2] No such file or directory

Negative control

Assertion Change described by PR author Result
Semaphore timeout, state, count, and destruction behavior is distinguished by the focused test Eight one-line mutations to timeout mapping, timeout use, failed/double initialization, count, state clearing and deletion Author reports seven mutations failed the test; deleting D0's semaphore cleanup was the survivor because the kernel does not safely expose deletion of an invalid handle. Not independently reproduced.

Findings

Blocking

None found in the reviewed head.

Non-blocking

Do not land #13277 before #13130 and #13270. The current dependency heads are not in this branch, but the PR declares that order and the individual merge previews against main are clean. Once those dependencies land, refresh this branch and rerun the relevant integration checks.

Sources

Not verified

I did not independently run Linux tests or mutation checks, run Windows tests, or verify firmware behavior on a console. The hosted Windows job was still in progress at the final refresh.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5712966689 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13277#pullrequestreview-5712966689). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T13:31:25Z. **Review:** APPROVED --- # Re-checked — new head, looks good The merge conflict and unconfirmed #13120 order from my previous review are resolved; source review and the current-main preview show no remaining blocker in this head. ## What I ran Reviewed head `e058de81c03ef381405375b07dd813d5330ee630` against PR base `42d009f5f37c8f388b01fbfe38d2e704c792c46f`. The stack preview against current `main` `da026c70655a132031d45e2008c24f993870d801` was clean. The declared order is #13130 → #13270 → #13277; the first two dependency heads are not yet included because they remain open. Environment: Debian GNU/Linux x86_64, Python 3.11.2. I did not configure, build, compile, or run C++ tests. ```sh python3 AnyPS5/tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13277 python3 AnyPS5/tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 42d009f5f37c8f388b01fbfe38d2e704c792c46f --head e058de81c03ef381405375b07dd813d5330ee630 --json | python3 -c 'import json,sys; d=json.load(sys.stdin); print(json.dumps({"status":d["status"],"findings":d["findings"]},indent=2))' gh pr checks 13277 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Patch whitespace and conventions/template | Passed in the precheck report. | | ABI audit | `passed_with_warnings`; seven lexical warnings concern the same unchanged helper definitions in `Runtime.cpp`, not semaphore-specific findings. | | Dependency/merge preview | Current-main preview is clean. #13130 and #13270 heads are absent from #13277 while those dependencies are open; the declared landing order is explicit. #13120's author confirmed the order and removed the overlapping declarations. | | Author-reported focused tests | On head `e058de81c03ef381405375b07dd813d5330ee630`, the author reports 70/70 `np_common|public_headers` tests and 3/3 `guest_np_common_runtime` runs. Not independently run here. | | Author-reported mutation check | Seven of eight one-line mutations were detected; removing the D0 semaphore deletion was not observable in the test. Not independently reproduced. | | Hosted CI | Eligibility, library-portability and report passed. The exact-head Windows job and current conventions/labels jobs were pending at final refresh. Linux and specialized jobs were skipped. | | Full precheck | Incomplete because its isolated checkout lacks the workspace-local ABI-audit and test-quality scripts. I ran the ABI audit separately; the test-quality heuristic did not run. | <details><summary>Unedited output from checks I ran</summary> ```text All conventions checks passed. ``` ```json { "status": "passed_with_warnings", "findings": [ { "symbol": "CalloutThread", "kind": "public-declaration-not-found", "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface." }, { "symbol": "HeapAllocate", "kind": "public-declaration-not-found", "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface." }, { "symbol": "HeapReallocate", "kind": "public-declaration-not-found", "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface." }, { "symbol": "HeapRelease", "kind": "public-declaration-not-found", "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface." }, { "symbol": "MemoryHeapAllocate", "kind": "public-declaration-not-found", "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface." }, { "symbol": "MemoryHeapReallocate", "kind": "public-declaration-not-found", "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface." }, { "symbol": "MemoryHeapRelease", "kind": "public-declaration-not-found", "message": "No APS5_VABI declaration was found in a header; verify whether this is intentionally private or missing from the public interface." } ] } ``` ```text PR #13130: **clean** against current base; head `686a5ca0be58c50e23a91516dc0a332d45516be0`; changed paths: none reported PR #13270: **clean** against current base; head `1f264fdc6480396108557b4e2e2f0731212fd65e`; changed paths: none reported PR #13277: **clean** against current base; head `e058de81c03ef381405375b07dd813d5330ee630`; changed paths: none reported #13130 → #13270: **current_dependency_head_not_included** #13130 → #13277: **current_dependency_head_not_included** #13270 → #13277: **current_dependency_head_not_included** ``` ```text conventions pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41060466623/job/124078609755 labels pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41060466531/job/124085748413 windows pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070827007 library-portability pass 1m43s https://github.com/boykopovar/AnyPS5/actions/runs/41056437836/job/124065034707 report pass 1m1s https://github.com/boykopovar/AnyPS5/actions/runs/41056437640/job/124065033995 linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070830093 register-context skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070828820 relinker skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070830445 relinker-asan skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070829889 write-watch skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124070829837 eligibility pass 5s https://github.com/boykopovar/AnyPS5/actions/runs/41056437797/job/124065035385 ``` The precheck reported these unavailable helper files in its isolated checkout: ```text /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13277-e058de81c03e/head-e058de81c03e-f0fe78b9/tools/pr_abi_audit.py': [Errno 2] No such file or directory /usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13277-e058de81c03e/head-e058de81c03e-f0fe78b9/tools/pr_test_quality.py': [Errno 2] No such file or directory ``` </details> ## Negative control | Assertion | Change described by PR author | Result | |---|---|---| | Semaphore timeout, state, count, and destruction behavior is distinguished by the focused test | Eight one-line mutations to timeout mapping, timeout use, failed/double initialization, count, state clearing and deletion | Author reports seven mutations failed the test; deleting D0's semaphore cleanup was the survivor because the kernel does not safely expose deletion of an invalid handle. Not independently reproduced. | ## Findings ### Blocking None found in the reviewed head. ### Non-blocking Do not land #13277 before #13130 and #13270. The current dependency heads are not in this branch, but the PR declares that order and the individual merge previews against `main` are clean. Once those dependencies land, refresh this branch and rerun the relevant integration checks. ## Sources - [Semaphore lifecycle and wrapper implementations](https://github.com/boykopovar/AnyPS5/blob/e058de81c03ef381405375b07dd813d5330ee630/core/libs/prx/libSceNpCommon/Runtime.cpp#L888-L947). - [Semaphore runtime tests](https://github.com/boykopovar/AnyPS5/blob/e058de81c03ef381405375b07dd813d5330ee630/core/libs/tests/GuestNpCommonRuntime.cpp#L265-L310). - [Confirmed #13120 overlap order](https://github.com/boykopovar/AnyPS5/pull/13120#issuecomment-6522956813). ## Not verified I did not independently run Linux tests or mutation checks, run Windows tests, or verify firmware behavior on a console. The hosted Windows job was still in progress at the final refresh.
XairRrR commented 2026-11-03 09:51:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T09:51:14Z.

Review: APPROVED


Reviewed — approved

The sce::np::Semaphore wrappers and sceNpWaitSema build and pass their test on the merged tree. Two one-line production mutations each make the new test fail, and I found nothing blocking.

What I ran

Head 8942f0b323347daaa1a33c325d7c4569e84869ac, merged with --no-ff into main 4f41f4c375f5abb487dbd184fbc150f31994d762 (merged tree 6f4a4983a30f456a87f2fc2b73462b00737653e2). Debian 13 VM (32 vCPU, Intel Xeon Gold 6136), GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...8942f0b323347daaa1a33c325d7c4569e84869ac
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ctest --test-dir build -R "^guest_np_common_runtime$" --repeat until-fail:5 --output-on-failure
# negative control (mutations, one at a time, then the merged file restored)
ninja -C build -j32 -l32 tests/guest_np_common_runtime_tests
ctest --test-dir build -R "^guest_np_common_runtime$" --output-on-failure
build/tests/guest_np_common_runtime_tests
git status --porcelain

Results

Check Result
git diff --check Clean
check_conventions.py All conventions checks passed.
Configure, build, libs Succeeded (prepared build)
Selected tests (827 run) 824 passed, 2 skipped (both expected per check_skips.py). 0 new failures, 0 timeouts. The 1 known failure (unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group) also fails on main and is unrelated to this change.
guest_np_common_runtime Passed; 5 of 5 with --repeat until-fail:5 (0.46 s total)
public_headers Passed in the prepared run (61.9 s, the same range as on main in the AMD CI comment; unaffected by this change)
Vulkan validation comparison Skipped by the script: no file under the AGC driver, the shader recompiler or VideoOut changed

Negative control

A revert-only control can't compile, because the test uses NpSemaphoreObject, which this PR adds (JJenkx reported the same on Windows). I mutated single production lines in core/libs/prx/libSceNpCommon/Runtime.cpp instead, rebuilt guest_np_common_runtime_tests, and ran it:

Mutation Result
sceNpWaitSema returns NpResult(status), which drops the 0x8002003C → 0x8055800B mapping Fails: a timed wait on an empty semaphore times out, aborted
A failed Create sets the state to NP_SEMAPHORE_CREATED before returning the error Fails: a refused Create leaves the semaphore uninitialized, aborted

I then restored the merged Runtime.cpp from 6f4a4983a3, rebuilt, and the test passed again. git status --porcelain printed nothing. These two runs confirm part of the author's 8-mutation table. I did not repeat the other six.

Findings

Blocking

None.

Non-blocking

  1. No size check on the guest object layout. NpSemaphoreObject (core/libs/prx/libSceNpCommon/include/Api.hpp:95-99) is described as 24 bytes with state at +0x10, but no static_assert pins this. Runtime.cpp:24-30 already pins NpCallout, NpKernelMemory and similar objects this way. A guest that embeds sce::np::Semaphore in its own classes depends on this layout. Suggested fix: add static_assert(sizeof(NpSemaphoreObject) == 0x18) and an offsetof(..., state) == 0x10 check next to the others.
  2. Missing blank line. core/libs/prx/libSceNpCommon/Runtime.cpp:1328-1329: Signal ends right against MemoryStreamReaderC1 with no blank line. This is probably left over from the merge. It is cosmetic only.
  3. Duplicated close/delete branch (style). D1 (Runtime.cpp:1280-1284) repeats the opened/created branch inline with sceKernelDeleteSema, while D0 and Destroy go through ReleaseSemaphore with sceNpDeleteSema (Runtime.cpp:297-300). The description says the module does it this way (the kernel call directly in D1/D2). Because sceNpDeleteSema throws its result away there, the behaviour is the same, so this needs no change unless the author wants the asymmetry to read as intentional.

Earlier review points: MarcZX10's blocking items (landing order with #13120, and the conflicts with main) were resolved in their own re-review. The order is recorded on the checklist line. This head merges cleanly with main 4f41f4c375.

Rules check: the only code changes are exports and helpers, with no new comments. Open and the opened-state close branches throw through NotImplemented_nid_no_patch, and the debt file lists both. The std::invalid_argument before Create is also recorded as a deviation. The checklist lines (Depends on, Fixes, Unblocks, GPUs tested, AI-assisted) are present. The test runs well under 30 s.

Not verified

  • The firmware 13.60 behaviour (error codes, the vtable layout {0, 0, D1, D0}, D1 calling the kernel directly, Wait(0) meaning no timeout). It comes from the author's disassembly, and I did not check it against the module or a console.
  • That D0 releases the kernel semaphore. As the author says, the test can't observe this, and I did not add a check.
  • Windows and macOS builds. I built only on Linux.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5750070505 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13277#pullrequestreview-5750070505). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T09:51:14Z. **Review:** APPROVED --- # Reviewed — approved The `sce::np::Semaphore` wrappers and `sceNpWaitSema` build and pass their test on the merged tree. Two one-line production mutations each make the new test fail, and I found nothing blocking. ## What I ran Head `8942f0b323347daaa1a33c325d7c4569e84869ac`, merged with `--no-ff` into `main` `4f41f4c375f5abb487dbd184fbc150f31994d762` (merged tree `6f4a4983a30f456a87f2fc2b73462b00737653e2`). Debian 13 VM (32 vCPU, Intel Xeon Gold 6136), GCC 14.2.0, Release, Ninja, `BUILD_TESTING=ON`. ```sh git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...8942f0b323347daaa1a33c325d7c4569e84869ac python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ctest --test-dir build -R "^guest_np_common_runtime$" --repeat until-fail:5 --output-on-failure # negative control (mutations, one at a time, then the merged file restored) ninja -C build -j32 -l32 tests/guest_np_common_runtime_tests ctest --test-dir build -R "^guest_np_common_runtime$" --output-on-failure build/tests/guest_np_common_runtime_tests git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | Clean | | `check_conventions.py` | `All conventions checks passed.` | | Configure, build, `libs` | Succeeded (prepared build) | | Selected tests (827 run) | 824 passed, 2 skipped (both expected per `check_skips.py`). 0 new failures, 0 timeouts. The 1 known failure (`unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group`) also fails on `main` and is unrelated to this change. | | `guest_np_common_runtime` | Passed; 5 of 5 with `--repeat until-fail:5` (0.46 s total) | | `public_headers` | Passed in the prepared run (61.9 s, the same range as on `main` in the AMD CI comment; unaffected by this change) | | Vulkan validation comparison | Skipped by the script: no file under the AGC driver, the shader recompiler or VideoOut changed | ## Negative control A revert-only control can't compile, because the test uses `NpSemaphoreObject`, which this PR adds (JJenkx reported the same on Windows). I mutated single production lines in `core/libs/prx/libSceNpCommon/Runtime.cpp` instead, rebuilt `guest_np_common_runtime_tests`, and ran it: | Mutation | Result | |---|---| | `sceNpWaitSema` returns `NpResult(status)`, which drops the `0x8002003C` → `0x8055800B` mapping | **Fails**: `a timed wait on an empty semaphore times out`, aborted | | A failed `Create` sets the state to `NP_SEMAPHORE_CREATED` before returning the error | **Fails**: `a refused Create leaves the semaphore uninitialized`, aborted | I then restored the merged `Runtime.cpp` from `6f4a4983a3`, rebuilt, and the test passed again. `git status --porcelain` printed nothing. These two runs confirm part of the author's 8-mutation table. I did not repeat the other six. ## Findings ### Blocking None. ### Non-blocking 1. **No size check on the guest object layout.** `NpSemaphoreObject` (`core/libs/prx/libSceNpCommon/include/Api.hpp:95-99`) is described as 24 bytes with `state` at +0x10, but no `static_assert` pins this. `Runtime.cpp:24-30` already pins `NpCallout`, `NpKernelMemory` and similar objects this way. A guest that embeds `sce::np::Semaphore` in its own classes depends on this layout. Suggested fix: add `static_assert(sizeof(NpSemaphoreObject) == 0x18)` and an `offsetof(..., state) == 0x10` check next to the others. 2. **Missing blank line.** `core/libs/prx/libSceNpCommon/Runtime.cpp:1328-1329`: `Signal` ends right against `MemoryStreamReaderC1` with no blank line. This is probably left over from the merge. It is cosmetic only. 3. **Duplicated close/delete branch (style).** `D1` (`Runtime.cpp:1280-1284`) repeats the opened/created branch inline with `sceKernelDeleteSema`, while `D0` and `Destroy` go through `ReleaseSemaphore` with `sceNpDeleteSema` (`Runtime.cpp:297-300`). The description says the module does it this way (the kernel call directly in D1/D2). Because `sceNpDeleteSema` throws its result away there, the behaviour is the same, so this needs no change unless the author wants the asymmetry to read as intentional. Earlier review points: MarcZX10's blocking items (landing order with #13120, and the conflicts with `main`) were resolved in their own re-review. The order is recorded on the checklist line. This head merges cleanly with `main` `4f41f4c375`. Rules check: the only code changes are exports and helpers, with no new comments. `Open` and the opened-state close branches throw through `NotImplemented_nid_no_patch`, and the debt file lists both. The `std::invalid_argument` before `Create` is also recorded as a deviation. The checklist lines (Depends on, Fixes, Unblocks, GPUs tested, AI-assisted) are present. The test runs well under 30 s. ## Not verified - The firmware 13.60 behaviour (error codes, the vtable layout `{0, 0, D1, D0}`, D1 calling the kernel directly, `Wait(0)` meaning no timeout). It comes from the author's disassembly, and I did not check it against the module or a console. - That `D0` releases the kernel semaphore. As the author says, the test can't observe this, and I did not add a check. - Windows and macOS builds. I built only on Linux. <!-- anyps5-bots job=2462 head=8942f0b323347daaa1a33c325d7c4569e84869ac -->
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!13277
No description provided.