aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory/IVirtualMemoryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Memory/IVirtualMemoryManager.cs')
-rw-r--r--Ryujinx.Memory/IVirtualMemoryManager.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Ryujinx.Memory/IVirtualMemoryManager.cs b/Ryujinx.Memory/IVirtualMemoryManager.cs
index e7e1a978..cd271a5f 100644
--- a/Ryujinx.Memory/IVirtualMemoryManager.cs
+++ b/Ryujinx.Memory/IVirtualMemoryManager.cs
@@ -13,6 +13,18 @@ namespace Ryujinx.Memory
void Write<T>(ulong va, T value) where T : unmanaged;
void Write(ulong va, ReadOnlySpan<byte> data);
+ void Fill(ulong va, ulong size, byte value)
+ {
+ const int MaxChunkSize = 1 << 30;
+
+ for (ulong subOffset = 0; subOffset < size; subOffset += MaxChunkSize)
+ {
+ int copySize = (int)Math.Min(MaxChunkSize, size - subOffset);
+
+ GetWritableRegion(va + subOffset, copySize).Memory.Span.Fill(0);
+ }
+ }
+
ReadOnlySpan<byte> GetSpan(ulong va, int size, bool tracked = false);
WritableRegion GetWritableRegion(ulong va, int size);
ref T GetRef<T>(ulong va) where T : unmanaged;