NOTE: This project is still work in progress!
rvvisor is a tiny hypervisor written in Rust, which partially supports RISC-V Hypervisor Extension v0.6.1 included in Volume II: RISC-V Privileged Architectures V1.12-draft).
This project relies on the following tools.
To run rvvisor, you need to install them and configure your PATH
first.
Here's a list of the possible usecases:
- Run rvvisor with an example kernel
- (in the future) Run our hypervisor with your own kernel
You can run the simple guest kernel, whose implementation is in ./guest
directory, as follows.
rustup target add riscv64gc-unknown-none-elf || true
# build hypervisor
cd hypervisor
CC=riscv64-unknown-linux-gnu-gcc cargo build
cd ..
# build guest
cd guest
CC=riscv64-unknown-linux-gnu-gcc cargo build
cd ..
# run hypervisor with guest
cd hypervisor
cargo run -- -drive file=../guest/target/riscv64gc-unknown-none-elf/debug/riscv-virt-guest,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
Currently, due to the lack of features, famous kernels like xv6-riscv or Linux do NOT work upon rrvisor.
You can debug rvvisor with gdb like this:
# in a shell ...
$ cargo run -- -S -gdb tcp::9999 # + additional opts
# in another shell ...
$ riscv64-unknown-linux-gnu-gdb target/riscv64gc-unknown-none-elf/debug/rvvisor
...
(gdb) target remote localhost:9999
(gdb) continue
rvvisor currently supports the following features:
- 🚧 Run a single VM upon rvvisor
- load ELF image into the memory space of a VM
- jump to the kernel image loaded to a VM image whiel enabling guest physical address translation by
hgatp
- run a tiny kernel which does not require any external hardwares like disk devices
- handle read/write requests for CSRs from a guest
- handle SBI calls
- Run multiple VMs upon rvvisor
- switch CPU contexts among guests
- schedule the guest in a fancy way
- Support multi-core host environment
- Support device virtualization
- block device
- network device
- input device
- display device