Class StaticFieldStorage
- Namespace
- Echo.Platforms.AsmResolver.Emulation.Runtime
- Assembly
- Echo.Platforms.AsmResolver.dll
Represents a chunk of memory designated for storing static fields in a .NET process.
public class StaticFieldStorage : IMemorySpace
- Inheritance
-
StaticFieldStorage
- Implements
- Inherited Members
Constructors
StaticFieldStorage(ValueFactory, IHeap)
Creates a new empty static field storage.
public StaticFieldStorage(ValueFactory valueFactory, IHeap heap)
Parameters
valueFactoryValueFactoryThe value factory responsible for measuring and constructing new values.
heapIHeapThe virtual heap to use for storing the field values.
StaticFieldStorage(ValueFactory, int)
Creates a new empty static field storage.
public StaticFieldStorage(ValueFactory valueFactory, int size)
Parameters
valueFactoryValueFactoryThe value factory responsible for measuring and constructing new values.
sizeintThe maximum size of the storage.
Properties
AddressRange
Gets the range that this memory space spans.
public AddressRange AddressRange { get; }
Property Value
Methods
GetFieldAddress(IFieldDescriptor)
Gets the address of the provided field.
public long GetFieldAddress(IFieldDescriptor field)
Parameters
fieldIFieldDescriptorThe field.
Returns
- long
The address.
GetFieldSpan(IFieldDescriptor)
Obtains a writable bitvector slice that spans the value of the provided field.
public BitVectorSpan GetFieldSpan(IFieldDescriptor field)
Parameters
fieldIFieldDescriptorThe field.
Returns
- BitVectorSpan
The slice.
GetOrInitializeFieldAddress(IFieldDescriptor, bool)
Gets the address of the provided field. If the field was accessed for the first time, the field's contents will be either cleared or left unknown.
public long GetOrInitializeFieldAddress(IFieldDescriptor field, bool initializeWithZeroes)
Parameters
fieldIFieldDescriptorThe field.
initializeWithZeroesbooltrueif the field's contents should be initialized with zeroes on first access.
Returns
- long
The address.
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
addresslongThe address to query.
Returns
- bool
trueif the address was valid,falseotherwise.
Read(long, BitVectorSpan)
Copies data at the provided address into the provided buffer.
public void Read(long address, BitVectorSpan buffer)
Parameters
addresslongThe address to start reading at.
bufferBitVectorSpanThe buffer to write into.
Rebase(long)
Relocates the memory to a new base address.
public void Rebase(long baseAddress)
Parameters
baseAddresslongThe new base address.
Write(long, BitVectorSpan)
Writes the provided buffer of data at the provided address.
public void Write(long address, BitVectorSpan buffer)
Parameters
addresslongThe address to start writing at.
bufferBitVectorSpanThe 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
addresslongThe address to start writing at.
bufferReadOnlySpan<byte>The data to write.