MockVirtualMemoryManager.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using Ryujinx.Memory;
  2. using Ryujinx.Memory.Range;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Ryujinx.Tests.Memory
  6. {
  7. public class MockVirtualMemoryManager : IVirtualMemoryManager
  8. {
  9. public bool Supports4KBPages => true;
  10. public bool NoMappings = false;
  11. public event Action<ulong, ulong, MemoryPermission> OnProtect;
  12. public MockVirtualMemoryManager(ulong size, int pageSize)
  13. {
  14. }
  15. public void Map(ulong va, ulong pa, ulong size, MemoryMapFlags flags)
  16. {
  17. throw new NotImplementedException();
  18. }
  19. public void MapForeign(ulong va, nuint hostAddress, ulong size)
  20. {
  21. throw new NotImplementedException();
  22. }
  23. public void Unmap(ulong va, ulong size)
  24. {
  25. throw new NotImplementedException();
  26. }
  27. public T Read<T>(ulong va) where T : unmanaged
  28. {
  29. throw new NotImplementedException();
  30. }
  31. public void Read(ulong va, Span<byte> data)
  32. {
  33. throw new NotImplementedException();
  34. }
  35. public void Write<T>(ulong va, T value) where T : unmanaged
  36. {
  37. throw new NotImplementedException();
  38. }
  39. public void Write(ulong va, ReadOnlySpan<byte> data)
  40. {
  41. throw new NotImplementedException();
  42. }
  43. public bool WriteWithRedundancyCheck(ulong va, ReadOnlySpan<byte> data)
  44. {
  45. throw new NotImplementedException();
  46. }
  47. public ReadOnlySpan<byte> GetSpan(ulong va, int size, bool tracked = false)
  48. {
  49. throw new NotImplementedException();
  50. }
  51. public WritableRegion GetWritableRegion(ulong va, int size, bool tracked = false)
  52. {
  53. throw new NotImplementedException();
  54. }
  55. public ref T GetRef<T>(ulong va) where T : unmanaged
  56. {
  57. throw new NotImplementedException();
  58. }
  59. IEnumerable<HostMemoryRange> IVirtualMemoryManager.GetHostRegions(ulong va, ulong size)
  60. {
  61. throw new NotImplementedException();
  62. }
  63. IEnumerable<MemoryRange> IVirtualMemoryManager.GetPhysicalRegions(ulong va, ulong size)
  64. {
  65. return NoMappings ? Array.Empty<MemoryRange>() : new MemoryRange[] { new MemoryRange(va, size) };
  66. }
  67. public bool IsMapped(ulong va)
  68. {
  69. return true;
  70. }
  71. public bool IsRangeMapped(ulong va, ulong size)
  72. {
  73. return true;
  74. }
  75. public ulong GetPhysicalAddress(ulong va)
  76. {
  77. throw new NotImplementedException();
  78. }
  79. public void SignalMemoryTracking(ulong va, ulong size, bool write, bool precise = false, int? exemptId = null)
  80. {
  81. throw new NotImplementedException();
  82. }
  83. public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
  84. {
  85. OnProtect?.Invoke(va, size, protection);
  86. }
  87. }
  88. }