Cache changes (#302)

* Skip repeated cache tests between same sync

* Skip some checks for regions where just one resource is resident

* Dehardcode residency page size

* Some cleanup
This commit is contained in:
ReinUsesLisp 2018-07-29 01:39:15 -03:00 committed by gdkchan
parent dcbeed72c4
commit e51ccf206b

View file

@ -160,23 +160,23 @@ namespace ChocolArm64.Memory
return HostPageSize; return HostPageSize;
} }
public bool[] IsRegionModified(long Position, long Size) public (bool[], long) IsRegionModified(long Position, long Size)
{ {
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
return null; return (null, 0);
} }
long EndPos = Position + Size; long EndPos = Position + Size;
if ((ulong)EndPos < (ulong)Position) if ((ulong)EndPos < (ulong)Position)
{ {
return null; return (null, 0);
} }
if ((ulong)EndPos > AMemoryMgr.RamSize) if ((ulong)EndPos > AMemoryMgr.RamSize)
{ {
return null; return (null, 0);
} }
IntPtr MemAddress = new IntPtr(RamPtr + Position); IntPtr MemAddress = new IntPtr(RamPtr + Position);
@ -201,7 +201,7 @@ namespace ChocolArm64.Memory
Modified[(VA - Position) / HostPageSize] = true; Modified[(VA - Position) / HostPageSize] = true;
} }
return Modified; return (Modified, Count);
} }
public IntPtr GetHostAddress(long Position, long Size) public IntPtr GetHostAddress(long Position, long Size)