From 609abc8b9b3c05a63bef94c2133550b3c07f97b0 Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Wed, 26 Apr 2023 04:34:16 +0200 Subject: Rename Ryujinx.Memory.Tests to Ryujinx.Tests.Memory --- .../MockVirtualMemoryManager.cs | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs (limited to 'src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs') diff --git a/src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs b/src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs new file mode 100644 index 00000000..ef81a461 --- /dev/null +++ b/src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs @@ -0,0 +1,109 @@ +using Ryujinx.Memory.Range; +using System; +using System.Collections.Generic; + +namespace Ryujinx.Memory.Tests +{ + public class MockVirtualMemoryManager : IVirtualMemoryManager + { + public bool Supports4KBPages => true; + + public bool NoMappings = false; + + public event Action OnProtect; + + public MockVirtualMemoryManager(ulong size, int pageSize) + { + } + + public void Map(ulong va, ulong pa, ulong size, MemoryMapFlags flags) + { + throw new NotImplementedException(); + } + + public void MapForeign(ulong va, nuint hostAddress, ulong size) + { + throw new NotImplementedException(); + } + + public void Unmap(ulong va, ulong size) + { + throw new NotImplementedException(); + } + + public T Read(ulong va) where T : unmanaged + { + throw new NotImplementedException(); + } + + public void Read(ulong va, Span data) + { + throw new NotImplementedException(); + } + + public void Write(ulong va, T value) where T : unmanaged + { + throw new NotImplementedException(); + } + + public void Write(ulong va, ReadOnlySpan data) + { + throw new NotImplementedException(); + } + + public bool WriteWithRedundancyCheck(ulong va, ReadOnlySpan data) + { + throw new NotImplementedException(); + } + + public ReadOnlySpan GetSpan(ulong va, int size, bool tracked = false) + { + throw new NotImplementedException(); + } + + public WritableRegion GetWritableRegion(ulong va, int size, bool tracked = false) + { + throw new NotImplementedException(); + } + + public ref T GetRef(ulong va) where T : unmanaged + { + throw new NotImplementedException(); + } + + IEnumerable IVirtualMemoryManager.GetHostRegions(ulong va, ulong size) + { + throw new NotImplementedException(); + } + + IEnumerable IVirtualMemoryManager.GetPhysicalRegions(ulong va, ulong size) + { + return NoMappings ? Array.Empty() : new MemoryRange[] { new MemoryRange(va, size) }; + } + + public bool IsMapped(ulong va) + { + return true; + } + + public bool IsRangeMapped(ulong va, ulong size) + { + return true; + } + + public ulong GetPhysicalAddress(ulong va) + { + throw new NotImplementedException(); + } + + public void SignalMemoryTracking(ulong va, ulong size, bool write, bool precise = false, int? exemptId = null) + { + throw new NotImplementedException(); + } + + public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection) + { + OnProtect?.Invoke(va, size, protection); + } + } +} -- cgit v1.2.3