nos_
ENRU
Вся документация

С чего начать

Возможности

docs/features.mdОткрыть на GitHub

Эта страница пока есть только на английском: документация собирается прямо из каталога docs/ репозитория и поэтому всегда совпадает с кодом. На русском у нас есть руководства.

Everything the kernel does today, by subsystem. For where the code lives see Project layout; for the interactive shell see Shell commands.

  • virtio, entirely in Rust — the split virtqueue, the transport contract and both buses (virtio-pci modern and legacy, virtio-mmio v2) are src/crates/drivers/virtio, and every device on them — blk, net, scsi, rng — is a Rust driver in src/crates/drivers/. No virtio code is left in C++
  • Two architectures — x86-64 (Multiboot2/GRUB, ISO or MBR disk boot, legacy BIOS and UEFI firmware) and arm64 (QEMU virt board, Linux Image boot protocol); portable code goes through a HAL layer (src/base/hal/), arch backends live in src/base/arch/
  • SMP — up to 64 CPUs (20 exercised on real hardware); AP bootstrap via INIT/SIPI on x86-64, PSCI CPU_ON on arm64, APs started one at a time, maxcpus=N to cap them
  • Preemptive multitasking — per-CPU task queues, EEVDF scheduling (a weight from each task's nice, a slice of its own, lag kept across sleeps and moves, a slice's end on the one-shot local timer), load-balanced task placement
  • Virtual memory — 4-level paging (4 KB pages), high-half kernel at 0xFFFF800001000000, TLB shootdown across CPUs via IPI
  • Page allocator — fixed-size block allocator (1–128 contiguous pages, plus separate large-DMA pools of 1–16 MiB), pool allocator (32 B – 2 KB), new/delete support; every page handed out zeroed, and free pages zeroed ahead by two tasks of the lowest priority while CPUs are idle -- a guest's memory taken from those first, and what a guest left in RAM gone within seconds of its end (zerofree=, Paging); on a machine of several NUMA nodes every free page on its own node's lists, an allocation from its CPU's node first and the nearest after, a zeroing task a node on that node's CPUs, the huge pool shared out by node, a task moved off its node only for a larger difference than within it, and a guest's memory on its CPUs' node -- numa, and numabench to measure it (NUMA)
  • ACPI — RSDP, RSDT/XSDT, MADT, FADT, HPET, WDAT, SRAT and SLIT parsing: LAPIC/IOAPIC discovery, IRQ→GSI routing, the reset register, the century register, the HPET's base, a firmware-owned watchdog, the NUMA nodes and their distances
  • Interrupts — IDT with exception handlers, IOAPIC routing (edge + level-triggered), LAPIC IPI, PIC (remapped then disabled), round-robin IRQ balancing across CPUs once SMP is up (IOAPIC lines only over the apic ids a physical-mode redirection entry can name, MSI-X over all of them)
  • Split locks — x86-64: a locked access across two cache lines, detected where the CPU can (Intel's parts since Ice Lake's servers and Tremont; the EX44's and Hertz's here): the kernel's own a panic that names it, a guest's said in the log -- one line a VM every five seconds at most -- and stepped past with the detection off for that one instruction, by the monitor trap flag; panic splitlock makes one, splitlock=off leaves the detection off
  • arm64 port — GICv3 interrupt controller with ITS (PCIe MSI delivered as LPIs, its=on by default), EL1 exception vectors, ARM generic timer (per-CPU), PL011 UART, FDT (device tree) parsing, PCIe ECAM, virtio-mmio transport, broadcast TLBI, semantic memory barriers (dmb) throughout; NVMe over ITS-delivered MSI works end-to-end
  • Drivers — serial (COM1), screen console (EGA text on BIOS, 8x16 font on the bootloader's pixel framebuffer under UEFI), PIT (10 ms tick, SeqLock-protected counters), RTC (CMOS wall clock), PS/2 keyboard (8042), USB HID keyboard over xHCI (BIOS/UEFI handoff, root-port and hub enumeration, boot-protocol reports), PCI bus scan, LAPIC, IOAPIC, virtio-blk, virtio-net, virtio-scsi, virtio-rng (Rust, on the Rust virtio foundation: legacy + modern virtio-pci, and virtio-mmio), NVMe (Rust, MSI-X interrupt-driven), ATA (Rust: SATA in IDE mode and parallel ATA behind a PCI IDE controller, native or compatibility mode, master and slave, LBA48; PIO, polled; both SATA drivers give a disk up after three commands running that did not finish -- refused at once from then on -- and put every disk in standby at power-off), AHCI (Rust: SATA behind an AHCI HBA, the firmware's handoff and the HBA's reset, by DMA up to 256 KiB a command, a batch's run of contiguous blocks one command, LBA48; NCQ -- up to 31 commands out at once a disk, FUA -- or a command at a time where the disk or the HBA has none; the block layer's asynchronous path; ended by the HBA's MSI, polled where it has none or it never comes; a task of its own for failures: the disk's NCQ error log names the command that failed and the others go again, an interrupt that never came is said and taken), Realtek RTL8168/RTL8125, Intel 82576/I210/I350 (igb), Intel 82574L (e1000e) and Mellanox ConnectX-3/3 Pro Ethernet (mlx4, one RX/TX queue per port, polled; no InfiniBand/RDMA) NICs (Rust)
  • Block I/O — asynchronous, interrupt-driven block request queue with DMA slot pool, BlockRequest submission with WaitGroup completion, direct DMA from caller buffers (page-aligned), virtqueue locking (RawSpinLock) for safe interrupt/task concurrency, early-boot polling fallback, SoftIrq-based retry for ring-full conditions, the block layer in Rust (src/crates/layers/block): the device table a driver registers an ops table with — from C++ or from Rust alike — the claims that keep a mount, the disk log and a writer off each other's sectors, and the partition tables (MBR and GPT) each partition is registered from
  • Networking — virtio-net driver with asynchronous interrupt-driven TX/RX, software frame queues (256-entry TX/RX) in NetDevice base class, reference-counted NetFrame descriptors for zero-copy DMA, TX slot pool with bitmask allocation, SoftIrq-based TX retry and RX processing, IP routing (connected networks and additional routes, longest prefix first, and an explicitly chosen default interface), ARP (cache, request, reply, dump), IPv4/UDP transmit, ICMP echo (ping reply + send, per-type statistics), a DHCP client on each configured interface that keeps its lease as RFC 2131 has one kept (sets IP, subnet mask, gateway, DNS server; renews from T1, rebinds from T2, and lets the address go when the lease runs out or a server refuses it; ignores offers of addresses no host may have), per-interface settings -- a static address and gateway, or DHCP, on every NIC, an explicit default route and additional routes -- from /etc/net.toml on the root, which nos-install writes (The network), or the command line's ip=, gw=, dns= and dhcp= for eth0 on a boot with none, NAT (what is behind a virtual NIC -- the hypervisor's guests -- masqueraded out through the device the default route is on: TCP from its SYN, UDP and ICMP echo, ICMP errors translated back, address- and port-dependent filtering, 4096 mappings taken whole when it goes on, RFC 4787/5382 timeouts, checksums updated incrementally, nat command), DNS resolver with 32-entry cache (A-record queries, name compression, DHCP-provided server), TCP (connection state machine, 3-way handshake, sequence/ack tracking, congestion control as RFC 5681 has it -- slow start from ten segments (RFC 6928), congestion avoidance --, selective acknowledgements both ways (SACK, RFC 2018, and D-SACK, RFC 2883) with a peer that takes them, and with them loss found by time as RACK-TLP has it (RFC 8985: a reordering window that D-SACKs widen, a loss probe two round trips into a silence), every hole of a window sent again in the round trip it is found in with PRR pacing the recovery (RFC 6937), a recovery or a timeout that turns out to have been for nothing taken back (RFC 3708, F-RTO's SACK-enhanced test, RFC 5682), a timeout sending again only what the peer does not hold, and a peer that reneges found out (RFC 2018 8); with a peer that does not, fast retransmit on the third duplicate ACK and NewReno's recovery (RFC 6582) and a timeout sending everything outstanding again as the acknowledgements come back --, a send waiting for room woken by the acknowledgement that makes it, MSS negotiation, send/receive ring buffers, window scaling (RFC 7323) on a bulk connection -- the HTTP client's, and those a bulk listener accepts (hv forward's): buffers of up to 512 KiB from the heap, a window never offered past the buffer -- one that falls back by less than its unit when the edge would not otherwise fit, RFC 7323 2.4's retracted window, the old edge still honoured -- and segments past a hole kept until it fills --, silly window avoidance at both ends (RFC 1122 4.2.3.3 and 4.2.3.4), a reset, a SYN or an acknowledgement a blind attacker could guess answered with an ACK rather than obeyed (RFC 5961), graceful close with FIN exchange, RST handling, ephemeral port allocation, a retransmission timeout from the measured round trip (RFC 6298, Karn's rule) no less than 200 ms, a connection given up after 100 s with nothing acknowledged (RFC 1122), a listener's allowlist of up to 64 networks dropping a stranger's segments before its backlog and a slot, a half-open connection given up after 3 s, resets to segments for no connection held to 200 a second over the stack, granular locking: Mutex for ports, RawSpinLock for pool and per-connection state, a timer task asleep until the earliest retransmission any connection has or the next 200 ms sweep), HTTP client (URL parsing, DNS resolution, TCP connection, request/response, chunked transfer decoding, redirect following for 301/302/303/307/308 with loop limit including http→https, URLs up to 2 KiB (a GitHub release download redirects to a ~900-character signed link) that are refused rather than truncated when longer, a streaming body sink so a download of any size -- a VM's disk image of gigabytes -- costs one 16 KiB buffer rather than its size in heap, an idle receive timeout, wget shell command), HTTPS (TLS 1.3/1.2 through rustls in no_std with the RustCrypto provider -- its ChaCha20-Poly1305 suites, the ones the kernel asks for first, on CRYPTOGAMS' x86-64 AVX2/SSSE3 and arm64 NEON assembly in the kernel's SIMD sections (The assembly) -- certificate chains verified against the compiled-in Mozilla root store and the RTC, entropy from the kernel's ChaCha20 pool, a session running over the tls::Transport trait that the HTTP client implements on its own TCP connection), UDP remote shell (execute kernel commands over the network), network device abstraction with per-protocol packet counters, MacAddress/IpAddress structs (IPv6-ready tagged union)
  • Filesystem — VFS with mount points, path resolution and a file API (open/read/write/seek, append, truncate, rename, stat, readdir; open files pin their vnode), one filesystem call at a time; ext2 read-write (rev 1, 1–4 KiB blocks, direct, single-, double- and triple-indirect blocks, sparse files, files past 4 GiB (large_file, as big as Linux's ext2 makes them: 16 GiB at 1 KiB blocks, 256 GiB at 2 KiB, almost 2 TiB at 4 KiB), lazy directory loading, e2fsck-clean write ordering, valid state kept like Linux; refuses ext3/ext4 features, mounts gdt_csum images read-only); ext4 (ext4 and ext3 read through extfmt: extents, 64bit, flex_bg, uninitialised groups, every metadata_csum checksum held to on every read, htree directories read as linear, unwritten extents as zeros; written through its JBD2 journal -- names and data, one transaction a call or a few hundred blocks of a write, data on the device before the commit that maps it (data=ordered), unwritten extents made written, truncate and punch, an htree directory's index dropped when written into, the journal replayed by a mount for writing and aborted at a failed write of anything but a file's data; a remove, a cut or a punch of any size given back in bounded transactions, the first two through the orphan list, which a mount for writing releases -- its own crash's or another kernel's -- and a punch given back on a full disk; a superblock a power cut tore made sound from the journal; a journal nobody replayed read through -- extfmt's recovery planner, held to e2fsck's replay byte for byte -- with nothing written); the driver for each filesystem chosen by its superblock; an ext4 or ext2 made on a disk or a partition from the shell (format) -- laid out by extfmt::mkfs, written a batch of pages at a time, the old superblock's place zeroed first and the new superblock written last, so that one cut short leaves no superblock over half a filesystem, and refused over a device in use or, without force, one that holds anything; a root filesystem on disk chosen by root=auto|<dev>|LABEL=|UUID= -- an ext4 for new installs, made by nos-install, scripts/mkrootfs.sh and scripts/build-disk.sh (no root privileges) of the features named one by one from none, GRUB 2.06's to read, or the ext2 an install before ext4 made -- and a self-test (fstest) run at boot by the smoke tests; ramfs (in-memory), procfs
  • File logs — what a part of the kernel keeps for a person to read later, in files of its own under /logs rather than in the kernel log: /logs/net.log holds TCP's connections and sshd's sessions, /logs/hv.log what became of each VM -- made, cloned, deleted, started, stopped and why, moved, a start that failed -- and /logs/nbs.log NBS's metadata's history on every host -- volumes made, attached, snapshotted and deleted, a replica taken out and by whom, a cs down or up, a join -- and what its cs's and clients met. A line that can come as often as a failure does goes through its place's limiter (flog_limited!): a few lines a minute, each kind of line its own few, and the count of the rest said by the next line that goes. A line is formatted where it is written and put on a lockless queue -- from anywhere, a soft IRQ or an interrupt handler included, never waiting -- and a task of its own appends each log's lines to its file a burst at a time, stamped with the wall clock to the microsecond; each log held to a size for its file and one for all its files, moved along to <name>.log.1, .2, ... with the oldest going, a file held open by a reader left to grow to twice its limit rather than moved; a log that cannot be written says so once and sends its lines to the kernel log until it can; lines lost to a full queue counted and said in the file. Written from the image (fs::logs::Log) and from modules (kcore::logs::Log) alike, read with tail, cat and logs
  • Randomness — a ChaCha20 CSPRNG (src/crates/base/random: fast key erasure for output, absorb for seeding, RFC 8439 block function checked at boot against the RFC's vector) seeded from every entropy source the machine has: the CPU's own instruction behind a HAL seam (RDSEED/RDRAND on x86-64, RNDR/RNDRRS on arm64, with a self-test that refuses an instruction answering the same value every time), virtio-rng, and a timing-jitter collector with von Neumann debiasing as the last resort on a machine with neither. a source implements random::Source and registers with the pool, which reseeds from all of them; random and entropy shell commands, hwrng=off to exercise the fallback
  • Power management — ACPI S5 shutdown, keyboard controller reset/reboot
  • Interactive shell — trace output suppressed during shell session (dmesg only), restored on shutdown; a line editor with the last 32 lines on Up and Down and bash's ^R search through them, on the console -- either keyboard or the serial port -- and over SSH; commands: ps, top, profile, stacks, cpu, lscpu, bt <pid>, dmesg [lines] [filter], loglevel [N], uptime, date, memusage, memsites, meminfo, memcheck, pci, disks, diskread, diskwrite, irqstat, net, arp, netpool, icmpstat, tcpstat, udpsend, ping, nslookup, dnsflush, dhcp, wget, random, entropy, format, mount, umount, mounts, df, ls, cat, tail, logs, cp, write, append, mkdir, touch, rm, mv, stat, sync, fstest, crc32, sha256, grubenv, panic, version, cls, help, poweroff, reboot — see Shell commands
  • Timekeeping — TSC calibration via PIT channel 2 (multi-round median), KVM paravirt clock (kvmclock) for accurate VM time, RTC wall clock, layered clock source selection (kvmclock → calibrated TSC → PIT fallback), get_boot_time() / get_wall_time_secs() API
  • All of the machine's RAM, up to 512 GiB — the bootstrap linear map covers the first 4 GiB at 2 MiB granularity, then one 1 GiB block per GiB of RAM above it (x86-64: needs CPUID PDPE1GB, which everything since Nehalem/Barcelona has; arm64: an L1 block, always available at a 4 KiB granule). 512 GiB is where one PDPT/L1 table runs out. Blocks with no usable RAM in them are left unmapped. Where the hardware cannot do it the kernel falls back to 4 GiB and says so; meminfo and two mm: lines at boot always report RAM reported vs. RAM reachable, so the difference is never silent. The page-descriptor array that comes with all that RAM (one 32-byte Page per 4 KiB frame, so 512 MiB on a 64 GiB box) gets a contiguous carve-out of its own and is mapped with 2 MiB pages, since every free-list walk touches it at random. Cost: building the free list still touches every page twice, about 0.6 µs in total each, so a 64 GiB machine spends around ten seconds of its boot there.
  • Per-CPU tick — each CPU runs its own timer (x86-64: the local APIC timer, calibrated once against the established clock; arm64: the generic timer), rather than one HPET interrupt on one CPU fanned out to every other by IPI. One-shot: armed for the next tick, or sooner for a task asleep until a deadline, so a sleep of a millisecond takes one and not the tick's ten (the local timer). That removes a write to the interrupt command register per CPU per tick, and removes the single point of failure: a CPU that stops answering interrupts now stops only its own tick, while the others keep ticking and the watchdog notices it. The HPET stays as the timekeeper.
  • Kernel infrastructure — spinlocks, mutexes, SeqLock (single-writer/multi-reader), atomics, wait groups, SoftIrq deferred processing, IPI tasks, timers, watchdog, stack traces with symbol resolution, dmesg ring buffer (512 KB, 1024 messages, recycled lines counted and reported), panic handler with backtrace and CPU/task context, per-device interrupt statistics, AP startup diagnostics, virtual-to-physical address translation (4-level page table walk), byte-order helpers (cpu_to_be16/cpu_to_be32/be16_to_cpu/be32_to_cpu)
  • Optimized stdlib — mem_set, mem_cpy, mem_cmp, str_len, str_cmp, str_str implemented in x86-64 assembly using rep stosq/rep movsq/repe cmpsb/repne scasb (portable C versions on arm64)
  • Rust support — #![no_std] Rust crates linked into the kernel via staticlib, FFI bridge (rust_ffi.cpp) exposing kernel services to Rust: spinlocks, mutexes, wait groups, timers, SoftIRQ, MSI-X interrupts, legacy interrupts, DMA allocation, MMIO mapping, PCI config space, block device and network device registration, CPU/IPI/task APIs. kcore library provides safe Rust wrappers around kernel primitives. NVMe driver written entirely in Rust — PCI BAR mapping, admin + I/O queue pairs, MSI-X interrupt-driven completion, WaitGroup-based synchronous I/O, multi-device support, proper RAII cleanup on shutdown
  • Loadable kernel modules — kernel services written in Rust, each a crate built into a position-independent ELF .ko and loaded into the running kernel with insmod (listed with lsmod, removed with rmmod), on both architectures, its init handed the parameters given after the path. The loader maps each segment into pages of its own, binds the module's imports by name against an export table generated from the ffi crate's declarations, applies its dynamic relocations, gives every segment the permissions its program header asks for (never writable and executable at once), and refuses a module built against another kernel interface. A module can add shell commands; insmod and rmmod each run in a task of their own, so an unload waiting out a module command still running holds up neither the shell nor lsmod. Images up to 16 MiB. Backtraces — the panic report, bt, the profiler — name a module's functions, from a demangled table the build puts in the .ko. blkload, a module in the tree, load-tests a disk or a partition from the shell: IOPS, bandwidth, latency percentiles; netload load-tests the network from either end -- a UDP target that echoes from the receive softirq, a batch of replies to the NIC at a time, and a source that sends to an address and port as fast as the NIC takes them or at a rate, counts what comes back, and leaves room in the transmit queue so that the shell goes on answering under it. Tagged releases carry every module, built for both architectures, for wget from a running kernel. The boot self-test loads, exercises and unloads a module embedded in the kernel image
  • netblk — a module that serves an NVMe disk, or a partition of one, as a block device over UDP, zero-copy both ways: the disk DMAs a read straight into the frame the NIC transmits, and a write straight out of the frame the NIC received, which then goes back as the reply. Requests pass from the receive softirq to a pinned worker and back from the disk's interrupt through the kernel's lockless rings; the worker rings the disk's doorbell and the NIC's once a batch, polls while completions are due and blocks on an event otherwise. It stands on a UDP listener that is handed the frame itself, batched transmit, virtio-net receiving into pool frames, and an asynchronous block path (kcore::block::Disk::submit) the NVMe driver implements. scripts/netblk.py is its client, tests/netblk-test.py its end-to-end test on both architectures
  • sshd — an SSH server in a module: an OpenSSH client logs in with an Ed25519 key and gets the kernel's shell, with a line editor and history on a terminal, or runs one command (ssh host dmesg) -- or copies files in and out with sftp and scp: an SFTP server (version 3, as OpenSSH speaks it, with its limits, statvfs, fsync and expand-path extensions) in a crate of its own (src/crates/common/net/sftp), over the kernel's files at exactly the path named, what nos does not keep -- owners, permissions, times, links -- refused rather than dropped. curve25519-sha256 with OpenSSH's strict key exchange, ssh-ed25519 host and user keys, chacha20-poly1305@openssh.com, client-started rekeying followed even mid-output, flow control both ways; the protocol lives in a crate of its own (src/crates/common/net/ssh) over the vendored RustCrypto and dalek crates, the module supplies TCP, the files and the shell. The host key is made on the first start and kept in OpenSSH's own format, the authorized keys in an OpenSSH authorized_keys; 8 connections, at most 4 of them logging in, a 30-second login grace, keepalives. /etc/rc -- shell commands the shell runs once at boot, edited with rc -- loads and starts it on a machine whose only console is the network. It was the first user of the TCP stack's passive side, which gained an Accept that times out and notices its listener closed, and resets for connections a closed listener never accepted
  • edit — a text editor in a module, for an SSH session with a terminal: edit /etc/rc. A Mac's keys on Control -- ^S save, ^Q quit, ^F find, ^G go to a line, ^Z/^Y undo and redo, ^X/^C/^V the selection or the line, Shift with a move to select, ^A/^E, Option's words -- and nothing that needs a key a Mac keyboard lacks; pastes bracketed, so a paste is text and never a key. A file comes back out as it went in, byte for byte -- CR LF, invalid UTF-8, no newline at the end -- and what is not text is shown for what it is. A save writes the whole new content before it takes the old one's place, a file changed on disk meanwhile is asked about, and changes left when the connection goes are kept in <file>.save. The session tells it the terminal's size and every resize -- the pty-req and the window-changes, carried to the command it runs -- and it sends a frame's changed rows only. The editor is a crate with no kernel in it and no unsafe (src/crates/common/text/edit), held on the host to key sessions, files saved back byte for byte and random sessions on a terminal of the test's own (tests/edit-test.py)
  • The hypervisor — stage 3, as Rust crates and a module that can be taken back out: hvarch is the CPU's virtualization extension and almost all of the hypervisor's unsafe (128 sites), hv is everything above it and has four, and neither is compiled into a kernel that does not load the module. Under AMD-V and Intel VT-x it runs guests: guest memory behind a nested page table that maps nothing but pages the memory owns, accessed by copies only -- but for its devices' rings, mapped while a queue is up and still reached a value at a time; a VMCB whose host-critical intercepts and controls the entry sets every time whatever the policy above wrote; vmsave/vmload of the host's segment state around vmrun, with GIF clear throughout; the exits decoded; and a software check of the VMCB that names the rule vmrun would refuse it for. Six built-in long-mode guests (hv run) show port I/O and CPUID, memory above 4 GiB and every register across a hypercall, a write past its memory stopped at the nested table, a triple fault, a refused VMCB, and cli; jmp $ stopped by the host. Today it finds what the machine has and reports it a feature a line -- AMD-V or Intel VT-x, nested paging, next-RIP save, ASIDs, x2APIC, 1 GiB pages; on arm64, the exception level and what stage-2 would offer -- and turns the extension on and off for named CPUs or all of them, allocating each CPU's host-save-area or VMXON region before the IPI that hands it over and freeing it only after that CPU says it is done. hv reports which CPUs have it on by asking the CPUs, not its own table, so an rmmod that left one on is visible on the next insmod: tests/hv-test.py is that round trip. AMD-V is the backend written first because QEMU's TCG emulates it, nested paging included, and emulates no VMX at all; Intel VT-x is a full second backend now -- a VMCS synced from the same AMD-shaped guest-state shadow, EPT, a vmlaunch stub and the exits decoded -- brought up and gated under nested KVM, with every built-in guest running under it too. It boots Linux: hv boot loads an unmodified 64-bit bzImage and initramfs by the boot protocol, with a CPU cut down to what is emulated (CPUID and MSR policy), an 8250, an 8254 PIT, an RTC and a pair of 8259 PICs, and a vCPU that sleeps while its guest halts -- a tinyconfig Linux 6.18 reaches a BusyBox shell and runs what is typed at it, under TCG and on the AX41's real AMD-V; hv start leaves such a guest running on a vCPU task of its own, reached from the shell with hv list, console, send, exec, wait, restart and stop, or live and typed at over ssh with hv attach (Guests that stay up), and kept in a folder of its own under /vms, or the folder insmod /hv.ko vms= names -- a vm.toml there saying what to boot it with, its disks beside it, its console written to console.log -- booted by its name with hv start <name>, made with hv create and listed with hv vms (A VM in a folder); and gives it disks, virtio over legacy PCI on files of nos's, served while the guest runs on by a task of the disk's own, which a guest mounts ext4 from (A disk) -- or on a partition or a whole disk of nos's, the filesystem out of the way, named in its vm.toml by the partition's GUID or the disk's serial so that the next boot finds the same device whatever its name, never an EFI System partition or a device in use and only with force one with something on it, held by its VM while it runs, and poured from a cloud's image by hv convert and hv create ... onto= (A device as a guest's disk) -- and a NIC on a switch with the other guests and nos, whose end of it is a virtual NIC in its own stack (hv0) -- a guest's server reached from outside through hv forward, each guest's NIC judged both ways by a firewall of the host's -- closed to what comes in until a rule opens it, flows remembered, hv fw and the panel's page of them (The firewall) -- and the world reached from a guest through NAT, the switch answering its DHCP with its port's address and nos's DNS server, and the NIC's checksums and TCP's sends of up to 64 KiB offloaded both ways, a send carried whole from one guest to another (A network). A distribution boots as it ships: Alpine's virt ISO, its own kernel and initramfs, the ISO a read-only disk, to a login prompt, rebooting and on the switch, its own sshd installed from the ISO and logged into from outside; and Debian 13's cloud image under systemd, provisioned by credentials on its command line, its root the guest's writable disk and kept across a reboot (A distribution). And a guest boots the kernel its own disk's GRUB would: hv start /lib/hvboot starts hvboot, a loader of nos's that runs in the guest, by PVH -- an ELF entered at its 32-bit entry with a start info hv lays out -- and it reads the guest's GPT or MBR, its ext2/3/4 /boot and its grub.cfg and grubenv, and boots that entry's kernel and initrd: Ubuntu 24.04's and Debian 13's cloud images as they ship, nothing taken out of them, their kernel updates their own (A guest's own kernel). A cloud's image is made the guest's disk on nos itself: hv convert reads QEMU's qcow2 -- Ubuntu's .img as it is downloaded, its compressed clusters inflated by a DEFLATE decoder whose every answer is zlib's -- and writes the raw disk with its holes kept, Ubuntu's 3.5 GiB disk costing the 1.7 GiB it holds, refusing what it cannot convert by what it is (A disk from a cloud's image); and hv create <name> <url> makes a VM of one by its URL alone -- the image fetched by the kernel's own HTTPS client, made its disk and grown, cloud-init's NoCloud seed written beside it (an ISO 9660 labelled cidata, the keys nos's sshd lets in and a password), and a vm.toml booting it by hvboot (A VM of a cloud's image); hv clone copies a stopped VM's folder with its disks' holes left out and gives the copy an identity and a seed of its own, hv delete takes one away, and what hv changes in a vm.toml it changes key by key, the operator's lines kept (Cloned, deleted, changed) -- and the vm provider puts all of it on the management bus, its long operations jobs that say how far they have got and stop when cancelled, a VM's console a channel of the host API's stream (On the management bus). A Linux guest has as many CPUs as cpus= gives it, up to 16, each a task on a host CPU of its own with an emulated x2APIC -- its timer, IPIs, and INIT and the start-up IPI into real mode -- found by the guest through an MP table, its disks and NICs interrupting it by MSI-X through its local APICs -- the vector table a page of its own memory, so no MMIO is decoded -- and gated under AMD-V and Intel VT-x (More than one CPU). Every Linux guest is given ACPI's tables -- an XSDT, a FADT, a MADT, and a DSDT in AML with S5 and the PCI host bridge its kernel finds its disks and NICs through -- and the fixed hardware they describe on ports, the PM timer, the SCI on IRQ 9, the reset register; hv stop presses the guest's power button and gives it time to shut itself down, as a distribution does (ACPI). MMIO is emulated: the instruction that faulted on a device's page is fetched by the guest's own paging, decoded -- the forms of mov Linux's accessors are, checked against clang's encodings -- and performed, with no unsafe; its first device is the local APIC's xAPIC mode, which a guest told nox2apic or given xapic reaches through the page (MMIO), and its second an IO-APIC, which ioapic gives a guest of more than one CPU -- its timer, serial port, SCI and virtio INTx routed through it to any CPU, as edges and levels (The IO-APIC). Each CPU hands out ASIDs by generation, so an entry flushes the TLB only when they run out, not every time; hv bench measures what an exit costs (Address space identifiers).
  • Boot tests — allocator, ring buffer, stack trace, multitasking, contiguous page alloc (up to 128 pages, and a 2082-page DMA run rounded to 16 MiB), parsing helpers, block device table, memset, memcpy, memcmp, strlen, strcmp, strstr; the lockless ring with producers and consumers on several CPUs at once