MockVirtualMemoryManager.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. namespace Ryujinx.Memory.Tests
  3. {
  4. class MockVirtualMemoryManager : IVirtualMemoryManager
  5. {
  6. public bool NoMappings = false;
  7. public event Action<ulong, ulong, MemoryPermission> OnProtect;
  8. public MockVirtualMemoryManager(ulong size, int pageSize)
  9. {
  10. }
  11. public void Map(ulong va, ulong pa, ulong size)
  12. {
  13. throw new NotImplementedException();
  14. }
  15. public void Unmap(ulong va, ulong size)
  16. {
  17. throw new NotImplementedException();
  18. }
  19. public T Read<T>(ulong va) where T : unmanaged
  20. {
  21. throw new NotImplementedException();
  22. }
  23. public void Read(ulong va, Span<byte> data)
  24. {
  25. throw new NotImplementedException();
  26. }
  27. public void Write<T>(ulong va, T value) where T : unmanaged
  28. {
  29. throw new NotImplementedException();
  30. }
  31. public void Write(ulong va, ReadOnlySpan<byte> data)
  32. {
  33. throw new NotImplementedException();
  34. }
  35. public ReadOnlySpan<byte> GetSpan(ulong va, int size, bool tracked = false)
  36. {
  37. throw new NotImplementedException();
  38. }
  39. public WritableRegion GetWritableRegion(ulong va, int size)
  40. {
  41. throw new NotImplementedException();
  42. }
  43. public ref T GetRef<T>(ulong va) where T : unmanaged
  44. {
  45. throw new NotImplementedException();
  46. }
  47. public (ulong address, ulong size)[] GetPhysicalRegions(ulong va, ulong size)
  48. {
  49. return NoMappings ? new (ulong address, ulong size)[0] : new (ulong address, ulong size)[] { (va, size) };
  50. }
  51. public bool IsMapped(ulong va)
  52. {
  53. return true;
  54. }
  55. public bool IsRangeMapped(ulong va, ulong size)
  56. {
  57. return true;
  58. }
  59. public ulong GetPhysicalAddress(ulong va)
  60. {
  61. throw new NotImplementedException();
  62. }
  63. public void SignalMemoryTracking(ulong va, ulong size, bool write)
  64. {
  65. throw new NotImplementedException();
  66. }
  67. public void TrackingReprotect(ulong va, ulong size, MemoryPermission protection)
  68. {
  69. OnProtect?.Invoke(va, size, protection);
  70. }
  71. }
  72. }