docs(debt): correct sceKernelCreateSema attributes and a broken libkernel anchor #16215

Merged
MarcZX10 merged 1 commit from upstream-pr/16215 into main 2026-11-10 21:39:18 +00:00
MarcZX10 commented 2026-11-05 20:53:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-05T20:53:34Z.


What

  • docs/dev/debt/libkernel.md, "Silent stubs", sceKernelCreateSema: the entry said attributes 0x100 to 0x102 are accepted and ignored. core/libs/prx/libkernel/Semaphore/src/Semaphore.cpp returns SCE_KERNEL_ERROR_EINVAL when (attr & ~0x103u) != 0, so they are rejected and nothing is created. The console measurement is kept, labelled as the console's behaviour.
  • docs/dev/debt/libkernel_sys.md, nanosleep entry: the link libkernel.md#short-sleeps-ended-by-gpu-and-flip-completions pointed to a heading that does not exist. The bullet is under ### Functional in libkernel.md, so the link now points to libkernel.md#functional.

Commits: one per statement corrected (2 commits, docs only).

Tested

  • Ran: python3 tools/check_conventions.py --base upstream/main (passed), git diff --check upstream/main (clean).
  • Not run: no build (docs only). The code citation was read in Semaphore.cpp at upstream/main, not run against a binary.

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:5178557497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16215). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-05T20:53:34Z. --- ### What - `docs/dev/debt/libkernel.md`, "Silent stubs", `sceKernelCreateSema`: the entry said attributes 0x100 to 0x102 are accepted and ignored. `core/libs/prx/libkernel/Semaphore/src/Semaphore.cpp` returns `SCE_KERNEL_ERROR_EINVAL` when `(attr & ~0x103u) != 0`, so they are rejected and nothing is created. The console measurement is kept, labelled as the console's behaviour. - `docs/dev/debt/libkernel_sys.md`, nanosleep entry: the link `libkernel.md#short-sleeps-ended-by-gpu-and-flip-completions` pointed to a heading that does not exist. The bullet is under `### Functional` in `libkernel.md`, so the link now points to `libkernel.md#functional`. Commits: one per statement corrected (2 commits, docs only). ### Tested - Ran: `python3 tools/check_conventions.py --base upstream/main` (passed), `git diff --check upstream/main` (clean). - Not run: no build (docs only). The code citation was read in `Semaphore.cpp` at upstream/main, not run against a binary. ### Checklist - [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
gabichuuuuu commented 2026-11-08 21:55:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T21:55:37Z.

Review: COMMENTED


Docs check of head 22c9aa17fa against main 0bae53facd: I compared what the entry says about the code with the code, and checked the links and counts. I can't check the console measurements themselves.

The new sceKernelCreateSema wording is the opposite of what the code does. The check is if ((attr & ~0x103u) != 0 || (attr & 3u) == 3u || ...) return SCE_KERNEL_ERROR_EINVAL; (Semaphore.cpp:30). For 0x100, 0x101 and 0x102, attr & ~0x103u is 0 and attr & 3u isn't 3, so they're accepted; only 0x103 is rejected. Bit 0x100 is then ignored, because only attr & 3u is used (lines 33 and 34). So main's "accepted and ignored" is right, and "rejected here with EINVAL" isn't.

The anchor fix is right: #short-sleeps-ended-by-gpu-and-flip-completions matches no heading, because that entry is a list item. #functional resolves to the section that contains it.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5819833157 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16215#pullrequestreview-5819833157). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T21:55:37Z. **Review:** COMMENTED --- Docs check of head `22c9aa17fa` against `main` `0bae53facd`: I compared what the entry says about the code with the code, and checked the links and counts. I can't check the console measurements themselves. **The new `sceKernelCreateSema` wording is the opposite of what the code does.** The check is `if ((attr & ~0x103u) != 0 || (attr & 3u) == 3u || ...) return SCE_KERNEL_ERROR_EINVAL;` (`Semaphore.cpp:30`). For 0x100, 0x101 and 0x102, `attr & ~0x103u` is 0 and `attr & 3u` isn't 3, so they're accepted; only 0x103 is rejected. Bit 0x100 is then ignored, because only `attr & 3u` is used (lines 33 and 34). So `main`'s "accepted and ignored" is right, and "rejected here with EINVAL" isn't. The anchor fix is right: `#short-sleeps-ended-by-gpu-and-flip-completions` matches no heading, because that entry is a list item. `#functional` resolves to the section that contains it.
adriadam10 commented 2026-11-10 07:19:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-10T07:19:19Z.

Review: CHANGES_REQUESTED


  • docs/dev/debt/libkernel.md:5: the new wording is wrong. Semaphore.cpp:30 rejects attr & ~0x103u or (attr & 3u) == 3u, so 0x100, 0x101 and 0x102 pass the check and are accepted; only 0x103 returns SCE_KERNEL_ERROR_EINVAL. Bit 0x100 is then ignored because only attr & 3u is used (lines 33-34). The existing "accepted and ignored" entry on main is correct. Please drop the sceKernelCreateSema commit (or, if you want to add something, say that only 0x103 is rejected).
  • docs/dev/debt/libkernel_sys.md:421: the #functional anchor is right; that commit is fine as is.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5838094036 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16215#pullrequestreview-5838094036). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-11-10T07:19:19Z. **Review:** CHANGES_REQUESTED --- - `docs/dev/debt/libkernel.md:5`: the new wording is wrong. `Semaphore.cpp:30` rejects `attr & ~0x103u` or `(attr & 3u) == 3u`, so 0x100, 0x101 and 0x102 pass the check and are accepted; only 0x103 returns `SCE_KERNEL_ERROR_EINVAL`. Bit 0x100 is then ignored because only `attr & 3u` is used (lines 33-34). The existing "accepted and ignored" entry on `main` is correct. Please drop the `sceKernelCreateSema` commit (or, if you want to add something, say that only 0x103 is rejected). - `docs/dev/debt/libkernel_sys.md:421`: the `#functional` anchor is right; that commit is fine as is.
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!16215
No description provided.