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
This commit is contained in:
parent
8c4e4ab3b3
commit
b4dc33efc2
5 changed files with 62 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue