h9: native 9front executables on host hypervisors

Jeff Lindsay, h.d.a.

About

h9 runs native 9front executables directly on macOS, Linux, and Windows, using each host's hypervisor API. There is no VM image, no boot, and no guest kernel: each guest process runs in hardware-isolated user mode, and its system calls are served by drawterm's Plan 9 kernel, running in the host process. One invocation can hold a whole process tree: rc pipelines, servers posting to /srv, rio, and its clients.

h9 is a small Zig library and a thin CLI. It runs arm64 9front binaries on arm64 hosts and amd64 binaries on x86-64 hosts. 386 binaries run on h9's own emulator, which is also how they run in the browser, where there is no CPU to run natively on.

Demo

Below is h9's browser host: h9 built for wasm32-wasi, running in a Web Worker, with 9front's own 386 binaries on h9's own 386 CPU and a small root file system loaded into memory. Type to rc; try ls /bin, cal, primes 1 50, echo hello | tr h H or ps. Ctrl-C interrupts a command. A file dropped on the terminal lands in /usr/glenda, and its path is typed. It needs JavaScript Promise Integration, which Chrome and Edge have from version 137; other browsers are getting it. The demo can also be opened on its own page.

The browser-host proposal explains how it works: drawterm's kernel processes are coroutines on JSPI, and guest memory is part of h9's own linear memory, so system call arguments are read in place.

Documentation

The manual covers using h9, and the design document describes h9 as built. Changes go through proposals; STATUS.md lists them with their status and dependencies.

Source Code

The source is on GitHub, under the MIT license. Building needs Zig 0.16:

git clone https://github.com/progrium/hyper9
cd hyper9
. scripts/env.sh
./scripts/fetch.sh
zig build mkroot
zig build

The browser host builds with zig build web. DEVELOPING.md has the details for each host.

Warning!

h9 is under active development and isn't ready for general use yet. Interfaces and behaviour change without notice.

Contact Info

Please report bugs and send questions through GitHub issues.

λ