Browse by type
Hypocaust is a type-1 RISC-V hypervisor that runs beneath OpenSBI in Host S-mode and virtualizes Guest S-mode without requiring the RISC-V Hypervisor extension. It uses shadow Sv39 page tables, per-VM resource ownership, trapped privileged operations, and mediated devices to run isolated xv6-rust and Linux Guests.
The validated QEMU configuration boots two xv6-rust VMs concurrently on two Host harts, or time-slices both VMs on one Host hart. Each VM owns separate RAM, shadow translation state, virtual interrupt state, virtual PLIC, console frontend, VirtIO queue state, and writable disk image.
[!IMPORTANT] Hypocaust is still a research hypervisor, not a hardened security boundary for hostile production workloads. The validated platform has no concrete RISC-V IOMMU adapter, VM lifecycle/control plane, live migration, or stable compatibility guarantee. See Security and isolation and Known limitations.
| Area | Current status |
|---|---|
| Multi-Guest | Two isolated xv6-rust VMs booted and tested |
| Scheduling | Multi-vCPU run queue; validated with one and two Host harts |
| Memory | Fixed per-VM 128 MiB RAM and shadow-page-table slots |
| Translation | Cached shadow Sv39 roots, ASIDs, incremental PTE synchronization |
| Storage | Per-VM mediated QEMU VirtIO block backend and writable disk |
| Interrupts | Per-vCPU pending state and per-VM virtual PLIC |
| Console | Per-VM buffered/labeled output; exclusive physical input focus |
| Linux | Two Alpine 3.24.1 Guests boot to VM-local initramfs shells |
| Exceptions | Synchronous Guest exceptions forwarded into the owning vCPU |
| Passthrough | Fail-closed IOMMU/IRQ-remap policy API; no QEMU hardware adapter |
xv6-rust user processes (Guest U-mode)
|
xv6-rust kernel (virtual Guest S-mode)
| privileged instructions, PTE writes, SBI, MMIO
v
VM-owned vCPU state
|
+-------------+----------------+
| |
shadow Sv39 VM DeviceBus
GVA -> GPA -> HPA virtual PLIC/console/VirtIO
| |
+-------------+----------------+
|
Hypocaust Host S-mode scheduler
|
OpenSBI M-mode
|
QEMU `virt`
The Guest owns an Sv39 GVA→GPA page table. Hypocaust mirrors valid Guest mappings into a hardware-walked shadow table whose leaves contain only Host physical pages owned by that VM. Guest page-table pages are write-protected; a trapped 64-bit PTE update is validated, mirrored incrementally, and followed by an ASID-scoped TLB invalidation when required.
This avoids a software page-table walk on every Guest memory access: normal loads, stores, and instruction fetches use the hardware TLB and shadow Sv39 tree. Full Guest walks occur when a new or stale shadow root must be built. Cached root generations, valid-PTE counts, and ASIDs reduce that slow path.
GuestMemory also supports checked HPA→GPA lookup. That is reverse address
translation for ownership checks (for example, recognizing a trapped PTE
alias); it is not a reverse page-table walk and is O(1) for the current
contiguous VM slots.
Performance design and counters are documented in:
Every VM owns one DeviceBus. Guest MMIO faults are resolved through the
currently scheduled VcpuKey, then routed only to the bus owned by that VM.
The QEMU block implementation is mediated, not raw passthrough: Hypocaust traps the Guest-visible VirtIO MMIO interface, validates and translates the complete DMA range, tracks asynchronous completion, and injects the VM-local virtual PLIC source. QEMU executes the storage request against that VM's disk image.
Real physical passthrough is a separate opt-in contract. It requires exclusive device and Host-MMIO ownership, an IOMMU domain whose DMA aperture covers only the owning VM's RAM, and explicit Host IRQ→Guest PLIC remapping. Platforms without such an adapter must use mediated or emulated devices. See IOMMU-protected passthrough.
Physical timer/IPI/device interrupts belong to the Host. Device completion is
converted into pending state on one destination vCPU and one VM-local virtual
PLIC. The Guest observes only its virtual sip, sie, PLIC contexts, and
claim/complete state.
Synchronous exceptions caused by Guest execution remain vCPU-local. Hypocaust
emulates supported privileged instructions and MMIO accesses, then injects any
unsupported exception through that vCPU's shadow scause, sepc, stval,
sstatus, and stvec. Exceptions raised while Hypocaust itself executes, and
unexpected physical interrupts, remain Host-fatal integration errors. See
Guest exception forwarding.
| Component | Validated configuration |
|---|---|
| ISA | RV64GC with Sv39; H extension not required |
| Machine | QEMU virt |
| Firmware | QEMU bundled OpenSBI; Linux uses a verified one-instruction copy patch |
| Host harts | 1 (time-sliced) and 2 (concurrent) |
| Guests | 2 VMs, one vCPU each |
| Guest RAM | 128 MiB per VM |
| QEMU RAM | 3 GiB |
| Guest OS | xv6-rust SBI payload; Alpine Linux 3.24.1 initramfs shell |
| xv6-rust revision | 0e61a5e (main, includes PRs #60 and #61) |
| QEMU | 11.1.1 |
| Rust | nightly-2026-09-02 |
Other versions may work, but are not part of the current compatibility baseline.
Install and place on PATH:
qemu-system-riscv64;riscv64-unknown-elf-* or riscv64-elf-* bare-metal C tools for xv6-rust
userspace;The repository pins the Rust toolchain and RISC-V target in
rust-toolchain.toml. Install the binary utilities used by make asm if
needed:
cargo install cargo-binutils --version 0.4.0 --locked
Verify the principal runtime tools:
rustc --version
qemu-system-riscv64 --version
xv6-rust is an external Guest example, not a Hypocaust submodule. Clone both repositories as siblings; xv6-rust keeps its own required submodules.
git clone https://github.com/KuangjuX/hypocaust.git
git clone --recurse-submodules https://github.com/Ko-oK-OS/xv6-rust.git
git -C xv6-rust checkout 0e61a5e
git -C xv6-rust submodule update --init --recursive
cd hypocaust
make -C examples/xv6-rust run
The example:
guest_kernel input;fs-vm0.img and fs-vm1.img writable disks;SMP=2.For a checkout in another location:
make -C examples/xv6-rust run \
XV6_RUST_DIR=/absolute/path/to/xv6-rust
A successful boot contains both of these records:
[Guest VM 0] file system: initialized by system thread
[Guest VM 1] file system: initialized by system thread
VM 0 initially owns physical console input. At its prompt, a smoke test is:
[Guest VM 0] xv6 Rust >>> echo HYPOCAUST_OK
[Guest VM 0] HYPOCAUST_OK
Press Ctrl-a, then x, to exit QEMU. After artifacts are prepared,
make qemu SMP=1 time-slices both VMs on one Host hart and make qemu SMP=2
runs them concurrently. Hypocaust never fetches, switches, cleans, or edits the
external xv6-rust checkout.
See the complete xv6-rust example contract.
Linux is also an external Guest example rather than a submodule. The reproducible workflow pins Alpine Linux 3.24.1, verifies the official ISO checksum, extracts its RISC-V lts kernel and initramfs, and boots two BusyBox shells:
make qemu-linux
Install curl, gzip, bsdtar, and either sha256sum or shasum in addition
to the base prerequisites. Generated artifacts stay in ignored paths and the
download cache stays under target/.
A successful boot reaches both records:
[Guest VM 0] Run /bin/sh as init process
[Guest VM 1] Run /bin/sh as init process
VM 0 owns keyboard focus. The BusyBox shell is PID 1 and therefore reports that
job control is unavailable, but it accepts commands at its labelled ~ #
prompt. The example prepares a private OpenSBI copy that delegates Guest
privileged traps directly to Hypocaust. See the complete
Alpine Linux example contract.
| Command | Purpose |
|---|---|
make help |
Show supported workflows and path overrides |
make xv6-rust |
Rebuild and copy Guest kernel/two disk images |
make build |
Build Hypocaust with existing Guest artifacts |
make qemu SMP=1 |
Boot two time-sliced VMs |
make qemu SMP=2 |
Boot two concurrently running VMs |
make qemu-xv6 SMP=2 |
Refresh Guest artifacts and boot |
make qemu-linux |
Verify Alpine artifacts and boot two initramfs shells |
make qemu-gdb |
Start QEMU paused with GDB on TCP port 1234 |
make asm |
Generate Host and Guest disassemblies |
make clean |
Remove Hypocaust outputs and copied Guest artifacts |
In one terminal:
make qemu-gdb SMP=2
In another:
gdb-multiarch target/riscv64gc-unknown-none-elf/debug/hypocaust
(gdb) set architecture riscv:rv64
(gdb) target remote :1234
| Region | Host physical range | Purpose |
|---|---|---|
| Firmware | 0x8000_0000..0x8020_0000 |
OpenSBI |
| Hypocaust | 0x8020_0000..0x8800_0000 |
Host code/data/heap/page tables |
| VM 0 RAM | 0x8800_0000..0x9000_0000 |
128 MiB private Guest backing |
| VM 1 RAM | 0x9000_0000..0x9800_0000 |
128 MiB private Guest backing |
| VM 2 slot | 0x9800_0000..0xa000_0000 |
reserved fixed-capacity slot |
| Shadow slots | 0x1_0000_0000..0x1_1800_0000 |
three 128 MiB shadow arenas |
Each active Guest sees its own RAM at 0x8000_0000..0x8800_0000. Host
trampoline and trap-context pages occupy the top two canonical virtual pages.
See the memory layout diagram.
The current design enforces explicit VM ownership for Guest RAM, shadow page tables, vCPUs, device buses, virtual interrupt state, PLICs, VirtIO backends, disk images, and console buffers. Checked Guest-memory translation rejects DMA or page-table ranges outside the owning VM.
These mechanisms have not undergone a security audit. Several Guest-facing paths still use assertions for invariant failures, QEMU firmware is trusted, and the no-H-extension execution model relies on OpenSBI trap behavior. Do not run untrusted workloads or expose Hypocaust as a production security boundary.
Please report security-sensitive findings privately to the repository owner before opening a public issue.
virt is the only validated board.WFI is currently emulated as a no-op, so idle Guests can consume Host
CPU and generate extra firmware traps.| Path | Purpose |
|---|---|
src/hypervisor/ |
scheduler, trap entry, SBI/CSR emulation, Host runtime |
src/guest/ |
VM/vCPU state, Guest memory, shadow-page-table lifecycle |
src/device_emu/ |
per-VM PLIC, console, mediated VirtIO, passthrough policy |
src/mm/ |
Host mappings and Guest ELF loading |
src/page_table/ |
Sv39 page-table implementation |
src/constants/ |
board and fixed memory-layout constants |
examples/xv6-rust/ |
external Guest integration; no vendored Guest source |
examples/linux/ |
verified Alpine artifact workflow; no vendored Guest source |
docs/ |
f |
browse all types & interfaces →
$ claude mcp add hypocaust \
-- python -m otcore.mcp_server <graph>