Deep technical reference for the QuantaVirt hypervisor internals. Covers the boot sequence, Intel VMX and AMD SVM execution engines, extended/nested page tables, vCPU scheduling, IOMMU, device emulation, interrupt routing, and the PQC subsystem architecture. Intended for developers extending QuantaVirt and engineers evaluating the platform's security properties.
QuantaVirt is a Type 1 (bare-metal) hypervisor that runs directly on physical hardware without a host operating system. The hypervisor kernel manages CPU virtualization, memory, I/O, and the PQC subsystem. Guest VMs execute in hardware-isolated environments provided by Intel VMX or AMD SVM extensions.
Layer
Component
Responsibility
Ring -1 (VMX Root / SVM Host)
Hypervisor Kernel
VM management, scheduling, memory management, trap handling, device emulation
Ring 0 (VMX Non-Root / SVM Guest)
Guest Kernel
Guest OS kernel execution within hardware-enforced isolation
QuantaVirt supports two boot paths: legacy BIOS via a custom two-stage bootloader, and UEFI via an EFI stub application. Both paths converge at the Multiboot2 entry point where the hypervisor kernel initializes.
BIOS Boot Path
Stage
File
Mode
Purpose
Stage 1
boot/bios/stage1.asm
Real Mode (16-bit)
MBR bootstrap — loads Stage 2 from disk, sets up A20 gate
Stage 2
boot/bios/stage2.asm
Protected → Long Mode
E820 memory map, GDT setup, transition to 64-bit, load kernel
The VMX engine manages VM execution on Intel processors using Virtual Machine Control Structures (VMCS). Each vCPU has a dedicated 4 KB VMCS region that controls VM-entry and VM-exit behavior, guest/host state, and execution controls.
The SVM engine manages VM execution on AMD processors using Virtual Machine Control Blocks (VMCB). The VMCB is a 4 KB page-aligned structure containing the control area (offsets 0x000–0x3FF) and the state save area (offsets 0x400–0xFFF).
Complete guest state saved/restored on VMRUN/VMEXIT
SVM Intercept Controls
Intercept
Offset
QuantaVirt Default
Effect
CR0 write
0x000[0]
Set (selective)
Trap guest CR0 writes for mode change tracking
IOIO
0x004[0]
Set + IO Bitmap
Port I/O intercepted selectively via IO Permission Map
MSR
0x004[1]
Set + MSR Bitmap
Selective MSR interception via MSR Permission Map
HLT
0x004[8]
Set
Guest HLT yields to scheduler
CPUID
0x004[10]
Set
CPUID interception for feature masking
VMRUN
0x004[16]
Set
Required — trap nested VMRUN for nested virt support
VMMCALL
0x004[17]
Set
Hypercall interface for PV guests
NPT fault
—
Automatic
Nested page fault generates #VMEXIT with nested fault info
AVIC (Advanced Virtual Interrupt Controller)
On AMD EPYC 7002+ (Rome) and later, QuantaVirt enables AVIC for interrupt virtualization. AVIC provides hardware-accelerated virtual LAPIC access and interrupt injection, reducing VM-exit frequency for interrupt-heavy workloads. The AVIC backing page is a 4 KB page containing the virtual APIC state, mapped into the VMCB control area at offset 0x070.
QuantaVirt uses hardware-assisted two-dimensional paging — Intel EPT and AMD NPT — to translate guest-physical addresses (GPA) to host-physical addresses (HPA) without shadow page tables. This provides isolation between VMs and between VMs and the hypervisor.
EPT / NPT Page Table Structure
Level
Intel Name
AMD Name
Bits Indexed
Page Size
4 (PML4)
EPT PML4
NPT PML4
GPA[47:39]
—
3 (PDPT)
EPT PDPT
NPT PDP
GPA[38:30]
1 GB (huge page)
2 (PD)
EPT PD
NPT PD
GPA[29:21]
2 MB (large page)
1 (PT)
EPT PT
NPT PT
GPA[20:12]
4 KB (standard)
EPT Entry Format (64-bit)
Bits
Field
Description
0
Read
Allow read access to this page
1
Write
Allow write access to this page
2
Execute
Allow instruction fetch from this page
5:3
Memory Type
0=UC, 1=WC, 4=WT, 5=WP, 6=WB
6
Ignore PAT
Ignore guest PAT for memory type selection
7
Large Page
1 = this entry maps a large page (2 MB at PD level, 1 GB at PDPT)
8
Accessed
Hardware sets on access (if enabled)
9
Dirty
Hardware sets on write (if enabled)
10
Execute (user)
Allow execute for user-mode pages (mode-based execute)
N:12
Physical Address
HPA of next-level table or mapped physical page (4 KB aligned)
63
Suppress #VE
Suppress virtualization exceptions for this page
Memory Management APIs
/* From hypervisor/core/vm/vm.h *//* Add a memory region to a VM (backed by host physical pages) */
int vm_add_memory_region(struct vm *vm,
uint64_t gpa_base, /* Guest physical address start */
uint64_t size, /* Region size in bytes */
uint32_t flags); /* VM_MEM_READ | VM_MEM_WRITE | VM_MEM_EXEC *//* Translate guest-physical to host-virtual address */
void *vm_gpa_to_hva(struct vm *vm, uint64_t gpa);
/* Read/write guest memory from hypervisor context */
int vm_read_memory(struct vm *vm, uint64_t gpa, void *buf, size_t len);
int vm_write_memory(struct vm *vm, uint64_t gpa, const void *buf, size_t len);
QuantaVirt includes three vCPU scheduling algorithms. The scheduler maps virtual CPUs to physical CPUs, handles preemption, and manages NUMA-aware placement. The default scheduler is Credit2.
Scheduler
Type
Best For
Key Properties
Credit
Proportional fair-share
Server consolidation, mixed workloads
Weight-based CPU allocation, soft affinity, automatic load balancing across pCPUs
# Set scheduler at boot via kernel parameter
sched=credit2
# Per-VM scheduler weight (higher = more CPU time)
quantavirt vm set ubuntu-server --cpu-weight 256 # Default: 256, range: 1–65535# Per-VM CPU cap (maximum % of one pCPU)
quantavirt vm set ubuntu-server --cpu-cap 0 # 0 = no cap, 100 = one full pCPU# CPU pinning (bind vCPUs to specific pCPUs)
quantavirt vm set ubuntu-server --cpu-pin 0:2,1:3 # vCPU0→pCPU2, vCPU1→pCPU3# NUMA node affinity
quantavirt vm set ubuntu-server --numa-node 0 # Prefer NUMA node 0
The IOMMU subsystem provides DMA remapping for device isolation and PCI passthrough. QuantaVirt discovers IOMMU hardware via ACPI tables: DMAR (DMA Remapping) for Intel VT-d and IVRS (I/O Virtualization Reporting Structure) for AMD-Vi.
QuantaVirt's device model provides emulated and paravirtualized hardware to guest VMs. Devices connect to the guest via an emulated PCI Express topology with MMIO and PIO BAR access trapped through EPT/NPT violations and I/O exit handling.
VirtIO Architecture
VirtIO devices follow the VirtIO 1.1 specification using the modern MMIO transport. Each VirtIO device consists of a device-specific configuration space, one or more virtqueues (split or packed), and a notification mechanism. The guest driver and hypervisor device backend communicate through shared memory rings (virtqueues) with doorbell notifications.
QuantaVirt emulates the x86 interrupt architecture: dual 8259A PIC (legacy), IOAPIC, and per-vCPU LAPIC. Modern guests use MSI/MSI-X for device interrupts, which bypass the IOAPIC entirely and are delivered directly to the target vCPU's LAPIC.
The PQC subsystem is integrated at the hypervisor kernel level, providing cryptographic services to all other subsystems: migration, storage, attestation, and secure boot. The subsystem abstracts over two backends: software (portable, always available) and QUAC 100 hardware (high-performance, requires PCIe card).
QuantaVirt supports hardware-based confidential computing to protect VM memory from the hypervisor itself. This provides defense-in-depth where even a compromised hypervisor cannot read guest secrets.