BIOS
The boot sector loads 256 kernel sectors in two 128-sector INT 13h reads (SeaBIOS refuses more per call), or via CHS when the boot drive is a floppy. Stage 2 makes the last BIOS call, collects E820, enables A20, loads the GDT and jumps.
Architecture
The kernel is agentos32.S, about 16.8k lines of GNU assembler (AT&T syntax, no compiler, no libc, no BIOS calls after boot). Agents, drivers, the desktop and the apps are freestanding C in ring 3, behind a single DPL-3 interrupt gate. Everything on this page is taken from docs/ARCHITECTURE.md.
All paths end in the same 32-bit kernel at physical 0x7E00. BIOS: Stage 1 in the boot sector loads 256 kernel sectors with two 128-sector LBA reads, Stage 2 sets video mode 3 (the last BIOS call), collects the E820 map, enables A20 and jumps to protected mode. UEFI: BOOTX64.EFI is a hand-laid PE32+ written in assembler; it loads kernel32.bin from the ESP, enumerates GOP modes, calls ExitBootServices and descends from long mode to protected mode. PXE: a 512-byte stub plus the flat kernel, downloaded by the NIC's option ROM – no disk needed.
The hybrid image is both: sector 0 is a BIOS boot sector and an MBR with one type-EF partition, so one USB stick boots both worlds.
GDT/IDT, paging with an unmapped page 0 (NULL protection) and fault isolation – #PF, #GP and #UD kill one agent, never the box – preemptive round-robin multitasking, opt-in SMP (INIT-SIPI, per-core scheduler, spinlocks around the task tables), one syscall gate, a kernel heap, a dmesg ring, E820/SMBIOS/cpuid, CPU and RAM self-tests and a watchdog for runaway agents.
In-kernel drivers: VGA text and VBE/GOP framebuffer with its own font, PS/2 keyboard and mouse, EHCI USB HID, 16550 serial, PIT/RTC, ATA PIO, AHCI/SATA + ATAPI, RTL8139, RTL8168, e1000, virtio-net, AC97 and the PC speaker. Size budget: the kernel content must stay under 131072 bytes.
Ring 3 reaches the kernel through exactly one interrupt gate. EAX carries the syscall number, EBX/ECX the arguments, the result comes back in the saved EAX slot. Every pointer argument is validated by sc_chkbuf against the ring-3 window. The gate is an interrupt gate (interrupts off inside) and executes cld first, because an interrupt gate does not clear the direction flag.
Agents never write tables or the screen directly – syscalls only. hlt, cli, in and out from ring 3 are a #GP and cost the agent its life.
Eight agent slots. Typed workers – math, scan, count, prime, gcd and the LLM agent ask – claim tasks from a queue, report progress (which doubles as the watchdog heartbeat) and finish. Results are pushed over UDP and persisted across reboots. The agent workers are linked into the kernel image but execute in ring 3 with their own user and kernel stacks.
A hidden type, fault, executes ud2 in ring 3 so the test gate can prove #UD isolation. task scan b8000 – an agent touching VGA RAM – dies; the OS keeps running.
Loaded by run at 0x400000, with its own tiny libc and syscall stubs. A TCP/IP stack (ARP, IPv4, ICMP, DHCP, DNS, TCP, HTTP client) and an HTTP server; a shared FAT16/FAT32 read+write layer; drivers for NVMe, xHCI USB mass storage, virtio-blk, virtio-gpu and Intel HDA – in ring 3, because sys_pci and sys_mmio_map let a program drive a PCI device.
On top: the Dark Glass desktop compositor, fetch, forest, the full-screen apps (tour, chat, editor, monitor, browser, file manager, recorder, synthesizer, voice wish, screenshots, Chromecast, rain) and the games. Two syscalls carry the apps: SYS_FGRAB (own keyboard and framebuffer) and SYS_SHELL (type a line into the shell).
The OS speaks plain HTTP over its own ring-3 TCP stack to llm-proxy.py on the host (127.0.0.1:4080 by default). The proxy holds the backend registry – @api, @openai, @ollama, a local Claude CLI backend – and the extra doors: /script for llmscript, /fetch for the browser (SSRF-guarded), /cast, /shot, /stt for the voice wish. TLS stays on the host; there is none in the OS.
The wish loop lives here too: make wish-loop watches the wish slots, stops the VM, runs a Claude Code session on a wish/<slug> branch, runs the gate and reboots the live image when it is green.
Boot paths
The boot sector loads 256 kernel sectors in two 128-sector INT 13h reads (SeaBIOS refuses more per call), or via CHS when the boot drive is a floppy. Stage 2 makes the last BIOS call, collects E820, enables A20, loads the GDT and jumps.
Runs in long mode, reads kernel32.bin from the ESP, enumerates GOP modes, calls ExitBootServices and descends to protected mode with its own GDT. It leaves a boot-info block at 0x28000; the kernel renders the console into the GOP framebuffer with its own 8×16 font.
The NIC's option ROM downloads pxe.img to 0x7C00; the kernel lands at 0x7E00 exactly where the disk loader would have put it. No disk: AgentFS slots become RAM-backed, so the loop runs on a diskless machine without ever writing someone else's disk.
Memory map
Physical equals virtual for the first 32 MB. A selection of the map; the full table with every DMA ring and stack lives in the architecture doc. Hardcoded addresses are named .equ constants in the kernel.
0x00000–0x00FFFpage 0: unmapped – NULL protection. IVT and BDA are dead after boot.0x07C00Stage 1 (boot sector + MBR partition table)0x07E00–0x27DFFthe kernel, 256 sectors – readable from ring 3, not writable0x28000UEFI boot info (framebuffer base, resolution, GOP mode list)0x2F000IDT, 256 gates built at runtime0x30000–0x38FFFpage directory and 8 page tables0x41000–0x48FFFkernel stacks of the agent threads, TID 1–8, 4 KB each0x50000–0x8FFFFkernel heap (kmalloc/kfree, supervisor-only; relocates to 64 MB on machines with ≥ 96 MB)0xB8000VGA text RAM, supervisor-only – task scan b8000 kills the agent0x102000dmesg ring0x141000+user stacks of the agent threads0x400000the ring-3 C program (user.bin, loaded by run)disk LBA 256medium marker AGENTOS-MEDIUM – without it diskon arms RAM-backed slots, a foreign disk is never writtendisk LBA 257–264AgentFS, 8 slots × 512 B (ring 3 writes them only via SYS_WRITE_SLOT)disk LBA 265–272the wish slotsThe syscall table
INT 0x30, EAX = number. The user-space stubs are in user/libc.h.
Notable doors: 15 write_slot writes AgentFS slots only and is diskon-gated – this is how llmscript persists model-written scripts. 16 pci_cfg and 17 mmio_map (an uncached 4 MB user page, refused for anything inside mapped system RAM) are why drivers can live in ring-3 C. 26 shell types a line into the shell – the guided tour runs spawn prime for real this way.
Iron rules
make test-all green before every commit. No exceptions.TannX, the prompt tannx>, the status names and a few messages. They change only together with the test.Trust model
TannX OS is a lab OS. It assumes a trusted LAN and treats its ring-3 userspace as trusted. The MMU still protects the kernel – NULL guard, fault isolation, sc_chkbuf on every pointer syscall, sys_mmio_map refuses pages inside system RAM – but a ring-3 program with a DMA engine can defeat that by design, because that is what lets drivers live in C.
The remote-control channel on UDP 4713 is compiled out of the default build and exists only with make REMOTE_CTL=1. The host proxy binds to localhost. There is no TLS in the OS and none is planned.
Lessons paid for
The first boot on the real test PC rebooted on spawn math. A real CPU NULLs any data segment register that still holds a DPL-0 selector on a return to ring 3 – a privilege-leak guard QEMU does not implement. The kernel now loads the target ring's data segments before the iret. The gap between emulator and silicon is widest exactly at privilege transitions, DMA and firmware handover.
The test PC's chipset exposes SATA only through AHCI. The driver was developed against QEMU's ICH9 AHCI and then brought up on the real machine without a screen or keyboard: it reported its own registers over UDP, found an ATAPI DVD drive on port 4, and read the model string and "no media" from a real SCSI round-trip. A driver that reports its registers over the wire can be brought up on hardware you cannot see.
The EHCI keyboard driver saw every key, yet nothing echoed: the periodic USB poll, called from the idle loop, clobbered EDI – the shell's line-buffer pointer. One pushal/popal pair fixed it. Rule carried forward: a routine called from the idle loop must preserve every register.
On a diskless, PXE-booted box diskon refused, because the only disk was a foreign Linux install – so the whole agent-language loop could not run on the actual hardware. The fix keeps the promise: diskon now arms RAM-backed slots instead of refusing. Writes are volatile, the foreign disk is never touched, and a real model wrote a script into RAM slot 7 that the OS executed.
A disk-layout move had left three host-side scripts on the old sector numbers: make wishes read mid-kernel bytes instead of the wish slots, the live boot ran a half-refreshed kernel, and the live image had no medium marker. Every QEMU suite stayed green, because they use fresh images and the OS-internal paths agreed with themselves. A layout move must grep the host scripts too.