mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-29 03:53:05 +00:00
216026c096
* perf: use ByteMemoryPool * feat: KPageTableBase/KPageTable new methods to read and write `ReadOnlySequence<byte>` * new: add IWritableBlock.Write(ulong, ReadOnlySequence<byte>) with default impl * perf: use GetReadOnlySequence() instead of GetSpan() * perf: make `Parcel` IDisposable, use `ByteMemoryPool` for internal allocation, and make Parcel consumers dispose of it * remove comment about copySize * remove unnecessary Clear()
27 lines
878 B
C#
27 lines
878 B
C#
using System;
|
|
using System.Buffers;
|
|
|
|
namespace Ryujinx.Memory
|
|
{
|
|
public interface IWritableBlock
|
|
{
|
|
/// <summary>
|
|
/// Writes data to CPU mapped memory, with write tracking.
|
|
/// </summary>
|
|
/// <param name="va">Virtual address to write the data into</param>
|
|
/// <param name="data">Data to be written</param>
|
|
/// <exception cref="InvalidMemoryRegionException">Throw for unhandled invalid or unmapped memory accesses</exception>
|
|
void Write(ulong va, ReadOnlySequence<byte> data)
|
|
{
|
|
foreach (ReadOnlyMemory<byte> segment in data)
|
|
{
|
|
Write(va, segment.Span);
|
|
va += (ulong)segment.Length;
|
|
}
|
|
}
|
|
|
|
void Write(ulong va, ReadOnlySpan<byte> data);
|
|
|
|
void WriteUntracked(ulong va, ReadOnlySpan<byte> data) => Write(va, data);
|
|
}
|
|
}
|