Memory Layout

x86-64 guest physical memory map

This is a survey of the existing memory layout for crosvm on x86-64 when booting a Linux kernel. Some of these values are different when booting a BIOS image; see the source. All addresses are in hexadecimal.

Name/source linkAddressEnd (exclusive)SizeNotes
START_OF_RAM_32BITS0000RAM
ZERO_PAGE_OFFSET7000Linux boot_params structure
BOOT_STACK_POINTER8000Boot SP value
boot_pml4_addr9000Boot page table
boot_pdpte_addrA000Boot page table
boot_pde_addrB000Boot page table
CMDLINE_OFFSET2_00002_08002 KiBLinux kernel command line
SETUP_DATA_START2_0800E_0000766 KiBLinux kernel setup_data linked list
ACPI_HI_RSDP_WINDOW_BASEE_0000ACPI tables
KERNEL_START_OFFSET20_0000Linux kernel image load address
initrd_startafter kernelInitial RAM disk for Linux kernel (optional)
END_ADDR_BEFORE_32BITSafter initrdD000_0000~3.24 GiBRAM (<4G)
END_ADDR_BEFORE_32BITSD000_0000F400_0000576 MiBLow (<4G) MMIO allocation area
PCIE_CFG_MMIO_STARTF400_0000F800_000064 MiBPCIe enhanced config (ECAM)
RESERVED_MEM_SIZEF800_00001_0000_0000128 MiBLAPIC/IOAPIC/HPET/…
IDENTITY_MAP_ADDRFEFF_C000Identity map segment
TSS_ADDRFEFF_D000Boot task state segment
1_0000_0000RAM (>4G)
(end of RAM)High (>4G) MMIO allocation area

aarch64 guest physical memory map

All addresses are IPA in hexadecimal.

Common layout

These apply for all boot modes.

Name/source linkAddressEnd (exclusive)SizeNotes
SERIAL_ADDR[3]2e82f08 bytesSerial port MMIO
SERIAL_ADDR[1]2f83008 bytesSerial port MMIO
SERIAL_ADDR[2]3e83f08 bytesSerial port MMIO
SERIAL_ADDR[0]3f84008 bytesSerial port MMIO
AARCH64_RTC_ADDR200030004 KiBReal-time clock
AARCH64_VMWDT_ADDR300040004 KiBWatchdog device
AARCH64_PCI_CFG_BASE1_00002_000064 KiBPCI configuration (CAM)
AARCH64_VIRTFREQ_BASE104_0000105_000064 KiBVirtual cpufreq device
AARCH64_PVTIME_IPA_START1f0_0000200_000064 KiBParavirtualized time
AARCH64_MMIO_BASE200_0000400_000032 MiBLow MMIO allocation area
AARCH64_GIC_CPUI_BASE3ffd_00003fff_0000128 KiBvGIC
AARCH64_GIC_DIST_BASE3fff_00004000_000064 KiBvGIC
AARCH64_AXI_BASE4000_0000Seemingly unused? Is this hard-coded somewhere in the kernel?
AARCH64_PROTECTED_VM_FW_START7fc0_00008000_00004 MiBpVM firmware (if running a protected VM)
AARCH64_PHYS_MEM_START8000_0000--mem sizeRAM (starts at IPA = 2 GiB)
get_swiotlb_addrafter RAM--swiotlb sizeOnly present for hypervisors requiring static swiotlb alloc
plat_mmio_baseafter swiotlb+0x8000008 MiBPlatform device MMIO region
high_mmio_baseafter plat_mmiomax phys addrHigh MMIO allocation area

Layout when booting a kernel

These apply when no bootloader is passed, so crosvm boots a kernel directly.

Name/source linkAddressEnd (exclusive)SizeNotes
AARCH64_KERNEL_OFFSET8000_0000Kernel load location in RAM
initrd_addrafter kernelLinux initrd location in RAM
fdt_addressbefore end of RAM2 MiBFlattened device tree in RAM

Layout when booting a bootloader

These apply when a bootloader is passed with --bios.

Name/source linkAddressEnd (exclusive)SizeNotes
AARCH64_FDT_OFFSET_IN_BIOS_MODE8000_00008020_00002 MiBFlattened device tree in RAM
AARCH64_BIOS_OFFSET8020_0000Bootloader image in RAM