Skip to content

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

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
kjhq:feat/libkernel-write-throttling
Oct 8, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
kjhq:feat/libkernel-write-throttling

Conversation

@kjhq

@kjhq kjhq commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Progress report (66b8abd → 329c825)

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

✅ 1 implemented
Library Name
libkernel sceKernelWriteThrottlingStatus

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 8, 2026
kjhq added 2 commits October 8, 2026 08:21
…ngStatus

The host has no SSD write budget, so the status reports the largest budget in its first qword and zeroes the rest.
@adriadam10

Copy link
Copy Markdown
Collaborator

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.

@adriadam10
adriadam10 force-pushed the feat/libkernel-write-throttling branch from 53c8e67 to 329c825 Compare October 8, 2026 06:43
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 8, 2026
@adriadam10
adriadam10 merged commit 979ae68 into boykopovar:main Oct 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants