Table of Contents

Class MemoryMapping

Namespace
CStructSharp.Memory
Assembly
CStructSharp.dll

One translation rule: logical addresses starting at Address come from the bytes of Backing.

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

address ulong

First logical address covered by this mapping.

backing MemoryRegion

Caller-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

ulong

Backing

Gets the caller-owned backing range that supplies the bytes.

public MemoryRegion Backing { get; }

Property Value

MemoryRegion

Methods

Equals(MemoryMapping?)

public bool Equals(MemoryMapping? other)

Parameters

other MemoryMapping

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(MemoryMapping?, MemoryMapping?)

public static bool operator ==(MemoryMapping? left, MemoryMapping? right)

Parameters

left MemoryMapping
right MemoryMapping

Returns

bool

operator !=(MemoryMapping?, MemoryMapping?)

public static bool operator !=(MemoryMapping? left, MemoryMapping? right)

Parameters

left MemoryMapping
right MemoryMapping

Returns

bool