MCPcopy Index your code
hub / github.com/equation314/RVM-Tutorial

github.com/equation314/RVM-Tutorial @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
293 symbols 571 edges 45 files 55 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

RVM-Tutorial

Let's write an x86 hypervisor in Rust from scratch!

Features

  • Lightweight enough, only 3K+ LoC
  • Supported guest OS: NimbOS
  • Guest/host memory isolation with nested paging
  • Device emulation:
    • serial port I/O
    • APIC timer
  • Currently, only supports single core single vCPU and single guest

Install Build Dependencies

Install cargo-binutils to use rust-objcopy and rust-objdump tools:

$ cargo install cargo-binutils

Your also need to install musl-gcc to build guest user applications.

Build Guest OS

$ git submodule init && git submodule update
$ cd guest/nimbos/kernel
$ make user
$ make GUEST=on

Build Guest BIOS

$ cd guest/bios
$ make

Build & Run Hypervisor

$ cd hypervisor
$ make run [LOG=warn|info|debug|trace]
......
Booting from ROM..

    RRRRRR  VV     VV MM    MM
    RR   RR VV     VV MMM  MMM
    RRRRRR   VV   VV  MM MM MM
    RR  RR    VV VV   MM    MM
    RR   RR    VVV    MM    MM
     ___    ____    ___    ___
    |__ \  / __ \  |__ \  |__ \
    __/ / / / / /  __/ /  __/ /
   / __/ / /_/ /  / __/  / __/
  /____/ \____/  /____/ /____/

arch = x86_64
build_mode = release
log_level = info
......
Running guest...

NN   NN  iii               bb        OOOOO    SSSSS
NNN  NN       mm mm mmmm   bb       OO   OO  SS
NN N NN  iii  mmm  mm  mm  bbbbbb   OO   OO   SSSSS
NN  NNN  iii  mmm  mm  mm  bb   bb  OO   OO       SS
NN   NN  iii  mmm  mm  mm  bbbbbb    OOOO0    SSSSS
              ___    ____    ___    ___
             |__ \  / __ \  |__ \  |__ \
             __/ / / / / /  __/ /  __/ /
            / __/ / /_/ /  / __/  / __/
           /____/ \____/  /____/ /____/

arch = x86_64
platform = rvm-guest-x86_64
build_mode = release
log_level = warn
......

Documents

Extension points exported contracts — how you extend this code

RvmHal (Interface)
The interfaces which the underlying software (kernel or hypervisor) must implement. [1 implementers]
rvm/src/hal.rs
PortIoDevice (Interface)
(no doc) [2 implementers]
hypervisor/src/hv/device_emu/mod.rs
MsrReadWrite (Interface)
(no doc) [2 implementers]
rvm/src/arch/x86_64/msr.rs
GenericPTE (Interface)
(no doc) [1 implementers]
rvm/src/mm/page_table.rs

Core symbols most depended-on inside this repo

write
called by 63
rvm/src/arch/x86_64/vmx/structs.rs
bits
called by 41
rvm/src/arch/x86_64/vmx/vmcs.rs
read
called by 36
rvm/src/arch/x86_64/vmx/structs.rs
write
called by 11
hypervisor/src/hv/device_emu/lapic.rs
regs
called by 6
rvm/src/arch/x86_64/vmx/vcpu.rs
paddr
called by 5
rvm/src/arch/x86_64/vmx/ept.rs
set_control
called by 5
rvm/src/arch/x86_64/vmx/vmcs.rs
advance_rip
called by 5
rvm/src/arch/x86_64/vmx/vcpu.rs

Shape

Method 165
Function 69
Class 34
Enum 21
Interface 4

Languages

Rust100%

Modules by API surface

rvm/src/arch/x86_64/vmx/vcpu.rs29 symbols
rvm/src/arch/x86_64/vmx/vmcs.rs28 symbols
rvm/src/mm/page_table.rs23 symbols
hypervisor/src/hv/gpm.rs17 symbols
rvm/src/arch/x86_64/lapic.rs16 symbols
rvm/src/arch/x86_64/vmx/structs.rs15 symbols
rvm/src/arch/x86_64/vmx/ept.rs13 symbols
hypervisor/src/hv/device_emu/uart16550.rs10 symbols
rvm/src/mm/mod.rs9 symbols
hypervisor/src/logging.rs9 symbols
hypervisor/src/arch/x86_64/uart16550.rs9 symbols
rvm/src/lib.rs8 symbols

For agents

$ claude mcp add RVM-Tutorial \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact