How lekkit/rvvm works
Main Components
a. Core Emulation Layer:
• CPU Emulation (src/cpu/)
• RISC-V Interpreter (32/64-bit)
• JIT Compilation System (src/rvjit/)
• MMU Implementation
• CSR Handling
b. Device Emulation Layer:
• Storage Devices
• NVMe Controller
• ATA Controller
• Network Devices
• RTL8169
• OpenCores Ethernet
• Input/Output Devices
• Framebuffer
• HID Devices (Keyboard/Mouse)
• UART/Serial
• GPIO
• System Devices
• PLIC (Platform-Level Interrupt Controller)
• CLINT (Core Local Interruptor)
• PCI Bus Controller
c. Platform Abstraction:
• Multiple GUI Backend Support
• SDL
• X11
• Win32
• Haiku
• Network Stack
• TAP Interfaces
• Port Forwarding
• Host System Integration
• VFIO Support
• Isolation Layer
d. External Interfaces:
• JNI Bindings
• LibRetro Bindings
• Library API (librvvm)
Relationship Flows to Illustrate
a. Guest-Host Interaction:
Host OS → Isolation Layer → RVVM Core → Guest System
b. Device Emulation Flow:
Guest Access → MMU → Device Controllers → Host Drivers
c. CPU Execution Pipeline:
Instruction Fetch → Decoder → JIT/Interpreter → Execution
Implementation Details
• Thread management for SMP
• Memory mapping and management
• Device interrupt routing
• JIT backend selection paths
┌─ External API Layer ─────────────────────┐
• (JNI, LibRetro, Public API) │
• Platform Abstraction Layer ─────────────┤
• (GUI, Network, Host Integration) │
• Device Emulation Layer ─────────────────┤
• (Storage, Network, I/O, System Devices) │
• Core Emulation Layer ──────────────────┤
• (CPU, MMU, JIT, Interrupts) │
• ┘
• Core components (Red)
• Device emulation (Blue)
• Host interfaces (Green)
• External APIs (Yellow)
• Component types
• Connection types
• Security boundaries
• Performance-critical paths
• Configuration options