A RISC-V kernel we built, running in the browser

our rv64g kernel, booted by QEMU compiled to WebAssembly
Authors
Adam Iwaniec
Yixuan Li
ECE 391 · University of Illinois Urbana-Champaign

IllinixOS is an rv64g operating-system kernel we wrote: preemptive multitasking, fork/exec, Sv39 virtual memory, an ELF loader, and a virtio block-device filesystem. This page runs that kernel live in the browser. QEMU is compiled to WebAssembly here in order to boot it; the kernel and disk image here are the same ones that run under native QEMU. This was built as the final project for ECE 391 (Computer Systems Engineering) at the University of Illinois Urbana-Champaign.

ISA rv64g (M/S/U) MMU Sv39 paging Sched preemptive + fork/exec Disk virtio-blk filesystem Boot bare-metal M-mode Host QEMU → WebAssembly
idle

Or type a name in the shell: donut life maze sort trek rule30 fibfib

Kernel consoleboot log · thread outputUART0
Interactive shelltype a program name, e.g. rule30UART1
How it works
1

M-mode boot

The kernel starts in machine mode at 0x80000000, sets up PMP and trap delegation, then drops to supervisor mode. No firmware underneath.

2

Virtual memory

Sv39 page tables map the kernel and devices. The timer and PLIC interrupt controller are brought up.

3

Mount the disk

A virtio-blk MMIO device is negotiated and the on-disk filesystem (kfs.raw) is mounted. The user programs live there.

4

Shell in user mode

The kernel execs the shell (termio) on UART1. A program forks and execs a child.

  • Left pane (UART0): kernel console, boot log and background thread output.
  • Right pane (UART1): the interactive shell. The kernel drives two serial consoles at once.
  • The demo buttons run small userland programs that draw to the shell pane.
  • QEMU is compiled to WebAssembly (ktock/qemu-wasm) and emulates the whole RISC-V machine in the browser.
  • The guest is the standard QEMU virt board with extra NS16550 UARTs for the multi-console setup.

Boot IllinixOS

Launches a RISC-V machine in the browser by downloading a WebAssembly build of QEMU (a few MB). Desktop browsers work best. On the first visit the page may reload once to enable the threading QEMU needs.