Fix Linux aligned mapping retention (#247)

* Fix Linux aligned mapping retention

* Cover Linux aligned mapping retention
This commit is contained in:
Spooks
2026-07-15 19:34:35 -06:00
committed by GitHub
parent 864cbb0fa0
commit 9bacb883f1
2 changed files with 85 additions and 4 deletions
@@ -349,10 +349,8 @@ public sealed unsafe class PhysicalVirtualMemory : IVirtualMemory, IGuestMemoryA
var requestedCursor = AlignUp(desiredAddress, effectiveAlignment);
var cursor = GetAllocationSearchCursor(desiredAddress, requestedCursor, effectiveAlignment, executable);
// POSIX treats the requested address as a hint, and Rosetta may
// relocate whole guest windows. Over-allocate once so the returned
// host range always contains an aligned guest-visible start.
if (!OperatingSystem.IsWindows())
// macOS needs alignment over-allocation; Linux uses exact-address search.
if (OperatingSystem.IsMacOS())
{
var reserveSize = effectiveAlignment > PageSize
? alignedSize + effectiveAlignment