Skip to content

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

Notifications You must be signed in to change notification settings

rcore-os/RVM-Tutorial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 94.2%
  • Assembly 4.3%
  • Makefile 1.5%