aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Memory')
-rw-r--r--Ryujinx.Memory/AddressSpaceManager.cs3
-rw-r--r--Ryujinx.Memory/IVirtualMemoryManager.cs3
-rw-r--r--Ryujinx.Memory/IWritableBlock.cs2
-rw-r--r--Ryujinx.Memory/WritableRegion.cs13
4 files changed, 17 insertions, 4 deletions
diff --git a/Ryujinx.Memory/AddressSpaceManager.cs b/Ryujinx.Memory/AddressSpaceManager.cs
index d8ee4746..050b5c05 100644
--- a/Ryujinx.Memory/AddressSpaceManager.cs
+++ b/Ryujinx.Memory/AddressSpaceManager.cs
@@ -207,9 +207,10 @@ namespace Ryujinx.Memory
/// </remarks>
/// <param name="va">Virtual address of the data</param>
/// <param name="size">Size of the data</param>
+ /// <param name="tracked">True if write tracking is triggered on the span</param>
/// <returns>A writable region of memory containing the data</returns>
/// <exception cref="InvalidMemoryRegionException">Throw for unhandled invalid or unmapped memory accesses</exception>
- public unsafe WritableRegion GetWritableRegion(ulong va, int size)
+ public unsafe WritableRegion GetWritableRegion(ulong va, int size, bool tracked = false)
{
if (size == 0)
{
diff --git a/Ryujinx.Memory/IVirtualMemoryManager.cs b/Ryujinx.Memory/IVirtualMemoryManager.cs
index 056940cc..2448ba03 100644
--- a/Ryujinx.Memory/IVirtualMemoryManager.cs
+++ b/Ryujinx.Memory/IVirtualMemoryManager.cs
@@ -87,9 +87,10 @@ namespace Ryujinx.Memory
/// </summary>
/// <param name="va">Virtual address of the data</param>
/// <param name="size">Size of the data</param>
+ /// <param name="tracked">True if write tracking is triggered on the span</param>
/// <returns>A writable region of memory containing the data</returns>
/// <exception cref="InvalidMemoryRegionException">Throw for unhandled invalid or unmapped memory accesses</exception>
- WritableRegion GetWritableRegion(ulong va, int size);
+ WritableRegion GetWritableRegion(ulong va, int size, bool tracked = false);
/// <summary>
/// Gets a reference for the given type at the specified virtual memory address.
diff --git a/Ryujinx.Memory/IWritableBlock.cs b/Ryujinx.Memory/IWritableBlock.cs
index c95b754d..36b9f5a6 100644
--- a/Ryujinx.Memory/IWritableBlock.cs
+++ b/Ryujinx.Memory/IWritableBlock.cs
@@ -5,5 +5,7 @@ namespace Ryujinx.Memory
public interface IWritableBlock
{
void Write(ulong va, ReadOnlySpan<byte> data);
+
+ void WriteUntracked(ulong va, ReadOnlySpan<byte> data) => Write(va, data);
}
}
diff --git a/Ryujinx.Memory/WritableRegion.cs b/Ryujinx.Memory/WritableRegion.cs
index 467ee7f7..21565ea5 100644
--- a/Ryujinx.Memory/WritableRegion.cs
+++ b/Ryujinx.Memory/WritableRegion.cs
@@ -6,15 +6,17 @@ namespace Ryujinx.Memory
{
private readonly IWritableBlock _block;
private readonly ulong _va;
+ private readonly bool _tracked;
private bool NeedsWriteback => _block != null;
public Memory<byte> Memory { get; }
- public WritableRegion(IWritableBlock block, ulong va, Memory<byte> memory)
+ public WritableRegion(IWritableBlock block, ulong va, Memory<byte> memory, bool tracked = false)
{
_block = block;
_va = va;
+ _tracked = tracked;
Memory = memory;
}
@@ -22,7 +24,14 @@ namespace Ryujinx.Memory
{
if (NeedsWriteback)
{
- _block.Write(_va, Memory.Span);
+ if (_tracked)
+ {
+ _block.Write(_va, Memory.Span);
+ }
+ else
+ {
+ _block.WriteUntracked(_va, Memory.Span);
+ }
}
}
}