aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory/Tracking
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-11-10 22:07:52 -0300
committerGitHub <noreply@github.com>2020-11-10 22:07:52 -0300
commit3c60d4b0eaa54983cf8e347fb156742c925f0594 (patch)
treeb224bb0a167a45d68a07294eefd51c52e9aea4a9 /Ryujinx.Memory/Tracking
parent02872833b6da02a20e331305caf05f722e6c8e68 (diff)
Do not report unmapped pages as dirty (#1672)
* Do not report unmapped pages as dirty * Make tests pass again * PR feedback
Diffstat (limited to 'Ryujinx.Memory/Tracking')
-rw-r--r--Ryujinx.Memory/Tracking/IVirtualMemoryManager.cs1
-rw-r--r--Ryujinx.Memory/Tracking/MemoryTracking.cs3
-rw-r--r--Ryujinx.Memory/Tracking/RegionHandle.cs6
3 files changed, 7 insertions, 3 deletions
diff --git a/Ryujinx.Memory/Tracking/IVirtualMemoryManager.cs b/Ryujinx.Memory/Tracking/IVirtualMemoryManager.cs
index 6b5474e1..e6d8e8c9 100644
--- a/Ryujinx.Memory/Tracking/IVirtualMemoryManager.cs
+++ b/Ryujinx.Memory/Tracking/IVirtualMemoryManager.cs
@@ -4,6 +4,7 @@
{
(ulong address, ulong size)[] GetPhysicalRegions(ulong va, ulong size);
+ bool IsRangeMapped(ulong va, ulong size);
void TrackingReprotect(ulong va, ulong size, MemoryPermission protection);
}
}
diff --git a/Ryujinx.Memory/Tracking/MemoryTracking.cs b/Ryujinx.Memory/Tracking/MemoryTracking.cs
index 779166c4..aff223e8 100644
--- a/Ryujinx.Memory/Tracking/MemoryTracking.cs
+++ b/Ryujinx.Memory/Tracking/MemoryTracking.cs
@@ -75,6 +75,7 @@ namespace Ryujinx.Memory.Tracking
{
VirtualRegion region = results[i];
region.RecalculatePhysicalChildren();
+ region.UpdateProtection();
}
}
}
@@ -200,7 +201,7 @@ namespace Ryujinx.Memory.Tracking
lock (TrackingLock)
{
- RegionHandle handle = new RegionHandle(this, address, size);
+ RegionHandle handle = new RegionHandle(this, address, size, _memoryManager.IsRangeMapped(address, size));
return handle;
}
diff --git a/Ryujinx.Memory/Tracking/RegionHandle.cs b/Ryujinx.Memory/Tracking/RegionHandle.cs
index c00d039b..96898c21 100644
--- a/Ryujinx.Memory/Tracking/RegionHandle.cs
+++ b/Ryujinx.Memory/Tracking/RegionHandle.cs
@@ -10,7 +10,7 @@ namespace Ryujinx.Memory.Tracking
/// </summary>
public class RegionHandle : IRegionHandle, IRange
{
- public bool Dirty { get; private set; } = true;
+ public bool Dirty { get; private set; }
public ulong Address { get; }
public ulong Size { get; }
@@ -32,8 +32,10 @@ namespace Ryujinx.Memory.Tracking
/// <param name="tracking">Tracking object for the target memory block</param>
/// <param name="address">Virtual address of the region to track</param>
/// <param name="size">Size of the region to track</param>
- internal RegionHandle(MemoryTracking tracking, ulong address, ulong size)
+ /// <param name="dirty">Initial value of the dirty flag</param>
+ internal RegionHandle(MemoryTracking tracking, ulong address, ulong size, bool dirty = true)
{
+ Dirty = dirty;
Address = address;
Size = size;
EndAddress = address + size;