aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory/MemoryBlock.cs
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-10-24 23:52:59 +0200
committerGitHub <noreply@github.com>2021-10-24 18:52:59 -0300
commitb4dc33efc2890bc0d60e99f715425d6af4a72b3d (patch)
tree6b5a712903a20d23db5a2be70b6c1d03c8d0f019 /Ryujinx.Memory/MemoryBlock.cs
parent8c4e4ab3b32eb2dfe5e26fab95648b7872fe2c28 (diff)
kernel: Clear pages allocated with SetHeapSize (#2776)
* kernel: Clear pages allocated with SetHeapSize Before this commit, all new pages allocated by SetHeapSize were not cleared by the kernel. This would cause undefined data to be pass to the userland and possibly resulting in weird memory corruption. This commit also add support for custom fill heap and ipc value (that is also supported by the official kernel) * Remove dots at the end of KPageTableBase.MapPages new documentation * Remove unused _stackFillValue
Diffstat (limited to 'Ryujinx.Memory/MemoryBlock.cs')
-rw-r--r--Ryujinx.Memory/MemoryBlock.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Ryujinx.Memory/MemoryBlock.cs b/Ryujinx.Memory/MemoryBlock.cs
index 25c66dfe..3561b81a 100644
--- a/Ryujinx.Memory/MemoryBlock.cs
+++ b/Ryujinx.Memory/MemoryBlock.cs
@@ -216,13 +216,14 @@ namespace Ryujinx.Memory
}
/// <summary>
- /// Fills a region of memory with zeros.
+ /// Fills a region of memory with <paramref name="value"/>.
/// </summary>
- /// <param name="offset">Offset of the region to fill with zeros</param>
+ /// <param name="offset">Offset of the region to fill with <paramref name="value"/></param>
/// <param name="size">Size in bytes of the region to fill</param>
+ /// <param name="value">Value to use for the fill</param>
/// <exception cref="ObjectDisposedException">Throw when the memory block has already been disposed</exception>
/// <exception cref="InvalidMemoryRegionException">Throw when either <paramref name="offset"/> or <paramref name="size"/> are out of range</exception>
- public void ZeroFill(ulong offset, ulong size)
+ public void Fill(ulong offset, ulong size, byte value)
{
const int MaxChunkSize = 1 << 24;
@@ -230,7 +231,7 @@ namespace Ryujinx.Memory
{
int copySize = (int)Math.Min(MaxChunkSize, size - subOffset);
- GetSpan(offset + subOffset, copySize).Fill(0);
+ GetSpan(offset + subOffset, copySize).Fill(value);
}
}