|
@@ -5,6 +5,11 @@ namespace Ryujinx.Memory.Range
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public readonly record struct MemoryRange
|
|
public readonly record struct MemoryRange
|
|
|
{
|
|
{
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Special address value used to indicate than an address is invalid.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ internal const ulong InvalidAddress = ulong.MaxValue;
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// An empty memory range, with a null address and zero size.
|
|
/// An empty memory range, with a null address and zero size.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -58,13 +63,24 @@ namespace Ryujinx.Memory.Range
|
|
|
return thisAddress < otherEndAddress && otherAddress < thisEndAddress;
|
|
return thisAddress < otherEndAddress && otherAddress < thisEndAddress;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Checks if a given sub-range of memory is invalid.
|
|
|
|
|
+ /// Those are used to represent unmapped memory regions (holes in the region mapping).
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="subRange">Memory range to check</param>
|
|
|
|
|
+ /// <returns>True if the memory range is considered invalid, false otherwise</returns>
|
|
|
|
|
+ internal static bool IsInvalid(ref MemoryRange subRange)
|
|
|
|
|
+ {
|
|
|
|
|
+ return subRange.Address == InvalidAddress;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Returns a string summary of the memory range.
|
|
/// Returns a string summary of the memory range.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <returns>A string summary of the memory range</returns>
|
|
/// <returns>A string summary of the memory range</returns>
|
|
|
public override string ToString()
|
|
public override string ToString()
|
|
|
{
|
|
{
|
|
|
- if (Address == ulong.MaxValue)
|
|
|
|
|
|
|
+ if (Address == InvalidAddress)
|
|
|
{
|
|
{
|
|
|
return $"[Unmapped 0x{Size:X}]";
|
|
return $"[Unmapped 0x{Size:X}]";
|
|
|
}
|
|
}
|