IVirtualMemoryManagerTracked.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Ryujinx.Memory;
  2. using Ryujinx.Memory.Tracking;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Ryujinx.Cpu
  6. {
  7. public interface IVirtualMemoryManagerTracked : IVirtualMemoryManager
  8. {
  9. /// <summary>
  10. /// Reads data from CPU mapped memory, with read tracking
  11. /// </summary>
  12. /// <typeparam name="T">Type of the data being read</typeparam>
  13. /// <param name="va">Virtual address of the data in memory</param>
  14. /// <returns>The data</returns>
  15. T ReadTracked<T>(ulong va) where T : unmanaged;
  16. /// <summary>
  17. /// Writes data to CPU mapped memory, without write tracking.
  18. /// </summary>
  19. /// <param name="va">Virtual address to write the data into</param>
  20. /// <param name="data">Data to be written</param>
  21. void WriteUntracked(ulong va, ReadOnlySpan<byte> data);
  22. /// <summary>
  23. /// Obtains a memory tracking handle for the given virtual region. This should be disposed when finished with.
  24. /// </summary>
  25. /// <param name="address">CPU virtual address of the region</param>
  26. /// <param name="size">Size of the region</param>
  27. /// <param name="id">Handle ID</param>
  28. /// <returns>The memory tracking handle</returns>
  29. RegionHandle BeginTracking(ulong address, ulong size, int id);
  30. /// <summary>
  31. /// Obtains a memory tracking handle for the given virtual region, with a specified granularity. This should be disposed when finished with.
  32. /// </summary>
  33. /// <param name="address">CPU virtual address of the region</param>
  34. /// <param name="size">Size of the region</param>
  35. /// <param name="handles">Handles to inherit state from or reuse. When none are present, provide null</param>
  36. /// <param name="granularity">Desired granularity of write tracking</param>
  37. /// <param name="id">Handle ID</param>
  38. /// <returns>The memory tracking handle</returns>
  39. MultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id);
  40. /// <summary>
  41. /// Obtains a smart memory tracking handle for the given virtual region, with a specified granularity. This should be disposed when finished with.
  42. /// </summary>
  43. /// <param name="address">CPU virtual address of the region</param>
  44. /// <param name="size">Size of the region</param>
  45. /// <param name="granularity">Desired granularity of write tracking</param>
  46. /// <param name="id">Handle ID</param>
  47. /// <returns>The memory tracking handle</returns>
  48. SmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id);
  49. }
  50. }