diff --git a/src/Ryujinx.Cpu/ManagedPageFlags.cs b/src/Ryujinx.Cpu/ManagedPageFlags.cs index 10519322cd..e2c947278a 100644 --- a/src/Ryujinx.Cpu/ManagedPageFlags.cs +++ b/src/Ryujinx.Cpu/ManagedPageFlags.cs @@ -54,6 +54,11 @@ namespace Ryujinx.Cpu return (int)(vaSpan / PageSize); } + /// + /// Checks if the page at a given CPU virtual address is mapped. + /// + /// Virtual address to check + /// True if the address is mapped, false otherwise [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly bool IsMapped(ulong va) { @@ -79,6 +84,12 @@ namespace Ryujinx.Cpu pageEndIndex = (int)((pageEnd - 1) >> PageToPteShift); } + /// + /// Checks if a memory range is mapped. + /// + /// Virtual address of the range + /// Size of the range in bytes + /// True if the entire range is mapped, false otherwise public readonly bool IsRangeMapped(ulong va, ulong size) { int pages = GetPagesCount(va, size, out _); @@ -120,7 +131,12 @@ namespace Ryujinx.Cpu return true; } - /// + /// + /// Reprotect a region of virtual memory for tracking. + /// + /// Virtual address base + /// Size of the region to protect + /// Memory protection to set public readonly void TrackingReprotect(ulong va, ulong size, MemoryPermission protection) { // Protection is inverted on software pages, since the default value is 0. @@ -199,7 +215,15 @@ namespace Ryujinx.Cpu } } - /// + /// + /// Alerts the memory tracking that a given region has been read from or written to. + /// This should be called before read/write is performed. + /// + /// Memory tracking structure to call when pages are protected + /// Virtual address of the region + /// Size of the region + /// True if the region was written, false if read + /// Optional ID of the handles that should not be signalled /// /// This function also validates that the given range is both valid and mapped, and will throw if it is not. ///