Class MemoryMapping
- Namespace
- CStructSharp.Memory
- Assembly
- CStructSharp.dll
public sealed record MemoryMapping : IEquatable<MemoryMapping>
- Inheritance
-
MemoryMapping
- Implements
- Inherited Members
Remarks
Operating systems manage memory in pages, and a capture stores those pages wherever it likes. A mapping records
one such placement: the byte at logical Address + i is the byte at Backing.Address + i in
Backing.Source, for every i below Backing.Length. A table of these rules is what lets
MappedMemorySource present scattered file ranges as one contiguous address space.
A mapping describes placement only. It does not read bytes, infer a page size, or take ownership of the backing source, and a single mapping knows nothing about its neighbors; MappedMemorySource validates the table as a whole, including the rule that logical ranges must not overlap.
Constructors
MemoryMapping(ulong, MemoryRegion)
Creates a nonempty mapping and checks that the logical range does not wrap past the end of the address space.
public MemoryMapping(ulong address, MemoryRegion backing)
Parameters
addressulongFirst logical address covered by this mapping.
backingMemoryRegionCaller-owned backing range; its length is also the mapping's logical length.
Properties
Address
Gets the first logical address covered by this mapping.
public ulong Address { get; }
Property Value
Backing
Gets the caller-owned backing range that supplies the bytes.
public MemoryRegion Backing { get; }
Property Value
Methods
Equals(MemoryMapping?)
public bool Equals(MemoryMapping? other)
Parameters
otherMemoryMapping
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(MemoryMapping?, MemoryMapping?)
public static bool operator ==(MemoryMapping? left, MemoryMapping? right)
Parameters
leftMemoryMappingrightMemoryMapping
Returns
operator !=(MemoryMapping?, MemoryMapping?)
public static bool operator !=(MemoryMapping? left, MemoryMapping? right)
Parameters
leftMemoryMappingrightMemoryMapping