Repository navigation
feat(libkernel): export sceKernelInternalMemoryGetAvailableSize - #4530
oneandonlydean merged 1 commit into
Conversation
Dextroid17
left a comment
There was a problem hiding this comment.
The unit-test control is the part a reader can reproduce — with the parent's Export.cpp and this PR's test file, the test binary will not even link. At the head in a worktree guest_memory passes (100% tests passed out of 1 under ctest -R '^guest_memory$'; a loose -R guest_memory also selects guest_memory_pool_stats, which this target does not build). Then, reverting only core/libs/prx/libkernel/DirectMemory/Export.cpp to 8fa5cc486:
ninja: build stopped: subcommand failed. (build exit 1)
/usr/bin/ld: GuestMemory.cpp:(.text.startup+0x2f0): undefined reference to `sceKernelInternalMemoryGetAvailableSize'
/usr/bin/ld: GuestMemory.cpp:(.text.startup+0x318): undefined reference to `sceKernelInternalMemoryGetAvailableSize'
libkernel.prx itself 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).
- On the NID: it is in the list the project's own tooling uses —
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. - The title evidence holds as far as the source goes:
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. - Optional, body only: 0 is the opposite convention to its neighbours in the same file —
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
|
Thanks for checking. You're right about the NID: 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. |
|
Both readings hold, and the stub's placement checks out. Read at
The link-level control is still the reproducible half for a reader: reverting Written with AI assistance. |
664160b to
e95bd66
Compare
|
Rebased onto Checked on that head, Linux (GCC 13) and Windows 11 (WinLibs GCC 15.2), Release:
|
e95bd66 to
ff56dad
Compare
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 ofmain8fa5cc4 + #4466 + #4382:undefined symbol: rjEuM0nb8xgFAIL: unresolved ELF import rjEuM0nb8xg from libkernel.prxavvJ3J0H0EY(sceKernelJitCreateSharedMemory, which feat(libkernel): implement the JIT shared memory calls #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 664160b:
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 (feat(libkernel): implement setitimer #4382 or feat(libkernel): add setitimer on the alarm timer #3800) for PS5SX2 to reach it (feat(libkernel): export sceKernelGetMainSocId, sceKernelGetCpumode and sceKernelGetCpuFrequency #4466 has merged); the code itself builds and passes alone onmain