kvm-rs
A playground for the Kernel Virtual Machine
(KVM)
in rust to
learn about KVM
, rust
ffi
and x86_64
.
The sources are structured as follows:
- src/
provides a small library as abstraction over the raw KVM
API.
- examples/
contains example VMs using the library above.
- guest/
contains the guest source code which is run inside the VMs.
- sysdeps/
contains helper to generate some KVM constants from
the system header (executed by build.rs).
Documentation
Rustdoc for this crate is avalable at johannst.github.io/mini-kvm-rs.
Requirements
- Kernel with
kvm
support and permissions to open/dev/kvm
. - Compiler & binuitls for generating the guest images.
Real Mode (16bit) example
Runs the real mode VM with the guest program.
# Once: Build the guest binary image.
make -C guest
# Run the Real Mode example.
cargo run --example real_mode
Long Mode (64bit) example
Runs the long mode VM with the guest program.
# Once: Build the guest binary image.
make -C guest
# Run the Long Mode example.
cargo run --example long_mode
License
This project is licensed under the MIT license.