From First Principles to a Full Virtualization Platform
Introduction: The Virtual Machine
- Why Rust?
- What This Book Covers
- How to Use This Book
- What This Book Is Not
Chapter 1: Project Foundation — Bare-Metal Rust on x86_64
- Setting Up the Cross-Compilation Toolchain
- Memory Allocator for
no_std - The Linker Script
- The Bootloader Handoff — Multiboot2 Entry
- Entering Long Mode from Real Mode
- The Core Kernel Entry Point
- Memory Layout and Early Allocator
- Early Console — Serial Port Output
Chapter 2: Understanding x86_64 Virtualization Hardware
- The Root/Non-Root Execution Mode Model
- CPUID Detection and Feature Enumeration
- Intel VT-x Architecture — VMXON, VMCS, and VM Entry/Exit
- AMD-V Architecture — SVM and the VMCB
- The Virtualization Instruction Set
- Hypervisor Initialization
Chapter 3: Guest Memory Management — Extended Page Tables
- The Two-Level Translation Problem
- EPT Page Table Structure
- AMD NPT — The Parallel Path
- Building Guest RAM Mappings
Chapter 4: VMCS Configuration and Guest CPU State
- VMCS Layout and Field Encoding
- Guest-State Area Configuration
- Host-State Area Configuration
- VMCS Validation and Error Codes
Chapter 5: Virtual CPU Lifecycle — Launch, Resume, and Exits
- The vCPU Data Structure
- VMLAUNCH vs VMRESUME — The First Entry Problem
- VM Entry Failures and Recovery
Chapter 6: Interrupts, Exceptions, and the APIC
- The x86 Interrupt Model Recap
- Virtualizing the IDT — Exception Bitmap Control
- Local APIC Virtualization
- I/O APIC and Interrupt Routing
- Event Injection — Delivering Interrupts to Guests
Chapter 7: I/O Virtualization — MMIO, PIO, and PCI Passthrough
- Memory-Mapped I/O via EPT Intercepts
- Port I/O Interception — IN/OUT Instructions
- PCI Configuration Space Access
- MSI and MSI-X Virtualization
- Device Passthrough Fundamentals
Chapter 8: Virtual Devices — Serial, RTC, and PIT Emulation
- The VirtIO Framework — Paravirtualized Device Standard
- Serial Port Emulation (COM1)
- RTC and PIT Emulation
- HPET — High Precision Event Timer
- ACPI Tables Construction
Chapter 9: Storage and Block Device Virtualization
- VirtIO Block Device Specification
- Building the VirtIO Block Backend
- VirtIO Console — Character Device Virtualization
- Raw Disk Access and Backing Store Management
Chapter 10: Networking Virtualization
- VirtIO Net Device Specification
- Building the VirtIO Net Backend
- TAP Device Integration on Linux
- MAC Address and VLAN Handling
- Network Performance Considerations
Chapter 11: Guest Boot — BIOS/UEFI Firmware Loading
- BIOS vs UEFI Boot Paths
- Loading SeaBIOS — The Simple Path
- Loading OVMF — UEFI Firmware
- Guest Kernel Direct Boot (no firmware)
- Debugging the First Guest Boot
Chapter 12: Multi-vCPU Systems and Scheduling
- vCPU Pinning and Host Thread Mapping
- Inter-Processor Interrupts (IPIs)
- vCPU Scheduling Strategies
- SMP Boot Sequence — Waking APs
- Cross-vCPU State and Communication
Chapter 13: Performance, Debugging, and Security
- Profiling VM Exit Overhead
- TSC Scaling and Clock Virtualization
- GDB Stub and Hypervisor Debugging
- Security Hardening — Isolation and Sandboxing
- Error Handling and Recovery Patterns
- Benchmarking Methodology
- Troubleshooting Common Failures
- Cross-Platform Considerations
- Production Deployment Checklist

