IMultiRegionHandle.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. namespace Ryujinx.Memory.Tracking
  3. {
  4. public interface IMultiRegionHandle : IDisposable
  5. {
  6. /// <summary>
  7. /// True if any write has occurred to the whole region since the last use of QueryModified (with no subregion specified).
  8. /// </summary>
  9. bool Dirty { get; }
  10. /// <summary>
  11. /// Force the range of handles to be dirty, without reprotecting.
  12. /// </summary>
  13. /// <param name="address">Start address of the range</param>
  14. /// <param name="size">Size of the range</param>
  15. public void ForceDirty(ulong address, ulong size);
  16. /// <summary>
  17. /// Check if any part of the region has been modified, and perform an action for each.
  18. /// Contiguous modified regions are combined.
  19. /// </summary>
  20. /// <param name="modifiedAction">Action to perform for modified regions</param>
  21. void QueryModified(Action<ulong, ulong> modifiedAction);
  22. /// <summary>
  23. /// Check if part of the region has been modified within a given range, and perform an action for each.
  24. /// The range is aligned to the level of granularity of the contained handles.
  25. /// Contiguous modified regions are combined.
  26. /// </summary>
  27. /// <param name="address">Start address of the range</param>
  28. /// <param name="size">Size of the range</param>
  29. /// <param name="modifiedAction">Action to perform for modified regions</param>
  30. void QueryModified(ulong address, ulong size, Action<ulong, ulong> modifiedAction);
  31. /// <summary>
  32. /// Check if part of the region has been modified within a given range, and perform an action for each.
  33. /// The sequence number provided is compared with each handle's saved sequence number.
  34. /// If it is equal, then the handle's dirty flag is ignored. Otherwise, the sequence number is saved.
  35. /// The range is aligned to the level of granularity of the contained handles.
  36. /// Contiguous modified regions are combined.
  37. /// </summary>
  38. /// <param name="address">Start address of the range</param>
  39. /// <param name="size">Size of the range</param>
  40. /// <param name="modifiedAction">Action to perform for modified regions</param>
  41. /// <param name="sequenceNumber">Current sequence number</param>
  42. void QueryModified(ulong address, ulong size, Action<ulong, ulong> modifiedAction, int sequenceNumber);
  43. /// <summary>
  44. /// Signal that one of the subregions of this multi-region has been modified. This sets the overall dirty flag.
  45. /// </summary>
  46. void SignalWrite();
  47. }
  48. }