v86
How it works
v86 emulates an x86 CPU and PC devices in JavaScript and Rust. To reach acceptable performance, instead of interpreting every instruction it dynamically translates blocks of guest machine code into WebAssembly modules that are generated and loaded on the fly (a JIT). Floating-point operations use the Berkeley SoftFloat library (precise but slow). Hard disk, floppy, and CD images are supplied by the user and stay on the client side; networking is handled through emulated NE2000/virtio cards and an external proxy. The full machine state can be saved and later restored.
Problem solved
Running untrusted code or whole operating systems usually requires a server, a virtual machine, or native virtualization with the right privileges. v86 recreates a complete x86 computer on the client side, inside the browser's sandbox, removing the need for trusted server infrastructure and providing isolation at the WebAssembly/browser sandbox boundary.
Components
The core emulating an x86-compatible CPU at roughly Pentium 4 level with full SSE3; no 64-bit mode and no multicore.
Translates blocks of guest machine code into WebAssembly modules generated at runtime, substantially speeding up emulation.
A set of emulated devices: VGA/SVGA, IDE with an ISO 9660 generator, PS/2, PIT, PIC, CMOS RTC, NE2000, virtio, SoundBlaster 16, and a Hayes modem.
A mechanism to serialize the full machine state (with zstd compression), allowing an environment to be resumed from a saved point.
Implementation
The instruction set is at Pentium 4 level (with SSE3); 64-bit extensions and multicore are missing, so 64-bit kernels and systems do not run.
The x86-to-wasm JIT is much faster than interpretation but slower than native virtualization (e.g. KVM); FPU emulation via Berkeley SoftFloat is precise but slow.
v86's safety as a sandbox rests on the WebAssembly and browser boundary; a browser sandbox escape removes the guest isolation.
Hardware requirements
v86 runs entirely in the browser as WebAssembly, so it is independent of specific hardware and runs on any CPU with WebAssembly support.