From b4dc33efc2890bc0d60e99f715425d6af4a72b3d Mon Sep 17 00:00:00 2001 From: Mary Date: Sun, 24 Oct 2021 23:52:59 +0200 Subject: 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 --- Ryujinx.Memory/MemoryBlock.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Ryujinx.Memory/MemoryBlock.cs') 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 } /// - /// Fills a region of memory with zeros. + /// Fills a region of memory with . /// - /// Offset of the region to fill with zeros + /// Offset of the region to fill with /// Size in bytes of the region to fill + /// Value to use for the fill /// Throw when the memory block has already been disposed /// Throw when either or are out of range - 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); } } -- cgit v1.2.3