JSLinux - Technical Notes
This emulator has a long history. The current version is based
on TinyEMU and compiled to
In 2011 I wrote the initial
Linux. I reused parts of another of my emulators
(QEMU) for the x86 helpers and the
After some time (2015), I modified it to use
it is faster with the browsers supporting it.
In 2016, after having
written TinyEMU, initially
RISC-V emulator, I decided to make
using emscripten. I
added a VirtIO 9P
filesystem inspired by the one
by Sebastian Macke so that it is easier to use remote filesystems
and to import or export files.
Then I found interesting to reuse the VirtIO devices for the x86
JS emulator, so I converted the JSLinux asm.js code to C and
! With a careful tuning, the new version is now faster than the
hand-coded asm.js version.
The next step was to run another operating system than Linux, for
example Windows NT. A first release of this emulator ran Windows
NT with QEMU inside the emulated Linux system. It
was still usable because the x86 emulator supports an x86
virtualization extension (AMD SVM) used by QEMU.
The current version of JSLinux runs Windows NT by emulating the
few missing PC devices (PS/2 keyboard and mouse, IDE disk, dummy VGA).
x86 CPU Emulation
A x86 CPU with the following features is emulated:
- Pentium class CPU
- x87 with bit exact 80 bit floating point numbers
- PAE support
- CMOV instructions
- MMX and SSE2 support
- AMD Virtual Machine extensions (SVM) with Nested Page Table support
- RDPMC support to read the instruction count
- No segment limit and right checks when accessing memory
- No debug support (DRx registers)
- 8259 Programmble Interrupt Controller
- 8254 Programmble Interrupt Timer
- 16450 UART (only used to debug)
- Real Time Clock
- PCI bus
- VirtIO console
- VirtIO 9P filesystem
- VirtIO network
- VirtIO block device
- VirtIO input
- Simple framebuffer
- IDE controller (optional)
- PS/2 keyboard and mouse (optional)
- Dummy VGA display (optional)
RISC-V CPU Emulation
A 32 bit or 64 bit RISC-V CPU is emulated with 64 bit FPU and
Only the RISC-V 64 bit Buildroot and Fedora distributions are now
available. The RISC-V 32 bit images are still available but no
longer actively maintained:
On a typical desktop PC (2017) with a Firefox browser, the
x86 emulator runs about 100 MIPS. Detailed benchmarks are possible
with the integrated
It is an improved version of the original JSLinux one. It has a
scrollbar and supports URL highlighting.
It uses the Alpine Linux
distributions. Custom packages are added for vfsync, qemacs,
tcc. Optional X Window support is available with
Access to Internet is possible inside the emulator. It uses the
websocket VPN offered by Benjamin Burns (see
his blog). The
bandwidth is capped to 40 kB/s and at most two connections are
allowed per public IP address. Please don't abuse the service.
What's the use ?
enough to do complicated things. Real use could be:
technologies (asm.js, WASM).
- Learning to use command line Unix tools without leaving the browser.
- Secure file access within the browser (vfsync).
- Running old PC software.
The source code of the RISC-V version is available in
the TinyEMU project. A
precompiled easy to install demo is also available.
Several other PC or Linux emulators are available. In particular:
- jor1k: OpenRISC OR1K CPU emulator.
- v86: PC emulator.
- angel: RISC-V CPU emulator.