How mirage2032/qemu-wasm works
QEMU Wasm is an experimental browser-hosted system emulator. The documented workflow starts QEMU in a browser, loads a guest image, and executes guest code through either the TCI interpreter or TCG translation; frequently executed translation blocks (TBs) can become Wasm modules instantiated through browser APIs. The README also documents x86_64, AArch64 and RISC-V system guests, plus multi-threaded TCG. The available source excerpts do not show the browser interface or the modified backend wiring, so those connections are documented at README level rather than inferred from imports.
Main entry points: machine.c Machine setup · cpu-exec.c CPU execution · main.c System entry · tcg.c TCG engine
Components 15
Launch and guests
- Guest image
- System entry
system/main.c
CPU execution
- TCG engine
tcg/tcg.c - CPU execution
accel/tcg/cpu-exec.c - Instruction translation
accel/tcg/translator.c - TCI interpreter
accel/tcg - Multi-threaded TCG
accel/tcg/tcg-accel-ops-mttcg.c
Wasm translation
- Wasm backend
tcg/tcg.c - TB Wasm modules
tcg/tcg.c - WebAssembly APIs
Virtual machine
- Machine setup
hw/core/machine.c - Guest CPU models
target/i386/cpu.c - Device models
hw
Other components
- Browser user
- Browser runtime
Connections 14
- Browser user → Browser runtime: starts emulator
- Browser runtime → System entry: runs QEMU
- Guest image → Machine setup: supplies guest
- System entry → Machine setup: starts system
- Machine setup → Guest CPU models: configures CPU
- Machine setup → Device models: provides devices
- CPU execution → TCG engine: executes translated code
- TCG engine → Instruction translation: translates IR
- CPU execution → TCI interpreter: interprets TBs
- Instruction translation → Wasm backend: translates IR
- Wasm backend → TB Wasm modules: generates modules
- TB Wasm modules → WebAssembly APIs: instantiated by
- WebAssembly APIs → Browser runtime: uses browser APIs
- CPU execution → Multi-threaded TCG: runs with threads