aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-12-13 04:30:27 -0300
committerGitHub <noreply@github.com>2020-12-13 08:30:27 +0100
commit19d18662ea3ed5470898ed2b7bbb06d45f6004dd (patch)
tree21ceeba0aee0fca1729ced4cf7c86bd9c7ff7ad2 /Ryujinx.Memory
parentef157bbe263e60b2e9c3259e5aee20a297c5f5bc (diff)
Correct type of executable sizes (#1802)
Diffstat (limited to 'Ryujinx.Memory')
-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;