IVirtualMemoryManagerTracked.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. /// <param name="flags">Region flags</param>
  29. /// <returns>The memory tracking handle</returns>
  30. RegionHandle BeginTracking(ulong address, ulong size, int id, RegionFlags flags = RegionFlags.None);
  31. /// <summary>
  32. /// Obtains a memory tracking handle for the given virtual region, with a specified granularity. This should be disposed when finished with.
  33. /// </summary>
  34. /// <param name="address">CPU virtual address of the region</param>
  35. /// <param name="size">Size of the region</param>
  36. /// <param name="handles">Handles to inherit state from or reuse. When none are present, provide null</param>
  37. /// <param name="granularity">Desired granularity of write tracking</param>
  38. /// <param name="id">Handle ID</param>
  39. /// <param name="flags">Region flags</param>
  40. /// <returns>The memory tracking handle</returns>
  41. MultiRegionHandle BeginGranularTracking(ulong address, ulong size, IEnumerable<IRegionHandle> handles, ulong granularity, int id, RegionFlags flags = RegionFlags.None);
  42. /// <summary>
  43. /// Obtains a smart memory tracking handle for the given virtual region, with a specified granularity. This should be disposed when finished with.
  44. /// </summary>
  45. /// <param name="address">CPU virtual address of the region</param>
  46. /// <param name="size">Size of the region</param>
  47. /// <param name="granularity">Desired granularity of write tracking</param>
  48. /// <param name="id">Handle ID</param>
  49. /// <returns>The memory tracking handle</returns>
  50. SmartMultiRegionHandle BeginSmartGranularTracking(ulong address, ulong size, ulong granularity, int id);
  51. }
  52. }