fix(memory): expand the HLE guest-allocation arena (#843)

Co-authored-by: Foued Attar <foued.attar@lyceeastier.com>
This commit is contained in:
frangametv
2026-08-24 18:23:43 +02:00
committed by GitHub
parent 807aad18b3
commit 600fcde637
2 changed files with 18 additions and 2 deletions
@@ -14,7 +14,7 @@ public sealed class GuestMemoryAllocatorTests
public void FreedRangesAreReusedAndCoalesced()
{
using var memory = new PhysicalVirtualMemory(new FakeHostMemory());
const ulong usableArenaSize = 0x0100_0000 - 0x1000;
const ulong usableArenaSize = 0x2000_0000 - 0x1000;
Assert.True(memory.TryAllocateGuestMemory(0x4000, 0x1000, out var first));
Assert.True(memory.TryAllocateGuestMemory(0x8000, 0x1000, out var second));
@@ -34,6 +34,16 @@ public sealed class GuestMemoryAllocatorTests
Assert.Equal(first, coalesced);
}
[Fact]
public void ArenaSupportsAllocationsBeyondLegacySixteenMiBLimit()
{
using var memory = new PhysicalVirtualMemory(new FakeHostMemory());
Assert.True(memory.TryAllocateGuestMemory(0x0100_0000, 0x1000, out var first));
Assert.True(memory.TryAllocateGuestMemory(0x0020_0000, 0x1000, out var beyondLegacyLimit));
Assert.Equal(first + 0x0100_0000, beyondLegacyLimit);
}
[Fact]
public void SegmentProtectionIsAppliedInContiguousRuns()
{