aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Cpu
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.Cpu
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.Cpu')
-rw-r--r--Ryujinx.Cpu/MemoryManager.cs29
1 files changed, 27 insertions, 2 deletions
diff --git a/Ryujinx.Cpu/MemoryManager.cs b/Ryujinx.Cpu/MemoryManager.cs
index 26cc01c9..3fa08fe7 100644
--- a/Ryujinx.Cpu/MemoryManager.cs
+++ b/Ryujinx.Cpu/MemoryManager.cs
@@ -1,4 +1,4 @@
-using ARMeilleure.Memory;
+using ARMeilleure.Memory;
using Ryujinx.Cpu.Tracking;
using Ryujinx.Memory;
using Ryujinx.Memory.Tracking;
@@ -461,7 +461,32 @@ namespace Ryujinx.Cpu
}
/// <summary>
- /// Checks if the page at a given CPU virtual address.
+ /// Checks if a memory range is mapped.
+ /// </summary>
+ /// <param name="va">Virtual address of the range</param>
+ /// <param name="size">Size of the range in bytes</param>
+ /// <returns>True if the entire range is mapped, false otherwise</returns>
+ public bool IsRangeMapped(ulong va, ulong size)
+ {
+ ulong endVa = (va + size + PageMask) & ~(ulong)PageMask;
+
+ va &= ~(ulong)PageMask;
+
+ while (va < endVa)
+ {
+ if (!IsMapped(va))
+ {
+ return false;
+ }
+
+ va += PageSize;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Checks if the page at a given CPU virtual address is mapped.
/// </summary>
/// <param name="va">Virtual address to check</param>
/// <returns>True if the address is mapped, false otherwise</returns>