[kernel] Add guest memory support

This commit is contained in:
ParantezTech
2026-06-21 23:18:18 +03:00
parent 5d204afd10
commit 08b315b5fc
5 changed files with 612 additions and 53 deletions
+12 -1
View File
@@ -5,7 +5,7 @@ using SharpEmu.HLE;
namespace SharpEmu.Core.Cpu;
public sealed class TrackedCpuMemory : ICpuMemory, ITrackedCpuMemory
public sealed class TrackedCpuMemory : ICpuMemory, ITrackedCpuMemory, IGuestMemoryAllocator
{
private readonly ICpuMemory _inner;
@@ -39,4 +39,15 @@ public sealed class TrackedCpuMemory : ICpuMemory, ITrackedCpuMemory
return result;
}
public bool TryAllocateGuestMemory(ulong size, ulong alignment, out ulong address)
{
if (_inner is IGuestMemoryAllocator allocator)
{
return allocator.TryAllocateGuestMemory(size, alignment, out address);
}
address = 0;
return false;
}
}