Table of Contents

Class ObjectMapMemory

Namespace
Echo.Platforms.AsmResolver.Emulation.Heap
Assembly
Echo.Platforms.AsmResolver.dll

Provides a memory space for hosting managed objects within memory of a virtual machine.

public class ObjectMapMemory : IMemorySpace
Inheritance
ObjectMapMemory
Implements
Inherited Members

Constructors

ObjectMapMemory(CilVirtualMachine, long)

Creates a new object mapping host memory space.

public ObjectMapMemory(CilVirtualMachine machine, long size)

Parameters

machine CilVirtualMachine

The machine the memory is associated with.

size long

The maximum size of the memory.

Properties

AddressRange

Gets the range that this memory space spans.

public AddressRange AddressRange { get; }

Property Value

AddressRange

Methods

Clear()

Unmaps all registered objects from the host memory.

public void Clear()

GetOrCreateMapping(object?)

Gets or creates a new address mapping for the provided object.

public MappedObject? GetOrCreateMapping(object? value)

Parameters

value object

The object to embed into the machine.

Returns

MappedObject

The mapped object.

IsValidAddress(long)

Gets a value indicating whether the provided address is a valid address, and can be used to read and/or write to.

public bool IsValidAddress(long address)

Parameters

address long

The address to query.

Returns

bool

true if the address was valid, false otherwise.

Read(long, BitVectorSpan)

Copies data at the provided address into the provided buffer.

public void Read(long address, BitVectorSpan buffer)

Parameters

address long

The address to start reading at.

buffer BitVectorSpan

The buffer to write into.

Rebase(long)

Relocates the memory to a new base address.

public void Rebase(long baseAddress)

Parameters

baseAddress long

The new base address.

TryGetObject(long, out MappedObject?)

Attempts to obtain the managed object mapping by its address.

public bool TryGetObject(long address, out MappedObject? map)

Parameters

address long

The address of the mapped object.

map MappedObject

The obtained mapped object.

Returns

bool

true if the object was found, false otherwise.

Unmap(object)

Unmaps a registered object from the host memory.

public void Unmap(object value)

Parameters

value object

The object to unmap.

Write(long, BitVectorSpan)

Writes the provided buffer of data at the provided address.

public void Write(long address, BitVectorSpan buffer)

Parameters

address long

The address to start writing at.

buffer BitVectorSpan

The data to write.

Write(long, ReadOnlySpan<byte>)

Writes the provided buffer of data at the provided address.

public void Write(long address, ReadOnlySpan<byte> buffer)

Parameters

address long

The address to start writing at.

buffer ReadOnlySpan<byte>

The data to write.