Repository navigation
fix(libkernel): place sceKernelReserveVirtualRange at its address hint - #2758
Merged
oneandonlydean merged 1 commit intoOct 10, 2026
Merged
Conversation
Without MAP_FIXED the address is a hint, as for FreeBSD's mmap: the reservation goes at the hint when that range is free, else at the first free range above it. The hint was dropped, so every hinted reservation landed at the lowest free address. RetroArch (PPSA99169) reserves its cores' direct-memory heap near 0x2000000000 outside the GPU window (0x200000000-0x300000000) and refuses a range inside it; with every reservation at 0x200400000 the heap was never made, and Dolphin's first aligned allocation returned null. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 tasks done
Contributor
|
Checked merged onto
|
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
sceKernelReserveVirtualRangedropped its address unlessMAP_FIXEDwas set. 1d806a4 made 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 cleanmaincf8b129 too; the new check runs before it and passes.maincf8b129. 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