The RISC-V Virtual Machine
RVVM is a virtual machine / emulator for RISC-V guests, which emphasizes on performance, security, lean code and portability. It already runs a lot of guest operating systems, including Linux, Haiku, FreeBSD, OpenBSD, etc. It also aims to run RISC-V applications on a foreign-arch host without full OS guest & isolation (Userland emulation).
Currently builds using GNU Make (recommended) or CMake and is extremely portable.
git clone https://github.com/LekKit/RVVM
cd RVVM
make
cd release.linux.x86_64
./rvvm_x86_64 -h
Alternatively, you can use CMake:
git clone https://github.com/LekKit/RVVM
cd RVVM
cmake -S. -Bbuild
cmake --build build --target all
cd build
./rvvm -h
See the wiki page for advanced build manual like cross-compilation.
Example: Launches a dual-core VM with 2 GiB of RAM, 1280x720 display.
Runs OpenSBI + U-Boot firmware, EFI guest from drive.img
. Forwards host 127.0.0.1:2022
into guest SSH port.
rvvm fw_payload.bin -i drive.img -m 2G -smp 2 -res 1280x720 -portfwd tcp/127.0.0.1:2022=22
Argument explanation:
[fw_payload.bin] Initial M-mode firmware, OpenSBI + U-Boot in this case
-i drive.img Attach preferred storage image (Currently as NVMe)
-m 2G Memory amount (may be suffixed by k/M/G), default 256M
-smp 2 Amount of cores, single-core machine by default
-res 1280x720 Set display(s) resolution
-portfwd 8080=80 Port forwarding (Extended: tcp/127.0.0.1:8080=80)
. . .
-rv32 Enable 32-bit RISC-V, 64-bit by default
-v Verbose mode
-h Extended help
See wiki page for recommended guest firmware/images and full argument explanation.
The librvvm library is licensed under non-viral MPL 2.0 license.
If you wish to use librvvm as a component of a larger, non-GPL compliant project (permissive, etc), you are free
to do so in any form (Static linkage, binary distribution, modules) as long as you comply with the MPL 2.0 license.
The RVVM Manager and Linux userland emulator (rvvm and rvvm-user) binaries are licensed under the GPL 3.0
license, since they are intended for end-users. All the heavy lifting is done by librvvm anyways.
Source file headers should be gradually fixed to reflect this.
Achievements | Working on | |
---|---|---|
LekKit | RVVM API & infrastructure RV64IMAFDC interpreter, MMU/IRQs/Priv/etc RVJIT Compiler, X86/RISC-V backends NVMe, RTL8169, VFIO, many tiny devices Userspace network Rework of PCIe, PLIC, etc |
Networking, Userspace emulation COW blk-dedup image format New CPU features & JIT optimizations |
cerg2010cerg2010 | Important fixes, RV64 groundwork, FPU Initial PLIC & PCI, PS2 HID, ATA, OC Ethernet ARM/ARM64 RVJIT backends |
Testing, Assistance |
Mr0maks | Initial C/M/Zicsr extensions, initial UART, VM debugger ARM32 mul/div JIT intrinsics |
- |
0xCatPKG | Userspace network & API improvements Extended testing & portability fixes |
HD Audio |
X547 | Haiku GUI, I2C HID, Userland API assistance | Guest Haiku support, UserlandVM |
iyzsong | OpenBSD & PLIC fixes, Chardev API | |
nebulka1 | Relative input mode |
The RISC-V trade name is a registered trade mark of RISC-V International.