Skip to content

trust0-project/bavy

Repository files navigation

Bavy VM

RISC-V Rust WASM

A modern, modular RISC-V virtualization ecosystem built in Rust.

Web DemoDocumentationComponents

Screenshot 2025-11-28 at 21 49 31

Overview

BAVY is a high-performance emulator and operating system environment designed to bring the RISC-V architecture to the browser and desktop. It features a complete RV64GC virtual machine, a custom bare-metal kernel, and a peer-to-peer networking relay, all written in Rust.

Whether you want to run Linux in your browser, learn about OS development, or experiment with networked virtual machines, riscv provides the tools you need.

The operating system and tooling is fully customizable and includes a fully functional javascript runtime

Components

This repository is organized as a workspace containing several loosely coupled components:

The core emulator implementing the RISC-V 64-bit instruction set (RV64GC).

  • Features: MMU, VirtIO, UART, PLIC, CLINT.
  • Targets: WebAssembly (Browser) and Native (CLI).
  • Networking: WebSocket, WebTransport, and TAP backends.

A custom bare-metal operating system kernel written in Rust.

  • Features: TCP/IP stack, Interactive CLI, Heap Allocator.
  • Purpose: Demonstrates VM capabilities and provides a lightweight runtime environment.

A P2P WebTransport relay server.

  • Features: Enables browser-to-browser and browser-to-internet networking.
  • Role: Acts as a NAT gateway and signaling server for VM instances.

Quick Start

1. Build the Project

Ensure you have Rust and the RISC-V target installed:

rustup target add riscv64gc-unknown-none-elf
sh ./build.sh

2. Run the Kernel

Boot the custom kernel in the emulator:

cargo run -p riscv-vm --release -- --kernel target/riscv64gc-unknown-none-elf/release/kernel

3. Enable Networking

To enable networking, first start the relay server (or use a public one):

# Terminal 1: Start Relay
cargo run -p relay --release

# Terminal 2: Run VM with networking
cargo run -p riscv-vm --release -- \
  --kernel target/riscv64gc-unknown-none-elf/release/kernel \
  --net-webtransport https://127.0.0.1:4433 \
  --net-cert-hash <HASH_FROM_RELAY_OUTPUT>

Architecture

The system emulates a standard RISC-V board with the following memory map:

Address Device Description
0x0010_0000 Test Test Finisher
0x0200_0000 CLINT Core Local Interruptor
0x0C00_0000 PLIC Platform Interrupt Controller
0x1000_0000 UART Serial Console
0x1000_1000 VirtIO Block Device (Disk)
0x1000_2000 VirtIO Network Device
0x8000_0000 DRAM Main Memory (512 MiB)

License

MIT License. Made with ❤️ and Rust.

About

Virtual machine that runs riscv kernels on it

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •