feat(libkernel): report hw.realmem through sysctl #5098
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5098"
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 p3n1cillin on 2026-10-13T11:38:13Z.
What
The Dolphin core that RetroArch (PPSA99169) ships,
cores/dolphin_libretro.so, stops on Windows a few seconds into a GameCube boot:MIB {6, 12} is {
CTL_HW,HW_REALMEM}. Dolphin'sMemPhysicalreads it on FreeBSD as the machine's memory size, into asize_t, without checking the result.sysctlnow answers {6, 12}, andsysctlbyname("hw.realmem")maps to it. It returns the same value and checks ashw.physmem{6, 5}: 8 bytes holding the_SC_PHYS_PAGESpages of 16 KiB, read-only (EPERMfor a write) andENOMEMfor a short buffer, the same handling FreeBSD'ssysctl_hw_realmemgives it next tosysctl_hw_physmem. FreeBSD reports there the memory the firmware describes, which is at leasthw.physmem; AnyPS5 has one memory size and the console's values are unknown. This is recorded under Unknown function info indocs/dev/debt/libkernel.md.Tested
--executable picker/picker.bin --executable es-de/es-de.binand started in its game mode (--ps5-mode=game). The game request names/app0/cores/dolphin_libretro.soand a 288-byte GameCube DOL I wrote: one text section at 0x80003100 holdingb .. No game files were involved.Starting core = GameCube mode, loads its Vulkan shader caches andBooting from executable: /app0/selftest/loop.dol, then runs for the whole 75 s run.selecton pipes, which RetroArch's web server needs) merged.guest_system_configuration: thehw.physmemcheck now also runs for {6, 12} andhw.realmem(length query, value, short buffer,EPERMfor a write throughsysctlandsysctlbyname). All 124 libkernel tests pass on Windows; Linux was not built locally.python tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T11:59:10Z.
Linux run of this change: Ubuntu in WSL2, GCC 15.2.0, Ninja Release,
BUILD_TESTING=ON, full build. Built from a local integration heada14a49d8d, which ismain5d50886eewith this PR and my other open library PRs merged (#5013, #5009, #5061, #5078, #5098; no conflicts). All 121 libkernel tests and all 68 libc tests pass, includingguest_system_configuration,guest_getrlimitandguest_select. Not run alone on Linux; no title run on Linux.Imported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-13T12:48:10Z.
Tested on Linux x86-64 (Release build), with b16f8f35d cherry-picked onto main
14036cb0e:guest_system_configurationpasses.SystemConfiguration.cppand the PR's test it aborts withsysctl_nid_postfix: unsupported MIB 6.12It also cherry-picks cleanly together with #5078, which edits the same files.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T01:25:36Z.
Rebased onto main to resolve the conflict in
docs/dev/debt/libkernel.mdafter #5185; no other change.