feat(libkernel): report no write throttling in sceKernelWriteThrottlingStatus #1095

Merged
kjhq merged 2 commits from upstream-pr/1095 into main 2026-10-08 07:11:52 +00:00
kjhq commented 2026-10-07 10:42:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kjhq on 2026-10-07T10:42:01Z.


What

Adds sceKernelWriteThrottlingStatus(uint64_t status[4]). The PS5 limits how much a title may write to the SSD; this call reports the current state. The host has no such budget, so the call always reports that writing is not throttled:

  • status[0] (a write allowance in 64 KiB units) = UINT32_MAX
  • status[1..3] = 0
  • a null pointer throws

The signature and the unit of status[0] come from PPSA17221 (Minecraft). Its only caller (eboot VA 0xb7338b0) works as follows:

  • It zeroes a 32-byte buffer, calls the function, and reads only the first qword.
  • It shifts that qword left by 16 (64 KiB units) and compares the byte count with thresholds 0x8F00000, 0x11F00001, 0x25700001 and 0x4AF00001 to pick one of five tiers.
  • If the call returns non-zero, it uses 0x4B000001 bytes instead. That takes the same top tier as UINT32_MAX.

TechnicalDebt (Functional) records what remains unknown: whether the value is a remaining budget or a rate on hardware, and what the other three qwords mean.

The function sits next to sceKernelFsync in File/src/Stdio.cpp. guest_filesystem checks the written values.

Title

PPSA17221 (Minecraft) needs #716 to load the modules in its app root, so every run below is current main + #716 + the PRs of this set (#1088, #1090–#1096), plus local changes outside it: dialog, NpAuth and TextToSpeech2 stubs that open PRs cover (#560, #925, #301) and a GPU end-of-pipe change that is not submitted. With all of them the title loads a world. The line below is from a run with only this PR left out, Windows 11, WinLibs GCC, normal user session.

Without it startup stops at load:

FAIL: unresolved ELF import YFC3dBBipj8 from libkernel.prx

YFC3dBBipj8 is sceKernelWriteThrottlingStatus.

Tested

Debian 13 (WSL2), GCC 14.2.0, Release: full ctest 390/390 passed (GPU tests skipped: no Vulkan device in WSL), including guest_filesystem.

Windows 11, WinLibs GCC: PPSA17221 with this PR and the rest of the set loads a world (runs described above). Not tested with Windows ctest.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4771454183 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1095). Originally posted by [kjhq](https://github.com/kjhq) on 2026-10-07T10:42:01Z. --- ### What Adds `sceKernelWriteThrottlingStatus(uint64_t status[4])`. The PS5 limits how much a title may write to the SSD; this call reports the current state. The host has no such budget, so the call always reports that writing is not throttled: - `status[0]` (a write allowance in 64 KiB units) = `UINT32_MAX` - `status[1..3]` = 0 - a null pointer throws The signature and the unit of `status[0]` come from PPSA17221 (Minecraft). Its only caller (eboot VA `0xb7338b0`) works as follows: - It zeroes a 32-byte buffer, calls the function, and reads only the first qword. - It shifts that qword left by 16 (64 KiB units) and compares the byte count with thresholds `0x8F00000`, `0x11F00001`, `0x25700001` and `0x4AF00001` to pick one of five tiers. - If the call returns non-zero, it uses `0x4B000001` bytes instead. That takes the same top tier as `UINT32_MAX`. TechnicalDebt (Functional) records what remains unknown: whether the value is a remaining budget or a rate on hardware, and what the other three qwords mean. The function sits next to `sceKernelFsync` in `File/src/Stdio.cpp`. `guest_filesystem` checks the written values. ### Title PPSA17221 (Minecraft) needs #716 to load the modules in its app root, so every run below is current `main` + #716 + the PRs of this set (#1088, #1090–#1096), plus local changes outside it: dialog, NpAuth and TextToSpeech2 stubs that open PRs cover (#560, #925, #301) and a GPU end-of-pipe change that is not submitted. With all of them the title loads a world. The line below is from a run with only this PR left out, Windows 11, WinLibs GCC, normal user session. Without it startup stops at load: ``` FAIL: unresolved ELF import YFC3dBBipj8 from libkernel.prx ``` `YFC3dBBipj8` is `sceKernelWriteThrottlingStatus`. ### Tested Debian 13 (WSL2), GCC 14.2.0, Release: full `ctest` 390/390 passed (GPU tests skipped: no Vulkan device in WSL), including `guest_filesystem`. Windows 11, WinLibs GCC: PPSA17221 with this PR and the rest of the set loads a world (runs described above). Not tested with Windows `ctest`. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-07 13:54:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T13:54:13Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1116 docs/dev/TechnicalDebt.md L211
#1126 docs/dev/TechnicalDebt.md L211
#1184 docs/dev/TechnicalDebt.md L211
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6039460688 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1095#issuecomment-6039460688). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T13:54:13Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1116 | `docs/dev/TechnicalDebt.md` [L211](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/docs/dev/TechnicalDebt.md#L211) | | | | #1126 | `docs/dev/TechnicalDebt.md` [L211](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/docs/dev/TechnicalDebt.md#L211) | | | | #1184 | `docs/dev/TechnicalDebt.md` [L211](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/docs/dev/TechnicalDebt.md#L211) | | |
github-actions[bot] commented 2026-10-08 04:35:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T04:35:57Z.


Progress report (66b8abd → 329c825)

➖ System libraries: 85.22% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel sceKernelWriteThrottlingStatus
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6052335004 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1095#issuecomment-6052335004). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T04:35:57Z. --- <!-- progress-report --> ### Progress report (66b8abd → 329c825) ➖ **System libraries**: 85.22% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `sceKernelWriteThrottlingStatus` | </details>
adriadam10 commented 2026-10-08 06:43:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T06:43:59Z.


Checked: build + full ctest on this head (390/390) and on the rebase (419/419); guest_filesystem fails to link without the change, so it exercises it. The NID matches the one KytyPS5 registers, and the TechnicalDebt entry records what is inferred from PPSA17221 and what is unknown.

It conflicted with main in docs/dev/TechnicalDebt.md (the new Http2 line). I rebased and kept both lines; nothing else changed. Merging once CI is green on the rebased head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6054120359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1095#issuecomment-6054120359). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T06:43:59Z. --- Checked: build + full ctest on this head (390/390) and on the rebase (419/419); `guest_filesystem` fails to link without the change, so it exercises it. The NID matches the one KytyPS5 registers, and the TechnicalDebt entry records what is inferred from PPSA17221 and what is unknown. It conflicted with main in `docs/dev/TechnicalDebt.md` (the new Http2 line). I rebased and kept both lines; nothing else changed. Merging once CI is green on the rebased head.
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!1095
No description provided.