Skip to content

fix(libkernel): answer sceKernelGetPageTableStats - #4101

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/kernel-page-table-stats
Oct 12, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/kernel-page-table-stats

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Resonance: A Plague Tale Legacy (PPSA30601) stops at sceKernelGetPageTableStats not implemented once its imports are exported (#4067). The call now answers instead of throwing:

  • Signature int sceKernelGetPageTableStats(int* cpuTotal, int* cpuAvailable, int* gpuTotal, int* gpuAvailable), as in OpenOrbis' libkernel.h, the Orbital type database and SharpProspero (KernelMemoryQuery.cs: "how many page-table entries the module was given for each side and how many are left").
  • It reports 2048 entries on each side (a 4 GiB pool of 2 MiB entries, the constants of KytyPS5's KernelGetPageTableStats) and all of them available. KytyPS5 additionally counts the 2 MiB entries of the committed ranges as used; this PR does not. A null pointer returns SCE_KERNEL_ERROR_EFAULT, as in KytyPS5.
  • The numbers are KytyPS5's, not measured on a console. Nothing in the SDK headers or the other sources I found says what the console reports; if a plausible value from another emulator is not acceptable here, the alternative is to keep the throwing stub, with the cost that PPSA30601 stays stopped at this call. The entry is in the TechnicalDebt silent-stub list with these limits.

CheckPageTableStats in GuestMemory.cpp covers the answer and the four null-pointer cases; without the change the call throws and the test aborts.

Tested

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 (Claude Code)

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Progress report (529f7bf → d283d48)

📈 System libraries: 87.39% (+0.02%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel sceKernelGetPageTableStats

@xXPBSXx

xXPBSXx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Merged current main into the branch (conflict in core/libs/tests/GuestMemory.cpp only, both new test calls kept: CheckPageTableStats and CheckMunmapOverUnmappedPages). Windows, GCC: guest_memory tests pass, tools/check_conventions.py --base upstream/main passes. No code change.

AI-assisted (Claude Code).

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Please rebase onto main instead of merging it in: 5cec557 is a merge commit, and branches here carry none. No code change needed.

@xXPBSXx

xXPBSXx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (2a5eca11c) as requested: one commit, no merge commit, the branch was force-updated with a lease. Tests on this base (Windows, MinGW, no GPU tests): guest_memory_pool_stats and guest_memory pass, check_conventions passes.

AI-assisted (Claude Code).

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@xXPBSXx
xXPBSXx force-pushed the fix/kernel-page-table-stats branch from de0fd77 to ab01948 Compare October 12, 2026 19:10
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@xXPBSXx
xXPBSXx force-pushed the fix/kernel-page-table-stats branch from ab01948 to 2f356c1 Compare October 12, 2026 20:42
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 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
#4374 docs/dev/debt/libkernel.md L160
#4376 docs/dev/debt/libkernel.md L160
#4379 docs/dev/debt/libkernel.md L160
#4386 docs/dev/debt/libkernel.md L160
#4530 core/libs/tests/GuestMemory.cpp L115
#4651 docs/dev/debt/libkernel.md L160

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
PPSA30601 (Resonance) stops at the throwing stub. The four int* arguments follow
OpenOrbis' libkernel.h, the Orbital type database and SharpProspero; the values
follow KytyPS5 (2048 entries of 2 MiB per side) without its accounting of used
entries, listed in TechnicalDebt.md. A null pointer returns EFAULT.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked against KytyPS5 KernelGetPageTableStats (constants, EFAULT on null pointers), merged onto current main with a scoped build and ctest (141/141, guest_memory and guest_memory_pool_stats pass), and guest_memory fails without the change. The debt entry records the unmeasured values and the missing used-entry count; merging.

@adriadam10
adriadam10 merged commit 5ccb19b into boykopovar:main Oct 12, 2026
8 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.

3 participants