The hypervisor: a Linux kernel, a real Chromium, and the keystrokes that took two more days

On the evening of August 21, Chromium rendered the project's own website, over real HTTPS, inside a window on the UnoDOS desktop. The browser was not ported. It was running on a Linux kernel, and the kernel was running on UnoDOS, which had entered VMX operation for the first time fifteen days earlier and was now hosting a foreign operating system from inside its own single-threaded frame loop.

I want to be precise, because this is where the "from scratch" story is sharpest and easiest to oversell. The hypervisor is from scratch: the VMX backend, the extended page tables, the instruction decoder, the virtio devices, the interrupt controllers, the serial port, the keyboard controller, the boot protocol that hands a bzImage its zero page. Nothing inside the guest is, and that is the point of a hypervisor. And as of the tip of the repo, you cannot type a letter into that browser from the UnoDOS keyboard. The post says so because the repo says so.

One ladder, fifteen days

The programme was written on August 6 (b836d46a) as a ladder: a foothold you can prove with one round trip, then translation, then legible exits, then supply. The foothold landed the same afternoon:

a6142f41 unovirt: A1 PASSES on VMX - a guest ran, answered, resumed and died safely Three claims with three pieces of evidence, not one summary. The marker arrived in GUEST memory, written by the guest's own store through its own page tables. The second entry is at RIP+2 and exits on HLT, which the guest only reaches by executing the stores after the intercepted instruction - a wrong RIP advance does not give a wrong answer, it gives a guest that executes CPUID forever.

Each claim is chosen so the wrong mechanism cannot produce it. A2 through A5 followed within hours: an address space, a guest run as a 4 ms slice of the frame loop under the VMX preemption timer (an OS with no scheduler gives a guest a budget, not a thread), a clock, an interrupt, a virtio console. Then A6 swapped the test guest for a 16.8 MB Ubuntu kernel, and the hypervisor started being wrong in interesting ways.

The default is never "works"

The kernel's first run printed nothing, and the explanation is my favourite finding in the programme:

a2cfec12 unovirt: A6 - Linux boots under UnoDOS and says so Then it ran 1454 exits and said nothing, ending in hlt. The tell was in the numbers rather than the log: ZERO of those exits were port I/O, and a booting kernel touches the PIT, the CMOS and the PCI config ports constantly. Port I/O does not exit unless asked - without the unconditional-I/O-exiting control the guest's in and out had been executing NATIVELY against this machine's real ports. The kernel was not failing to reach its serial port; it was reaching the host's.

Same day, same shape, twice more. INVPCID faults in a guest unless a secondary control enables it, while CPUID says it is available, and "Linux believes CPUID" (f2b16bad). Then the kernel sat on port 0x71 forever because an absent port answered all-ones, and in a CMOS status register all-ones means update-in-progress (0bacb685: "0xFF IS A DANGEROUS DEFAULT: absent hardware should read as quiet, not as busy"). That commit states the rule: "the default is never 'works as on real hardware'. It is either 'traps', or 'reads as busy forever', and CPUID will happily tell the guest otherwise." The kernel then ran to its root-filesystem panic, 333 lines in.

The reply is the criterion

A6's exit criterion was never "Linux boots." It was a shell that reads a command and answers. The agent had a kernel printing 333 lines and still marked the phase open, twice, in its own commit messages ("NOT a shell, which is what the criterion says, so A6 stays open"). When it closed:

6138ba7a unovirt: A6 is met - the guest shell reads a command and answers The reply is the criterion. Kernel output only ever proved that a kernel runs; an answer proves the guest read a line we sent it, ran it, and replied - the receive FIFO, the 8259, the injection and the frame loop, end to end, in something that cannot be produced any other way. It is counted rather than eyeballed (lines that START with the marker; the echoed command begins '~ # echo') and reported as 'shell ANSWERED'.

The criterion recurs at every later rung. When the guest got a display, the test was a command typed through the window and answered on the guest's own framebuffer; the plan's phase table says "pixels alone prove a blit, an answer proves the whole loop." When it got a network, the init was rewritten to make "TWO claims rather than one, because they fail for different reasons and a single 'it did not work' cannot tell them apart" (048afbe8), then three, the last a real HTTPS fetch by a second program, "so a browser showing a page is confirmed rather than interpreted" (2cfab74a). The screenshot of Chromium is not the evidence. The line in the serial log is.

The bug the driver misreported

A7a gave the guest a disk: virtio-blk backed by an ordinary file on a UnoDOS volume. The Linux driver refused it with device refuses features: 0, a clear message pointing at feature negotiation. It was wrong.

16a8c132 unovirt: A7a - the guest mounts a disk that is a file on a UnoDOS volume THE BUG WAS NOT IN THE NEW CODE. gpr() had RSI and RDI mapped to each other's slots, latent since A5 because every hand-written test guest uses rax/rbx/rcx/rdx and guest port I/O goes through rax. virtio-mmio writes its status byte from ESI, so every status write arrived as an unrelated 0x04ef0000, the status register read back as zero, and the driver reported 'device refuses features: 0' - a conclusion about FEATURES that had nothing to do with features. A wrong register file is invisible until something uses the register you got wrong, and it names the wrong subsystem when it fails. What found it was recording the register TRAFFIC and reading the driver's side of the conversation instead of its verdict.

The fix is one line; the method is the sentence about traffic versus verdict. The driver's conclusion was a summary of evidence it had already discarded; logging what it actually wrote showed every read perfect and every write from one register garbage, a decoder bug however confidently the message said otherwise. The fix then nearly got lost: a branch was moving gpr() between files while master fixed it in place, and 225d902f notes "git has no way to see they are the same thing." Running the ladder on the branch is what caught it.

After v3.34.0

Everything from here landed on August 21 and 22, after v3.34.0.

A8 gave the guest a linear framebuffer, which a stock kernel drives with no driver from the host, and an emulated i8042, a PS/2 keyboard and mouse. That choice is a finding, not nostalgia: virtio-input "cannot cross a virtio-mmio v2 transport with a stock kernel: the driver reads its capability bitmaps with one config access of the bitmap's own length, and vm_get() BUG()s on any length outside 1/2/4/8" (157bd0de).

The A8 finding I keep returning to is about time. The guest's timer counted guest cycles, correctly, but a guest parked on hlt accrues none, "so the one-shot timer a NO_HZ kernel arms before idling never fired, and the 6.12 boot slept forever at default_idle+0xe the first time its boot thread blocked" (ddd4136e). A halted core's clock keeps running on silicon. A dump of the guest's registers after ten silent seconds found it, "which turned three plausible wrong theories into one right one."

Then Chromium, and the A6 shape twice more: CPUID leaf 7 still advertised AVX2 after leaf 1 had been scrubbed of XSAVE (cb423595), and RDTSCP, like INVPCID, faults until a control bit is set, "found the same way Chromium finds everything: by crashing" (6c315792). That one is the agent wrong in the right direction: the crash was in a SIMD library, every theory was about SIMD, and disassembling the crash offset found a timestamp instruction "in timing code nobody suspected while every AVX theory was being ruled out."

Five things, one of them virtualization

Putting the guest on the real wire was expected to need NAT, since guest and host share one network card. It did not: "the guest keeps its own MAC and DHCPs for its own lease, which works because every NIC driver here already runs promiscuous" (26693e04), and two additive lines in the network stack (f251e7ff) offer each inbound frame to the guest first. The browser still did not browse, and the commit that closed M3 says why:

d1be9d01 docs: M3 is met - Chromium browses the internet inside UnoDOS five things stood between a working bridge and a working browser and only the first was virtualization: a bridge armed before any link existed, a browser that caches its first failure forever, an appliance with no CA roots, a CMOS answering with a hardcoded date while TLS checks the clock, and a harness box whose own resolver answers for some names and not others.

Each presented as "the network is broken." The bridge bound its link at boot, before a link existed, so the guest "transmitted 33 frames and received 2, which reads like a broken wire and was a wire nobody had plugged in" (d8b97480). And the hypervisor's CMOS had answered with a fixed 2026-08-06 since A6, while "A TLS chain is checked against the clock, so a guest fifteen days in the past rejects every certificate issued since" (34ee787e): "a hardcoded date does not risk this, it guarantees it." By then the hypervisor was the part that worked.

The letters

This is where the repository stood on August 22, and where the first draft of this essay stopped.

Ctrl was at first dropped, so Ctrl+L "reached the guest as a bare 'l' typed into the page" (0739fe2a). Fixed. Then the guest ignored everything, and four twenty-five-minute runs failed to say which side was losing it, so 104c17cf put counters on both sides "and the next failure names its own side." It was the hypervisor's: bit 4 of the i8042 status register is the keyboard inhibit switch and reads 1 for unlocked; ours read 0, and "real hardware with that switch engaged declines to deliver keystrokes at all, so a guest is entitled to believe it" (948ac21a). That was found by booting the same appliance under plain QEMU and diffing the kernel logs, a loop that "takes two minutes where the hypervisor harness takes twenty-five." The same loop showed the agent's own evdev probe "had been reporting nothing for two runs."

The X server then segfaulted on the guest's framebuffer three ways without flushing a backtrace and was replaced by a Wayland kiosk compositor (fb61a800). The docs commit at the end of this work records the state as it is:

a74b412b docs: M4 - the appliance is a browser appliance, and what is still open Open, and narrowly: plain letters typed from the host do not reach it, while the same appliance image takes a typed URL happily under plain QEMU (shots/browser_typed_url.png). The emulated controller reports every keystroke queued and none dropped, so the loss is above the guest's input layer rather than in the i8042 - the next instrument is libinput's own debug-events inside the guest

So, on August 22: Ctrl+L and Backspace crossed from the UnoDOS keyboard into Chromium's address bar, and plain letters did not. The next step named in the repo was an instrument, not a theory.

The instrument found that the question was wrong. 9ea1e957 (August 23) is titled "the compositor was never running, and three diagnostics that lied": a debug flag that cage, the kiosk compositor, does not have "made cage print its usage and exit 1, so the appliance fell through to its X fallback on every boot since - silently, because the fallback works under plain QEMU. Every conclusion drawn in that window about 'the Wayland session' was drawn about a session that never started." The three liars: an interrupt counter that read one CPU's column while the keyboard's interrupt landed on the other, so it printed zero through runs in which every keystroke arrived; a screenshot that "proved" modifiers arrived but had been captured under plain QEMU; and the evdev probe, which had been reporting nothing for two runs. With the compositor actually running, the letters arrived. c75d2427, the same day: "Ctrl+L and example.net, typed a letter at a time through the Appliances window, navigate Chromium inside the guest." M4's open item "was not a keyboard fault."

The second appliance landed the same day and found a bug in the hypervisor itself. GIMP "died three seconds into startup under unovirt, every launch", and the cause was that unovirt had never saved the guest's floating-point and SSE registers across a VM entry: "x87, MMX, XMM0-15 and MXCSR passed straight between UnoDOS and its guest, in both directions, at every one of the ~60 slice boundaries a second" (14c9f5d7). A browser had survived that for weeks. UnoDOS is a graphical OS whose blitters and font rendering live in XMM, so both sides had been corrupting each other's state the whole time, and only a program that leaned on floating point hard enough fell over. KVM does an XSAVE around every entry; "it is not an optimisation to skip."

What is still open, from the v3.35.0 release notes rather than from me. Every appliance result above was produced with UnoDOS itself running under nested KVM on Intel machines. On real hardware, a ZimaBlade, the browser appliance booted and got no network, because the guest bridge had only ever worked on Intel network cards; the Realtek driver now goes promiscuous for exactly as long as a guest is on the wire, but that fix has not yet been seen carrying a guest, and that board's uncached framebuffer holds the appliance display near four frames a second. The AMD backend compiles, and its first guest entry has never returned. Chromium still aborts now and then on an assertion in its number-formatting library and is restarted. And none of this can run in the browser demo: the in-browser OS is an emulated CPU with no VMX, so the proof here is a recording, not a thing you can click.

The lesson

Define the criterion as a reply, not as output. A kernel that prints 333 lines proves a kernel runs. A driver that says "device refuses features" proves a driver reached a conclusion. A screenshot proves pixels were blitted. None of them proves the loop you built. The rule applied at every rung was to send something in and require something back that could not have come from anywhere else: an echoed marker, a mounted file's contents, an HTTPS fetch by a second program. Where the criterion could not be met, the phase stayed open in the agent's own commit message. The keyboard case is the same rule applied twice: the letters had not been answered, so the milestone was not claimed; and when the answer came, it was that the instrument measuring the question had been reading the wrong CPU.

The next essay is about the other thing the OS now hosts, a VS Code-class editor with an extension host on its own JavaScript runtime and an AI assistant inside it, and what the same method looked like when the artifact became a public project of its own.

Sources: https://github.com/hmofet/unodos, commits b836d46a, a6142f41, a2cfec12, f2b16bad, 0bacb685, 6138ba7a, 16a8c132, 225d902f, 21b53221 (August 6-7); ddd4136e, 157bd0de, cb423595, 6c315792, f251e7ff, 26693e04, d8b97480, 048afbe8, 2cfab74a, 34ee787e, d1be9d01, 0739fe2a, 104c17cf, 948ac21a, fb61a800, a74b412b, be1cf7a4 (August 21-22); 9ea1e957, c75d2427, 14c9f5d7, b0c6ca8a, 3f339d50 (August 23); docs/UNOVIRT-PLAN.md (status line and ยง7 phase table); pc64/UNOVIRT.md (A6, A7a, "The manager on real hardware", changelog); all as of origin/master 2026-08-23.

The OS in this piece runs in your browser. No install, no sign-up: boot it in a tab, or download it for any of 22 machines.

Get the next one

New essays roughly every other week: the war stories, the method, and the receipts. No spam, unsubscribe in one click.

Prefer a reader? RSS.