supermachine 0.3.3

Run any OCI/Docker image as a hardware-isolated microVM on macOS HVF (Linux KVM and Windows WHP in progress). Single library API, zero flags for the common case, sub-100 ms cold-restore from snapshot.
// Guest physical address layout. Standard values for the Linux
// aarch64 boot protocol — these are dictated by what the kernel
// expects, not free parameters.

/// Start of guest RAM when loading a kernel image. Linux aarch64
/// boot protocol expects the kernel at offset 0x80000 from the
/// start of RAM.
pub const DRAM_MEM_START_KERNEL: u64 = 0x8000_0000; // 2 GB
pub const DRAM_MEM_END: u64 = 0x00FF_8000_0000;
pub const DRAM_MEM_MAX_SIZE: u64 = DRAM_MEM_END - DRAM_MEM_START_KERNEL;

/// Linux aarch64 boot protocol: kernel image at RAM_START + 0x80000.
pub const KERNEL_LOAD_OFFSET: u64 = 0x80000;

/// Cmdline + FDT layout constants.
pub const CMDLINE_MAX_SIZE: usize = 2048;
pub const FDT_MAX_SIZE: usize = 0x20_0000;

/// IRQ allocation. SPIs start at 32; we reserve up to 160.
pub const IRQ_BASE: u32 = 32;
pub const IRQ_MAX: u32 = 159;

/// vtimer SPI INTID is 11 (PPI base) + 16 (SPI offset) = 27.
pub const VTIMER_IRQ: u32 = 27;

/// MMIO region starts here. Below: GIC. Above: virtio devices.
pub const MAPPED_IO_START: u64 = 0x0a00_0000;

/// GIC v3: distributor + per-vCPU redistributor frames. The
/// redistributor area is `GICV3_REDIST_STRIDE * n_vcpus` bytes
/// at `GICV3_REDIST_BASE`. Stride = 0x20000 (RD_base 0x10000
/// + SGI_base 0x10000) per vCPU.
pub const GICV3_DIST_BASE: u64 = 0x0800_0000;
pub const GICV3_DIST_SIZE: u64 = 0x0001_0000;
pub const GICV3_REDIST_BASE: u64 = 0x0808_0000;
pub const GICV3_REDIST_STRIDE: u64 = 0x0002_0000;

/// First virtio-mmio device base; subsequent devices stride by 0x200.
pub const VIRTIO_MMIO_BASE: u64 = 0x0a00_0000;
pub const VIRTIO_MMIO_STRIDE: u64 = 0x200;

/// Serial console MMIO. Stub PL011 layout for boot-time logging.
pub const SERIAL_MMIO_BASE: u64 = 0x0900_0000;
pub const SERIAL_MMIO_SIZE: u64 = 0x1000;
pub const SERIAL_IRQ: u32 = 33;