fix(libkernel): place sceKernelReserveVirtualRange at its address hint #2758
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2758"
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 TheAggie on 2026-10-10T13:07:23Z.
What
sceKernelReserveVirtualRangedropped its address unlessMAP_FIXEDwas set.1d806a46made fixed reservations land at their address and left the others "placed as before", which means at the lowest free address. WithoutMAP_FIXED, the address is a hint, as in FreeBSD'smmap: the reservation goes at the hint when that range is free, and otherwise at the first free range above it. This passes the hint toMapAligned, which already places a non-fixed mapping that way. Fixed reservations are unchanged.Found with RetroArch (PPSA99169). Its PS5 platform layer reserves the cores' direct-memory heap at a hint near 0x2000000000, outside the GPU window (0x200000000-0x300000000), and refuses a range inside that window. With the hint dropped, every reservation landed at 0x200400000, the heap was never created, and the Dolphin core's first aligned allocation returned null.
Tested
Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.
guest_memory,CheckHintedVirtualReservation: a reservation at a free hint lands exactly there, and one whose hint is taken lands above it, not below. With the old line it fails (GuestMemory.cpp:477, the reservation that should land at its hint).guest_memoryalready stops later, atCheckGuestModuleImageProtection(itsdlopenof the test module returns null). That happens on cleanmaincf8b129e2too; the new check runs before it and passes.maincf8b129e2. Full suite: 550 of 554 pass, 1 skipped. Besidesguest_memory,agc_driver_prepared_shaders_debug_failurealso fails on cleanmainon this machine, andguest_module_identityfailed once and passed when rerun alone. It was run from the generatedCTestTestfile.cmakecommands because antivirus blocksctest.exeon this machine.tools/check_conventions.pypasses.mainalone.Not tested on Linux or macOS.
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)DirectMemory.cppandGuestMemory.cppbut not the reservation code. It conflicts with currentmainin those files by itself.🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T13:15:03Z.
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.
main)core/libs/tests/GuestMemory.cppL468, L1528Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-10T13:32:56Z.
Checked merged onto
main78aedb40(Linux, GCC 16.2.1, Release):guest_memorypasses. With onlyDirectMemory.cppreverted it fails in 3 of 3 runs atGuestMemory.cpp:477(Require(placed == hint)), so the new test does cover the change.cteston an NVIDIA RTX 5080 (615.78.08) and on RADV (Radeon 610M, Mesa 26.1.4): no failure thatmaindoesn't already have.