feat(libkernel): export sceKernelInternalMemoryGetAvailableSize #4530
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4530"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-12T14:36:44Z.
What
Exports
sceKernelInternalMemoryGetAvailableSize(rjEuM0nb8xg) in libkernel, next tosceKernelAvailableFlexibleMemorySize. It writes 0 and returns 0, and returnsEINVALfor a null pointer as its siblings do. It is a silent stub, listed in TechnicalDebt: nothing public says what the console's internal memory pool holds or how big it is.The name is the one
tools/nid_names.py's aerolib list gives for the NID. Theint (size_t*)signature is from xUtilty (PS4).PS5SX2 (PPSA99203) calls it once while starting its GS renderer, GS.cpp L233-L247:
The result is never read.
Where a title reaches it
PS5SX2 relinks only with
--trap-sdk-syscall-stubs(#3804, see #2136), which these runs use. It reaches this import after #4466 (sceKernelGetMainSocIdand friends) and asetitimerPR (#4382 was used here; #3800 also implements it). On a stack ofmain8fa5cc48+ #4466 + #4382:undefined symbol: rjEuM0nb8xgFAIL: unresolved ELF import rjEuM0nb8xg from libkernel.prxavvJ3J0H0EY(sceKernelJitCreateSharedMemory, which #3787 implements) on both:undefined symbol: avvJ3J0H0EYFAIL: unresolved ELF import avvJ3J0H0EY from libkernel.prxTested
Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release, on 664160b5:
guest_memorypasses 5/5 (--repeat until-fail:5) on both. No warnings inDirectMemory/Export.cpporGuestMemory.cpp. The new check covers both behaviours: the call writes 0 and returns 0, and a null pointer returnsEINVAL.check_conventions.pypasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)setitimerPR (#4382 or #3800) for PS5SX2 to reach it (#4466 has merged); the code itself builds and passes alone onmainImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T14:37:07Z.
Progress report (
682ef0c→ e95bd66)📈 System libraries: 86.37% (+0.01%, +1 implemented functions)
✅ 1 implemented
sceKernelInternalMemoryGetAvailableSizeImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T15:42:10Z.
Review: COMMENTED
The unit-test control is the part a reader can reproduce — with the parent's
Export.cppand this PR's test file, the test binary will not even link. At the head in a worktreeguest_memorypasses (100% tests passed out of 1underctest -R '^guest_memory$'; a loose-R guest_memoryalso selectsguest_memory_pool_stats, which this target does not build). Then, reverting onlycore/libs/prx/libkernel/DirectMemory/Export.cppto8fa5cc486:libkernel.prxitself still links in that state — nothing inside it references the symbol — so the stop is the test link, and what it shows is that the pre-PR tree has no such export. It is the same shape of stop as your title rows but at a different stage: yours is the relinker resolving a guest import at title load, mine is the host linker on a test binary, and I did not reproduce the title stack (main + #4466 + #4382).rjEuM0nb8xg sceKernelInternalMemoryGetAvailableSize, line 84887 of 159,042 in theaerolib.csvthattools/nid_names.pydownloads (zecoxao/sce_symbols@2883963) — so the name-hashing detour was not needed, unless the list you searched predates that entry. The two derivations agree, and so does the repo's own:tools/nid_names.py'scompute_nidreturnsrjEuM0nb8xgfor this name, and the same function returnsavvJ3J0H0EYforsceKernelJitCreateSharedMemory, the next stop your body reports.GS.cppdeclaresint sceKernelInternalMemoryGetAvailableSize(long long*)— the definition here takessize_t*, the same width on both targets — andinternal_availoccurs only at lines 245 and 247 of that 1533-line file, so the value really is unused. Nothing in the tree allocates or accounts for an internal pool either: against the parent,grep -i InternalMemoryreturns only the segment-info stub.sceKernelAvailableFlexibleMemorySizereturns448 MiB − (images + used)andsceKernelConfiguredFlexibleMemorySizereturns448 MiB— so a title that reads both and sizes something from the sum sees one real number and one zero. Nothing has been shown to do that, and the one caller we have never reads the value; the note is only so the choice reads as deliberate.Written with AI assistance.
Hermes Agent 🤖 at your service
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-12T16:20:33Z.
Thanks for checking. You're right about the NID:
rjEuM0nb8xgis in the pinned aerolib list. I was looking it up in a smaller name table of my own, not the listtools/nid_names.pydownloads. I've corrected the sentence here and the same one in #4466, whose three NIDs are in that list too.On the 0: it's deliberate. AnyPS5 has no internal pool, so any other number would be made up, and taking the flexible-memory figure would suggest the two pools are the same. Writing 0 keeps it visibly a stub, and it's listed under silent stubs in TechnicalDebt. If a title ever sizes something from it, that entry is where it would show up.
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T17:46:11Z.
Both readings hold, and the stub's placement checks out. Read at
664160b5f.aerolib.csvthe project's own tooling downloads, and the two derivations agreeing is the line worth keeping in the body.docs/dev/TechnicalDebt.mdhas### Silent stubsat line 16 and the next header at line 60, and thesceKernelInternalMemoryGetAvailableSizeentry is line 58 — inside that section, not above it. A deliberate 0 with the entry pointing at the file is exactly the state a title's log line should land on, and it is the opposite of the silent-stub problem the rule exists for.The link-level control is still the reproducible half for a reader: reverting
DirectMemory/Export.cppalone stops the test link, notlibkernel.prx.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T21:12:35Z.
#4466 and #3800 are merged, so PPSA99203 reaches
rjEuM0nb8xgonmainnow. It conflicts withmainagain; please rebase, and I'll build and merge it.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-12T21:23:35Z.
Rebased onto
main559979dc(ff56dadc). The only conflict wasGuestMemory.cpp, whereCheckPageTableStatslanded beside this test; both are kept.Checked on that head, Linux (GCC 13) and Windows 11 (WinLibs GCC 15.2), Release:
guest_memory5/5 on both, no warnings in the PR's files. PS5SX2 (PPSA99203, catalog vk-285-163,--trap-sdk-syscall-stubs):main559979dc:FAIL: unresolved ELF import rjEuM0nb8xg from libkernel.prxsetitimerare onmainnow) and it starts running. It then stops atsysctlbyname("machdep.tsc_freq"), which I'll open separately.