namespace ARMeilleure.Memory
{
///
/// Indicates the type of a memory manager and the method it uses for memory mapping
/// and address translation. This controls the code generated for memory accesses on the JIT.
///
public enum MemoryManagerType
{
///
/// Complete software MMU implementation, the read/write methods are always called,
/// without any attempt to perform faster memory access.
///
SoftwareMmu,
///
/// High level implementation using a software flat page table for address translation,
/// used to speed up address translation if possible without calling the read/write methods.
///
SoftwarePageTable,
///
/// High level implementation with mappings managed by the host OS, effectively using hardware
/// page tables. No address translation is performed in software and the memory is just accessed directly.
///
HostMapped,
///
/// Same as the host mapped memory manager type, but without masking the address within the address space.
/// Allows invalid access from JIT code to the rest of the program, but is faster.
///
HostMappedUnsafe
}
static class MemoryManagerTypeExtensions
{
public static bool IsHostMapped(this MemoryManagerType type)
{
return type == MemoryManagerType.HostMapped || type == MemoryManagerType.HostMappedUnsafe;
}
}
}