indicogniBuild a VMM

Contents

Chapter 22 · Part IX

FreeBSD through U-Boot EFI

Needs a Mac ~6 h Optional chapter
23 of 26

Course progress: chapter 22 is 23 of the 26 chapters written so far (numbering starts at 00)

Warm-up: three questions from earlier chapters

Answer each one in your head or on paper before you open its answer. They change on each visit.

  1. From chapter 21: Firmware: a stricter guest (U-Boot, flash, ISV=0)

    U-Boot's word 0xa9010d22 faults with ISV = 0 and the exit reports IPA 0x12c678. Which accesses must the VMM perform, at which addresses, and which registers change afterwards?

    Show answer

    Bits 31:30 are 10 (8-byte elements), mode 10 (plain offset), L = 0 (store), imm7 = 2 (times 8 = 16), Rt2 = 3, Rn = 9, Rt = 2: stp x2, x3, [x9, #16]. Two 8-byte stores, x2 at the exit IPA 0x12c678 and x3 at 0x12c680 (exit IPA plus the element size). No register changes except the PC, which advances by 4: offset mode has no writeback. In flash, both stores are ignored.

  2. From chapter 19: virtio-net without a networking entitlement

    A guest posts a transmit chain of two readable descriptors, 12 bytes and 1600 bytes. What does our virtio-net do with it, and what goes in the used ring?

    Show answer

    It drops the frame and counts it in tx_dropped: the total, 1612 bytes, is over the 1526-byte cap (a 12-byte header plus a 1514-byte frame), so nothing is allocated or sent. The chain still goes back on the used ring, with length 0, as every transmit chain does; the device never stops or resets over one bad frame.

  3. From chapter 15: Rings and a doorbell: the virtio-mmio transport

    On our board, a driver reads the 32-bit word at 0x0a00_0608 and gets 0. Which register of which slot is that, what must the driver conclude, and should the device tree have a node at 0x0a000600?

    Show answer

    Slots start at 0x0a00_0000 and are 0x200 apart, so 0x0a00_0600 is slot 3 and offset 0x008 is DeviceID. 0 means "no device here": the specification says the driver MUST ignore it. There is no node, because only populated slots are listed; the empty slot still answers on the bus so that a guest which scans the fixed addresses gets a defined answer rather than an unhandled-MMIO fault.

Concepts you'll need

Chapters before this one: chapter 21, Firmware: a stricter guest (U-Boot, flash, ISV=0); chapter 20, SMP: many vCPUs, many threads.

  • Core, taught here: compatibility of a virtual machine monitor (VMM) measured guest by guest; reading a boot transcript link by link to find which program spoke last; deciding "our machine or the guest?" from primary sources, with QEMU virt as the reference machine; an offered feature bit as a promise a driver may refuse; recording findings in a compatibility log.
  • Core, from earlier: the firmware boot protocol, U-Boot and flash that ignores writes (chapter 21); one thread per virtual CPU (vCPU) and the power state coordination interface (PSCI) call CPU_ON (chapter 20); virtio-blk and the raw disk image (chapter 18); feature negotiation (chapter 15); the device tree blob (DTB) as the VMM's promise, compatible and the apb_pclk clock (chapter 10); the exit trace (chapter 03).
  • Primers (review): uefi (boot and runtime services, the configuration table, the default path \EFI\BOOT\BOOTAA64.EFI); u-boot (standard boot, bootefi); block-storage (raw images, partitions as guest business, Apple File System clones with cp -c); primecell-ids (how Linux and FreeBSD bind a PrimeCell, and the apb_pclk clock); linux-boot-sequence (the early console and how a node finds its driver); smccc (Arm's call convention for hypervisor calls, and its feature queries).
  • Pointers: the FreeBSD boot chain (loader.efi, loader(8)) and the Unix File System (UFS), an Aside; xz as a compression container, an Aside; EDK2 ArmVirtQemu as the second firmware, a Production note; pointer authentication, MTE and other CPU features FreeBSD probes, one sentence (no capture shows one matters).
  • Forward definitions: none.

One virtio-blk device, three drivers. U-Boot's virtio driver reads the FreeBSD image, and FreeBSD's loader reads its kernel through U-Boot. In a separate run, Linux's driver reads a whole disk image through the very same device code. Then FreeBSD's own kernel driver looks at the device and says this, and never gets further:

TerminalReal output
cargo run -q -p macvmm -- run --bios .cache/macvmm/u-boot.bin --disk .cache/f.raw --mem 2G --cpus 2 --timeout 60 --on-reset exitexit: 5--- stdout ---U-Boot 2026.04 (Apr 21 2026 - 09:17:42 +0000)FreeBSD/arm64 EFI loader, Revision 3.0FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC arm64virtio_mmio0: <VirtIO MMIO adapter> mem 0xa000000-0xa0001ff irq 6 on ofwbus0vtblk0: <VirtIO Block Adapter> on virtio_mmio0vtblk0: host requires unsupported maximum segment size featuredevice_attach: vtblk0 attach returned 45Trying to mount root from ufs:/dev/gpt/rootfs [rw,noatime]...mountroot: waiting for device /dev/gpt/rootfs...Mounting from ufs:/dev/gpt/rootfs failed with error 19.  vfs.root.mountfrom=ufs:/dev/gpt/rootfs  vfs.root.mountfrom.options=rw,noatime    eg. ufs:/dev/da0s1a          (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /)  <empty line>    Abort manual inputmountroot> random: unblocking device.--- stderr ---macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x40000000 at offset 0x12c668 (flash is read-only, write 1 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c670 (flash is read-only, write 2 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c678 (flash is read-only, write 3 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c680 (flash is read-only, write 4 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 4-byte write of 0x1 at offset 0xed4 (flash is read-only, write 5 to this bank)macvmm: timeout: the guest was still running after --timeout 60s
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • Deliberate breakage 2: virtio-blk offers VIRTIO_BLK_F_SIZE_MAX again (one added line, | blk_features::SIZE_MAX, in device_features in crates/vmm/src/virtio/blk.rs), so size_max = 64 KiB is a promise. Everything else is the reference.
  • .cache/f.raw is a fresh cp -c clone of .cache/macvmm/freebsd-15.1-ufs.raw; nothing was typed.
  • Escape sequences and carriage returns removed; stdout filtered with grep -E to the lines matching U-Boot 20|EFI loader|^FreeBSD 15|virtio_mmio|vtblk|attach|mount|Mounting|ufs:|<empty>|Abort|^\?.
course/captures/22-size-max-freebsd.txt

This is our VMM with one extra feature bit switched on, the way the reference shipped until the first time it booted FreeBSD. You will switch it on yourself in Deliberate breakage 2. Standard error holds no complaint from the VMM: chapter 21's five ignored flash writes, then the timeout we asked for. The device works for U-Boot's driver and for Linux's, not for FreeBSD's. Is our machine wrong, or is FreeBSD?

Chapter 18 told you how this story ends, in one sentence about the features it does not offer. Here you work out why, from primary sources, as if nobody had told you. The next guest's refusal will not come with a note.

Predict Before we chase that one, a smaller version of the same question. Remove apb_pclk from the PL011 node of our device tree and boot Linux, then FreeBSD. Which operating system complains first, and what does each print?

Write your guess and one sentence of reasoning under ## Predict in your journal. Deliberate breakage 1 runs both.

This chapter re-tests row 10 of chapter 00's problem ledger, a boot chain, with a second operating system: chapters 13 and 14 closed the row with our VMM as the bootloader, chapter 21 with U-Boot, and here FreeBSD walks the whole chain, firmware, Unified Extensible Firmware Interface (UEFI), its own loader, its kernel, on our virtio disk with two CPUs. Like chapter 21, this is an Open chapter: a brief, the tests that judge it, then the reference's path for comparison. About 6 hours in one or two sittings, most of it reading transcripts; the natural break is after the first login.

Objectives: by the end you can

  • Boot the pinned FreeBSD 15.1-RELEASE arm64 image, verified by its checksum and used only through Apple File System (APFS) clones, through U-Boot's EFI path to login: with --cpus 2, and name what each link of the chain did.
  • Diagnose a guest-specific failure by comparing what FreeBSD and Linux expect of our machine (the interrupt controller, the PL011's clocks, virtio-blk's features, the device tree against QEMU virt), using primary sources rather than which guest boots.
  • Predict, then observe, how each guest reacts to a missing apb_pclk, and explain the difference from their binding rules.
  • Record what you found in a compatibility log: how far the guest gets, the transcript and trace at any blocker, the root cause, and a ranked list of what could go wrong next.

Before you start. From the repository root, run scripts/learner start 22; it copies this chapter's journal to learner/journal/22.md. Your VMM from chapter 21 boots U-Boot to its prompt; nothing new is required of it before the first run, which is the point. As in chapter 20, our captures ran the reference from the repository root, so their paths start at .cache/. Run your own VMM from inside learner/ with the same cargo run lines, and prefix each .cache/ path with ../.

The brief

Brief. Boot stock FreeBSD 15.1-RELEASE for 64-bit Arm on your VMM, through stock U-Boot, with two vCPUs and the image on virtio-blk. Fix whatever stops it in your VMM, not in the guest. Write learner/docs/compat/freebsd.md as you go.

Acceptance. At login: type root (the image has no root password), run uname -sr, and see FreeBSD 15.1-RELEASE; shutdown -p now ends the run with exit code 0. On the way the console shows U-Boot 2026.04, FreeBSD/arm64 EFI loader and FreeBSD 15.1-RELEASE, and standard error never says unhandled MMIO, unknown SMCCC, not emulated or guest fatal.

This chapter is a SHOULD: the course promises Linux, and FreeBSD only if the evidence says so. The rule we hold ourselves to: never write "FreeBSD boots" unless the login test passed on a real Mac. For the reference, it did.

A disk image you can trust, and throw away

You need Homebrew's xz (brew install xz; scripts/setup.sh checks its version) and about 4 GB of free space. FreeBSD publishes ready-made virtual-machine images. The project pins one by its SHA-256 hash, and the fetch script refuses anything else:

Shell
scripts/fetch.sh uboot freebsd
TerminalReal output
scripts/fetch.sh uboot freebsdexit: 0--- stdout ---fetch: cached u-boot-qemu-2026.04-r1.apkfetch: cached u-boot.binfetch: cached FreeBSD-15.1-RELEASE-arm64-aarch64-ufs.raw.xzfetch: cached freebsd-15.1-ufs.raw
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • Everything was already in the cache, so each file's sha256 was checked against scripts/fetch-manifest.txt and nothing was downloaded. A first run downloads about 600 MB and takes longer.
course/captures/22-fetch.txt

Our run found everything cached and re-hashed it. A first run downloads about 600 MB, checks the hash, then unpacks it with xz into a raw disk of 6.5 GB, of which about 3.2 GB is real data. You can check the pin yourself. The hash of the download, then the project's pinned lines:

TerminalReal output
shasum -a 256 .cache/macvmm/FreeBSD-15.1-RELEASE-arm64-aarch64-ufs.raw.xz; grep -F ufs.raw.xz scripts/fetch-manifest.txt | cut -d ' ' -f 2,3exit: 0--- stdout ---36028829cbd5a74a050d9964cd5fd391c9d12edca1c3d520cbcce257e1d999c8  .cache/macvmm/FreeBSD-15.1-RELEASE-arm64-aarch64-ufs.raw.xzFreeBSD-15.1-RELEASE-arm64-aarch64-ufs.raw.xz 36028829cbd5a74a050d9964cd5fd391c9d12edca1c3d520cbcce257e1d999c8freebsd-15.1-ufs.raw d7a05077131d07a17c3fb2faf803ff34edf511ddbf796c35934d6d2afc44b959
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • Hashes the cached download and prints the project's pinned lines for it. FreeBSD publishes the same hash for the .xz file in CHECKSUM.SHA256 next to the image (https://download.freebsd.org/releases/VM-IMAGES/15.1-RELEASE/aarch64/Latest/).
course/captures/22-checksum.txt

The first value must equal the line for FreeBSD-15.1-RELEASE-arm64-aarch64-ufs.raw.xz in FreeBSD's own CHECKSUM.SHA256, published next to the image on download.freebsd.org. The second pin is for the unpacked file.

Aside

xz is a compression container, like the gzip inside chapter 13's zboot kernel, but denser and slower. The fetch script refuses xz 5.6.0 and 5.6.1, the two releases that shipped with a planted backdoor in 2024, and never runs anything it unpacked. See the .xz file format specification at tukaani.org/xz.

The raw file is sparse: its long runs of zeros take no space. Never boot it directly. FreeBSD writes to its disk on every boot (logs, a random seed, a check that the root partition fills the disk), so the cached file would drift from its pin. Clone it instead, once per run, into .cache/, which git ignores. cp -c makes an APFS clone (the block-storage primer): instant, and it costs only the blocks the guest changes.

Shell
cp -c .cache/macvmm/freebsd-15.1-ufs.raw .cache/f.rawcargo run -q -p macvmm -- run --bios .cache/macvmm/u-boot.bin --disk .cache/f.raw --mem 2G --cpus 2 --timeout 240 --on-reset exit

--timeout 240 stops a run that hangs; with it, exit code 5 means the timer fired, not that FreeBSD failed. Drop it when you want to explore. Delete .cache/f.raw when you are done.

Here is the reference, all the way to a login and back to the shell. A script typed the three commands; the capture's header says when. U-Boot's EFI text console follows every character it prints with an escape sequence that shows the cursor, so escape sequences are removed below. The one very long line in the middle is FreeBSD's boot menu, drawn with cursor moves.

TerminalReal output
cargo run -q -p macvmm -- run --bios .cache/macvmm/u-boot.bin --disk .cache/f.raw --mem 2G --cpus 2 --timeout 240 --on-reset exitexit: 0--- stdout ---Bloblist at 0 not found (err=-2)alloc space exhausted ptr 400 limit 0Bloblist at 0 not found (err=-2)U-Boot 2026.04 (Apr 21 2026 - 09:17:42 +0000)DRAM:  2 GiBusing memory 0xbe65a000-0xbf69a000 for malloc()Core:  15 devices, 9 uclasses, devicetree: boardFlash: 0 BytesLoading Environment from Flash... *** Warning - bad CRC, using default environmentIn:    serial,usbkbdOut:   serial,vidconsoleErr:   serial,vidconsoleNo USB controllers foundNet:   No ethernet found.Hit any key to stop autoboot: 2Hit any key to stop autoboot: 1Hit any key to stop autoboot: 0Scanning for bootflows in all bootdevsSeq  Method       State   Uclass    Part  Name                      Filename---  -----------  ------  --------  ----  ------------------------  ----------------Scanning global bootmeth 'efi_mgr':No EFI variables loadedMissing TPMv2 device for EFI_TCG_PROTOCOLMissing RNG device for EFI_RNG_PROTOCOL  0  efi_mgr      ready   (none)       0  <NULL>                    ** Booting bootflow '<NULL>' with efi_mgrBooting: Label: virtio 0 Device path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)Consoles: EFI console      Reading loader env vars from /efi/freebsd/loader.envSetting currdev to disk0p1:FreeBSD/arm64 EFI loader, Revision 3.0   Command line arguments: loader.efi   Image base: 0xbd460000   EFI version: 2.110   EFI Firmware: Das U-Boot (rev 8230.1024)   Console: efi,comconsole (0)   Load Path: /\EFI\BOOT\BOOTAA64.EFI   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(1,GPT,155e469a-665c-11f1-067b-ff9d86f8dced,0x22,0x10418)   BootCurrent: 0000   BootOrder: 0000[*]   BootInfo Path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)Ignoring Boot0000: Only one DP foundTrying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(1,GPT,155e469a-665c-11f1-067b-ff9d86f8dced,0x22,0x10418)Setting currdev to disk0p1:|\x08Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(2,GPT,155e46ae-665c-11f1-1d08-61407e6af4da,0x1043a,0x200000)Setting currdev to disk0p2:/\x08Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(3,GPT,155e46ae-665c-11f1-17a5-d14fff7c5968,0x21043a,0xa00000)Setting currdev to disk0p3:-\x08\\x08|\x08/\x08-\x08\\x08|\x08/\x08-\x08\\x08|\x08/\x08-\x08\\x08|\x08/\x08-\x08\\x08|\x08/\x08-\x08\\x08Loading /boot/defaults/loader.confLoading /boot/defaults/loader.confLoading /boot/device.hintsLoading /boot/loader.conf|\x08Loading /boot/loader.conf.local/\x08-\x08c\\x08|\x08  ```                        ` s` `.....---.......--.```   -/ +o   .--`         /y:`      +.  yo`:.            :o      `+-   y/               -/`   -o/  .-                  ::/sy+:.  /                     `--  / `:                          :` `:                          :`  /                          /  .-                        -.   --                      -.    `:`                  `:`      .--             `--.         .---.....----.  ```                        ` s` `.....---.......--.```   -/ +o   .--`         /y:`      +.  yo`:.            :o      `+-   y/               -/`   -o/  .-                  ::/sy+:.  /                     `--  / `:                          :` `:                          :`  /                          /  .-                        -.   --                      -.    `:`                  `:`      .--             `--.         .---.....----.  ______               ____   _____ _____   |  ____|             |  _ \ / ____|  __ \  | |___ _ __ ___  ___ | |_) | (___ | |  | | |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | | | |   | | |  __/  __/| |_) |____) | |__| | | |   | | |    |    ||     |      |      | |_|   |_|  \___|\___||____/|_____/|_____/   ______               ____   _____ _____   |  ____|             |  _ \ / ____|  __ \  | |___ _ __ ___  ___ | |_) | (___ | |  | | |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | | | |   | | |  __/  __/| |_) |____) | |__| | | |   | | |    |    ||     |      |      | |_|   |_|  \___|\___||____/|_____/|_____/ ╔╚╗╝════════════════════════════════════════════════════════════════════════════║║║║║║║║║║║║║║║║║║║║║║║║║║ Welcome to FreeBSD ++++----------------------------------------------------------------------------|||||||||||||||||||||||||| Welcome to FreeBSD 1. Boot Multi user [Enter]2. Boot Single user3. Escape to loader prompt4. Reboot5. Cons: VideoKernel:/\x08-\x08\\x08|\x08/\x08-\x08\\x08|\x08/\x08-\x08\\x086. kernel (1 of 1)Options:7. Boot OptionsAutoboot in 10 seconds. [Space] to pause Autoboot in 9 seconds. [Space] to pause Autoboot in 8 seconds. [Space] to pause Autoboot in 7 seconds. [Space] to pause Autoboot in 6 seconds. [Space] to pause Autoboot in 5 seconds. [Space] to pause Autoboot in 4 seconds. [Space] to pause Autoboot in 3 seconds. [Space] to pause Autoboot in 2 seconds. [Space] to pause Autoboot in 1 seconds. [Space] to pause Autoboot in 0 seconds. [Space] to pause Loading kernel...|\x08/boot/kernel/kernel text=0x318 text=0xa7d088 /\x08-\x08\\x08|\x08/\x08-\x08text=0x284f00 \\x08data=0x16c978 |\x08data=0x0+0x2c2000 0x8+0x1625d0+0x8+0x18bc59/\x08Loading configured modules...-\x08can't find '/boot/entropy'can't find '/etc/hostid'Using DTB provided by EFI at 0xbd600000.\\x08Loading splash okLoading shutdown splash ok---<<BOOT>>---WARNING: Cannot find freebsd,dts-version property, cannot check DTB complianceCopyright (c) 1992-2025 The FreeBSD Project.Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994	The Regents of the University of California. All rights reserved.FreeBSD is a registered trademark of The FreeBSD Foundation.FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC arm64FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)VT: init without driver.real memory  = 2147483648 (2048 MB)avail memory = 2074775552 (1978 MB)Starting CPU 1 (1)FreeBSD/SMP: Multiprocessor System Detected: 2 CPUsarc4random: WARNING: initial seeding bypassed the cryptographic random device because it was not yet seeded and the knob 'bypass_before_seeding' was enabled.random: entropy device external interfacekbd0 at kbdmux0ofwbus0: <Open Firmware Device Tree>psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0smccc0: <ARM SMCCC v1.1> on psci0cpulist0: <Open Firmware CPU Group> on ofwbus0cpu0: <Open Firmware CPU> on cpulist0gic0: <ARM Generic Interrupt Controller v3.0> mem 0x8000000-0x800ffff,0x80a0000-0x80dffff on ofwbus0generic_timer0: <ARMv8 Generic Timer> irq 0,1,2,3 on ofwbus0Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000smbios0: <System Management BIOS>smbios0: Entry point: v3 (64-bit), Version: 3.7uart0: <PrimeCell UART (PL011)> mem 0x9000000-0x9000fff irq 4 on ofwbus0uart0: console (115200,n,8,1)pl0310: <PL031 RTC> mem 0x9010000-0x9010fff irq 5 on ofwbus0pl0310: registered as a time-of-day clock, resolution 1.000000svirtio_mmio0: <VirtIO MMIO adapter> mem 0xa000000-0xa0001ff irq 6 on ofwbus0vtblk0: <VirtIO Block Adapter> on virtio_mmio0vtblk0: 6176MB (12649563 512 byte sectors)armv8crypto0: <AES-CBC,AES-XTS,AES-GCM>Timecounters tick every 1.000 msecusb_needs_explore_all: no devclassCPU  0: Apple Unknown CPU r0p0 (midr: 610f0000) affinity:  0                   Cache Type = <IDC,64 byte CWG,64 byte ERG,64 byte D-cacheline,PIPT I-cache,64 byte I-cacheline,0x900000000> Instruction Set Attributes 0 = <TLBI-OSR,CondM-8.5,FHM,DP,SHA3,RDM,Atomic,CRC32,SHA2+SHA512,SHA1,AES+PMULL> Instruction Set Attributes 1 = <I8MM,EBF16,PredInv v8.9,SB,FRINTTS,GPI,RCPC-8.4,FCMA,JSCVT,Impl PAuth+FPAC+Combined,DCCVADP> Instruction Set Attributes 2 = <RPRES>         Processor Features 0 = <CSV3,CSV2,PSTATE.DIT,RAS,GIC,AdvSIMD+HP,FP+HP,EL1,EL0>         Processor Features 1 = <MTE_frac,CSV2 p2,SME2,BTI>         Processor Features 2 = <>      Memory Model Features 0 = <ExS,TGran4,TGran16,16bit ASID,1TB PA>      Memory Model Features 1 = <AFP,XNX,SpecSEI,EPAN,LO,HPD+TTPBHA,8bit VMID>      Memory Model Features 2 = <E0PD,TTL,IDS,AT,NV v8.4,32bit CCIDX,48bit VA,IESB,UAO,CnP>      Memory Model Features 3 = <>      Memory Model Features 4 = <>             Debug Features 0 = <DoubleLock,2 CTX BKPTs,4 Watchpoints,6 Breakpoints,Debugv8>             Debug Features 1 = <>         Auxiliary Features 0 = <>         Auxiliary Features 1 = <>AArch32 Instruction Set Attributes 5 = <>AArch32 Media and VFP Features 0 = <>AArch32 Media and VFP Features 1 = <>CPU  1: Apple Unknown CPU r0p0 (midr: 610f0000) affinity:  1gic0: using for IPIsRelease APs...doneTCP_ratelimit: Is now initializedTrying to mount root from ufs:/dev/gpt/rootfs [rw,noatime]...random: randomdev_wait_until_seeded unblock waitrandom: unblocking device.Setting hostuuid: deac865b-a76e-41e6-9e8e-49d403a9276f.Setting hostid: 0xda939c4c.Starting file system checks:/dev/gpt/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS/dev/gpt/rootfs: clean, 699397 free (5 frags, 87424 blocks, 0.0% fragmentation)/dev/gpt/efiboot0: FILESYSTEM CLEAN; SKIPPING CHECKSGrowing root partition to fill devicevtbd0 recovering is not neededvtbd0p3 resizedgrowfs: requested size 5.0GB is equal to the current filesystem size 5.0GBMounting local filesystems:.Setting up harvesting: RANDOMDEV,[CALLOUT],[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHEDFeeding entropy: .ELF ldconfig path: /lib /usr/lib /usr/local/lib /usr/local/lib/compat/pkg /usr/local/lib/compat/pkgSetting hostname: freebsd.lo0: link state changed to UPStarting Network: lo0.lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>	inet 127.0.0.1 netmask 0xff000000	inet6 ::1 prefixlen 128	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1	groups: lo	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>Starting devd.route: message indicates error: File existsadd host 127.0.0.1: gateway lo0 fib 0: route already in tableroute: message indicates error: File existsadd host ::1: gateway lo0 fib 0: route already in tableadd net fe80::: gateway ::1add net ff02::: gateway ::1add net ::ffff:0.0.0.0: gateway ::1add net ::0.0.0.0: gateway ::1Clearing /tmp (X related).Updating motd:.Updating /var/run/os-release done.Creating and/or trimming log files.Starting syslogd.Mounting late filesystems:.Starting cron.Starting background file system checks in 60 seconds.Fri Nov 20 10:00:32 UTC 2026FreeBSD/arm64 (freebsd) (ttyu0)login: rootFreeBSD 15.1-RELEASE (GENERIC) releng/15.1-n283562-96841ea08dcfWelcome to FreeBSD!Release Notes, Errata: https://www.FreeBSD.org/releases/Security Advisories:   https://www.FreeBSD.org/security/FreeBSD Handbook:      https://www.FreeBSD.org/handbook/FreeBSD FAQ:           https://www.FreeBSD.org/faq/Nov 20 10:00:58 freebsd login[1057]: ROOT LOGIN (root) ON ttyu0Questions List:        https://www.FreeBSD.org/lists/questions/FreeBSD Forums:        https://forums.FreeBSD.org/Documents installed with the system are in the /usr/local/share/doc/freebsd/directory, or can be installed later with:  pkg install en-freebsd-docFor other languages, replace "en" with a language code like de or fr.Show the version of FreeBSD installed:  freebsd-version ; uname -aPlease include that output and any error messages when posting questions.Introduction to manual pages:  man manFreeBSD directory layout:      man hierTo change this login announcement, see motd(5).resizewin: timeout reading from terminalroot@freebsd:~ # uname -srFreeBSD 15.1-RELEASEroot@freebsd:~ # shutdown -p nowShutdown NOW!shutdown: [pid 1062]root@freebsd:~ #                                                                                \x07*** FINAL System shutdown message from root@freebsd ***                      System going down IMMEDIATELY                                                                                      Stopping cron.Waiting for PIDS: 1000.Stopping devd.Waiting for PIDS: 537.Writing entropy file: .Writing early boot entropy file: ..TerminatedNov 20 10:01:06 freebsd syslogd: exiting on signal 15Waiting (max 60 seconds) for system process `vnlru' to stop... doneWaiting (max 60 seconds) for system process `syncer' to stop... Syncing disks, vnodes remaining... 0 doneAll buffers synced.Uptime: 36s--- stderr ---macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x40000000 at offset 0x12c668 (flash is read-only, write 1 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c670 (flash is read-only, write 2 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c678 (flash is read-only, write 3 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c680 (flash is read-only, write 4 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 4-byte write of 0x1 at offset 0xed4 (flash is read-only, write 5 to this bank)
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • The reference (its code identical to the reference apart from anchor comments). .cache/f.raw is a fresh cp -c clone of .cache/macvmm/freebsd-15.1-ufs.raw. A script typed root, uname -sr and shutdown -p now (after 40, 44 and 47 s).
  • U-Boot's EFI console follows every character with escape sequences (show cursor, colours): escape sequences and carriage returns are removed from stdout.
course/captures/22-freebsd-boot.txt

Read it as four programs taking turns, each handing the next what it needs. Only macvmm runs on the host; the other three run inside the guest:

 host        |  guest macvmm      |  U-Boot (flash)        loader.efi (RAM)      FreeBSD kernel ------      |  --------------        ----------------      -------------- DTB at RAM -|> copies the DTB, base, PC=0  |  finds the disk,             |  runs BOOTAA64.EFI ->  reads UFS through             |                        U-Boot's block I/O,             |                        DTB from the EFI   ->  attaches drivers             |                        config table           from the DTB <- PSCI SYSTEM_OFF <- U-Boot's EFI ResetSystem <-----------  shutdown -p now

Each arrow is a hand-over; the last line runs right to left, back through U-Boot's code and across the line into the host.

  1. U-Boot starts from flash exactly as in chapter 21. Its countdown expires, and standard boot scans for something to run. The efi_mgr method finds no stored EFI boot entries (No EFI variables loaded: our flash forgets every write, so every boot is a first boot), and falls back to the default path the uefi primer described: \EFI\BOOT\BOOTAA64.EFI on the first disk's EFI system partition (ESP).
  2. That file is FreeBSD's loader.efi. It reports its firmware as Das U-Boot and its EFI version as 2.110, the specification's way of writing 2.11. It tries each partition (disk0p1, disk0p2, disk0p3), finds FreeBSD's file system on the third, reads its settings, waits ten seconds at its menu, and loads /boot/kernel/kernel.
  3. Using DTB provided by EFI at 0xbd600000: the loader hands the kernel the device tree it found in the UEFI configuration table. U-Boot put it there: our DTB, copied and lightly edited by U-Boot (it fixes up the memory node and /chosen). That answers chapter 21's open question for this chain.
  4. The kernel attaches what our tree describes, each on ofwbus0, FreeBSD's name for the device-tree bus: psci0; gic0 (the interrupt controller) at our distributor and redistributor addresses; generic_timer0 at 24 MHz; uart0 on the PL011; pl0310 on the real-time clock; virtio_mmio0 and vtblk0. It starts CPU 1 (Multiprocessor System Detected: 2 CPUs) and mounts root from /dev/gpt/rootfs, the partition labelled rootfs in the disk's GUID partition table (GPT: the standard list of a disk's partitions, each named by a globally unique identifier). Then getty, the program that prints login: and waits for a user, runs on ttyu0, FreeBSD's name for its first serial port, here our PL011.
  5. shutdown -p now powers off, and macvmm exits 0.

Aside

FreeBSD's boot loader, loader(8), is a small program with its own prompt and scripting; loader.efi is that program packaged to run under UEFI. It reads the kernel from a UFS (Unix File System) partition, FreeBSD's traditional file system. The manual pages loader(8) and loader.efi(8) at man.freebsd.org describe both.

The kernel also prints the CPU's feature registers: PAuth (pointer authentication), MTE_frac (part of the memory tagging extension), SME2. A guest may probe such features and use them; in this boot none of them caused any trouble, so we leave them there.

Try it

Stop at the loader's own prompt. Boot again, and while the menu counts down, press 3 (Escape to loader prompt). At OK, type lsdev, then lsefi, and press space to page through it. Look for the words block io: whose code does the loader call when it reads the disk? Afterwards, type boot to carry on, or press Ctrl-A x to quit (exit code 130, chapter 09).

TerminalReal output
cargo run -q -p macvmm -- run --bios .cache/macvmm/u-boot.bin --disk .cache/f.raw --mem 2G --cpus 2 --timeout 40 --on-reset exitexit: 5--- stdout ---/\x08-\x08c\\x08|\x08  ```                        ` s` `.....---.......--.```   -/ +o   .--`         /y:`      +.  yo`:.            :o      `+-   y/               -/`   -o/  .-                  ::/sy+:.  /                     `--  / `:                          :` `:                          :`  /                          /  .-                        -.   --                      -.    `:`                  `:`      .--             `--.         .---.....----.  ```                        ` s` `.....---.......--.```   -/ +o   .--`         /y:`      +.  yo`:.            :o      `+-   y/               -/`   -o/  .-                  ::/sy+:.  /                     `--  / `:                          :` `:                          :`  /                          /  .-                        -.   --                      -.    `:`                  `:`      .--             `--.         .---.....----.  ______               ____   _____ _____   |  ____|             |  _ \ / ____|  __ \  | |___ _ __ ___  ___ | |_) | (___ | |  | | |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | | | |   | | |  __/  __/| |_) |____) | |__| | | |   | | |    |    ||     |      |      | |_|   |_|  \___|\___||____/|_____/|_____/   ______               ____   _____ _____   |  ____|             |  _ \ / ____|  __ \  | |___ _ __ ___  ___ | |_) | (___ | |  | | |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | | | |   | | |  __/  __/| |_) |____) | |__| | | |   | | |    |    ||     |      |      | |_|   |_|  \___|\___||____/|_____/|_____/ ╔╚╗╝════════════════════════════════════════════════════════════════════════════║║║║║║║║║║║║║║║║║║║║║║║║║║ Welcome to FreeBSD ++++----------------------------------------------------------------------------|||||||||||||||||||||||||| Welcome to FreeBSD 1. Boot Multi user [Enter]2. Boot Single user3. Escape to loader prompt4. Reboot5. Cons: VideoKernel:/\x08-\x08\\x08|\x08/\x08-\x08\\x08|\x08/\x08-\x08\\x086. kernel (1 of 1)Options:7. Boot OptionsAutoboot in 10 seconds. [Space] to pause Autoboot in 9 seconds. [Space] to pause Autoboot in 8 seconds. [Space] to pause Autoboot in 7 seconds. [Space] to pause Autoboot in 6 seconds. [Space] to pause Autoboot in 5 seconds. [Space] to pause                                                                                Exiting menu!Type '?' for a list of commands, 'help' for more detailed help.OK lsdevdisk devices:    disk0:    12649563 X 512 blocks      disk0p1: EFI      disk0p2: FreeBSD swap      disk0p3: FreeBSD UFShttp: (unknown)net devices:OK lsefiHandle for device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)  device path  device path to text  0379be4e-d706-437d-b037-edb82fb772a4  e617d64c-fe08-46da-f4dc-bbd5870c7300  unicode collation2  HII string  HII database  HII config routing  simple text output  simple text input  simple text ex inputHandle for device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/Uart(0,0,D,D)  device pathHandle 0xbe67b510  driver bindingHandle for device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)  device path  block io  8cf2f62c-bc9b-4821-808d-ec9ec421a1a0Handle for device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(1,GPT,155e469a-665c-11f1-067b-ff9d86f8dced,0x22,0x10418)  device path  block io  8cf2f62c-bc9b-4821-808d-ec9ec421a1a0 --more--  <space> page down <enter> line down <q> quit                                                           EFI System partition  simple fsHandle for device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(2,GPT,155e46ae-665c-11f1-1d08-61407e6af4da,0x1043a,0x200000)  device path  block io  8cf2f62c-bc9b-4821-808d-ec9ec421a1a0Handle for device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(3,GPT,155e46ae-665c-11f1-17a5-d14fff7c5968,0x21043a,0xa00000)  device path  block io  8cf2f62c-bc9b-4821-808d-ec9ec421a1a0Handle for image /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(1,GPT,155e469a-665c-11f1-067b-ff9d86f8dced,0x22,0x10418)/\EFI\BOOT\BOOTAA64.EFI  loaded image device path  loaded imageOK   --- stderr ---macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x40000000 at offset 0x12c668 (flash is read-only, write 1 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c670 (flash is read-only, write 2 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c678 (flash is read-only, write 3 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c680 (flash is read-only, write 4 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 4-byte write of 0x1 at offset 0xed4 (flash is read-only, write 5 to this bank)macvmm: timeout: the guest was still running after --timeout 40s
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • The reference. .cache/f.raw is a fresh cp -c clone. At the loader menu a script pressed 3 (Escape to loader prompt) after 8 s, then typed lsdev and lsefi, then pressed space three times to page through lsefi's output; the run ends at --timeout 40.
  • Escape sequences and carriage returns removed; stdout shown from the line 'Exiting menu!' on.
course/captures/22-loader-lsefi.txt

(Exit code 5: our --timeout 40 stopped it at the prompt.) lsefi lists the handles U-Boot's UEFI layer offers: a text console, device paths, and block io on the whole disk and on each of its three partitions, the first of which also offers simple fs (a file system the firmware can read: the ESP). The unnamed GUID 8cf2f62c-… beside each block io is UEFI's partition-information protocol; ignore it. The last handle is the loader itself, loaded from \EFI\BOOT\BOOTAA64.EFI. The loader never touches our virtio registers. It calls U-Boot, and U-Boot's own virtio driver does the work. Keep that list in mind for journal question 3.

If yours stops. Find the last line a program printed, then read standard error. Each forbidden message points back to a chapter:

  • unhandled MMIO at an address: compare the address with your DTB and memory map (chapters 05, 07 and 10). Chapter 05's capture 05-poke-fatal shows the message.
  • unknown SMCCC function: your PSCI and call-convention dispatch (chapter 08, the smccc primer); chapter 08's probe captures show it.
  • not emulated, or guest fatal with an instruction word: the decoder for syndromes without ISV (chapter 21, whose opening shows U-Boot refused this way).
  • Silence after Starting CPU 1: CPU_ON and the per-vCPU thread (chapter 20). We have not been able to check what this looks like with FreeBSD.
  • vtblk0: host requires … and a mountroot> prompt: your virtio-blk feature offer (chapter 18, and Deliberate breakage 2 below).

scripts/learner hint 22 gives four hints, from a nudge to the reference's files, and scripts/learner lifeline MODULE borrows one reference module (for example vmm::psci, as in chapter 08).

Good place to stop. The rest compares our machine with QEMU's, breaks it twice, reads the exit trace and writes the log.

Is our machine right? Ask a second machine

Reaching login: shows that this guest found what it needed. It does not show that our machine is correct. Linux boots on it too, but as you will see, the two read different parts of the same device tree. When a guest disagrees with us, there are three primary sources, and a vote among guests is not one of them:

  • the specification of the thing the guest read: the virtio specification for a device, the device-tree bindings for a node, the Arm manuals for a register;
  • the guest's own source, for what it does with what it read;
  • a reference machine: QEMU's virt, whose memory map ours copies, a machine that FreeBSD and Linux both support as it comes.

So compare our tree with QEMU's. With QEMU installed, qemu-system-aarch64 -machine virt,gic-version=3,dumpdtb=.cache/qemu.dtb -cpu max -smp 2 -m 2G writes its DTB, and our --dry-run --dtb-out .cache/ours.dtb writes ours. If you do not have QEMU, use our captures. First the nodes:

TerminalReal output
qemu-system-aarch64 --version | head -1; diff <(fdtget -l .cache/qemu.dtb / | sort) <(fdtget -l .cache/ours.dtb / | sort)exit: 1--- stdout ---QEMU emulator version 11.1.21d0< aliases5,7d3< flash@0< fw-cfg@9020000< gpio-keys10d5< pcie@1000000013,15d7< pl061@9030000< platform-bus@c000000< pmu19,49d10< virtio_mmio@a000200< virtio_mmio@a000400< virtio_mmio@a000600< virtio_mmio@a000800< virtio_mmio@a000a00< virtio_mmio@a000c00< virtio_mmio@a000e00< virtio_mmio@a001000< virtio_mmio@a001200< virtio_mmio@a001400< virtio_mmio@a001600< virtio_mmio@a001800< virtio_mmio@a001a00< virtio_mmio@a001c00< virtio_mmio@a001e00< virtio_mmio@a002000< virtio_mmio@a002200< virtio_mmio@a002400< virtio_mmio@a002600< virtio_mmio@a002800< virtio_mmio@a002a00< virtio_mmio@a002c00< virtio_mmio@a002e00< virtio_mmio@a003000< virtio_mmio@a003200< virtio_mmio@a003400< virtio_mmio@a003600< virtio_mmio@a003800< virtio_mmio@a003a00< virtio_mmio@a003c00< virtio_mmio@a003e00
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • .cache/qemu.dtb: qemu-system-aarch64 -machine virt,gic-version=3,dumpdtb=.cache/qemu.dtb -cpu max -smp 2 -m 2G. .cache/ours.dtb: the reference macvmm, run --bios .cache/macvmm/u-boot.bin --disk .cache/f.raw --mem 2G --cpus 2 --dry-run --dtb-out .cache/ours.dtb. Lines with < are nodes only QEMU has; lines with > would be nodes only ours has.
course/captures/22-dtb-nodes.txt

Every < line is a node only QEMU has: its flash (flash@0), a PCI Express host (pcie@10000000), QEMU's own configuration device (fw-cfg@9020000), a performance-monitor node (pmu), a general-purpose input/output (GPIO) controller with a power button, a platform bus for devices added on QEMU's command line (platform-bus@c000000), serial port aliases, and 31 more virtio slots. There is no > line: we describe nothing QEMU lacks. Then four properties side by side (each address and size in reg is two cells, as in chapter 10):

TerminalReal output
for f in .cache/qemu.dtb .cache/ours.dtb; do echo "== $f"; fdtget -t s $f /pl011@9000000 clock-names; fdtget $f /virtio_mmio@a000000 interrupts; fdtget -t x $f /intc@8000000 reg; fdtget -t s $f /cpus/cpu@0 compatible; doneexit: 0--- stdout ---== .cache/qemu.dtbuartclk apb_pclk0 16 10 8000000 0 10000 0 80a0000 0 f60000arm,cortex-a57== .cache/ours.dtbuartclk apb_pclk0 16 40 8000000 0 10000 0 80a0000 0 40000arm,arm-v8
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • The same two blobs as 22-dtb-nodes.txt.
course/captures/22-dtb-props.txt

The PL011 clocks agree. The virtio-mmio interrupt's last cell does not: QEMU says 1 (edge-triggered), we say 4 (level-high). The redistributor regions differ in size. Each vCPU needs 128 KiB of redistributor (chapter 12); ours sizes the region for the two we create (0x40000), while QEMU reserves room for 123 CPUs (0xf60000). FreeBSD's gic0 line, 0x80a0000-0x80dffff, shows it read our size. QEMU also names its CPU model, arm,cortex-a57, where we say only arm,arm-v8, an Armv8 CPU of no particular model.

Each difference is a hypothesis to test, not a bug. Ours declares level because our device drives a level line that stays high until the driver acknowledges (chapter 15); the tree tells the truth about our machine, which is its job:

crates/vmm/src/fdt/machine.rslines 161-167
/// `<GIC_SPI n IRQ_TYPE_LEVEL_HIGH>` for an SPI INTID (32..=1019, GIC spec IHI 0069 §2.2).pub fn spi_cells(intid: u32) -> Result<[u32; 3], FdtError> {    match intid.checked_sub(32) {        Some(n) if intid <= 1019 => Ok([GIC_SPI, n, IRQ_TYPE_LEVEL_HIGH]),        _ => Err(bad(format!("INTID {intid} is not an SPI"))),    }}

FreeBSD 15.1 booted with every one of these differences, and so does Linux. That is a measurement for two guests. Question 1 of your journal asks which of them might matter to a third.

Breaking it on purpose

Two breaks, each a one-line change, each run against both guests. Commit your working VMM in learner/ first (git commit -am "boots FreeBSD"), make the change there, and run both guests from learner/: FreeBSD with the cargo run line above, Linux with chapter 14's cargo run line (scripts/run-linux.sh always runs the reference, never your tree). Undo each change with git checkout -- FILE before the next. Our captures come from a copy of the reference with the same one-line change.

Deliberate breakage 1: remove apb_pclk from the PL011 node. Chapter 10 gave every PrimeCell node a fixed clock named apb_pclk. Here is the PL011's call; change its clock names to &["uartclk"]:

crates/vmm/src/fdt/machine.rslines 411-417
primecell(    &mut w,    row(layout, PL011_BASE)?,    &["arm,pl011", "arm,primecell"],    &["uartclk", "apb_pclk"],    with_gic,)?;

Check your Predict entry. First, Linux on the reference, to know what normal looks like:

TerminalReal output
scripts/run-linux.sh --test boot --timeout 30exit: 0--- stdout ---[    0.000000] Machine model: macvmm-virt[    0.000000] printk: legacy bootconsole [pl11] enabled[    0.000000] Kernel command line: console=ttyAMA0 earlycon=pl011,0x09000000 macvmm.test=boot[    0.034637] Serial: AMBA PL011 UART driver[    0.035153] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 13, base_baud = 0) is a PL011 rev1[    0.035801] printk: console [ttyAMA0] enabled[    0.035801] printk: console [ttyAMA0] enabled[    0.036503] printk: legacy bootconsole [pl11] disabled[    0.036503] printk: legacy bootconsole [pl11] disabledmacvmm-initramfs: ready 6.18.60-0-virt[    0.176755] reboot: Power down
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • The reference (crates/ identical to the reference except anchor comments).
  • Carriage returns removed; stdout filtered with grep -E to the lines matching PL011|pl011|ttyAMA0|console|macvmm-|Power.
course/captures/22-linux-console.txt

Then Linux without the clock:

TerminalReal output
scripts/run-linux.sh --test boot --timeout 30exit: 0--- stdout ---[    0.000000] Machine model: macvmm-virt[    0.000000] printk: legacy bootconsole [pl11] enabled[    0.000000] Kernel command line: console=ttyAMA0 earlycon=pl011,0x09000000 macvmm.test=boot[    0.032977] Serial: AMBA PL011 UART driver[    0.169812] Warning: unable to open an initial console.[    0.174058] reboot: Power down
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • Deliberate breakage 1: the PL011 node lists only the uartclk clock (clock_names ["uartclk"] in crates/vmm/src/fdt/machine.rs); apb_pclk is gone. Everything else is the reference.
  • Carriage returns removed; stdout filtered with grep -E to the lines matching PL011|pl011|ttyAMA0|console|macvmm-|Power (as in 22-linux-console.txt).
course/captures/22-noapb-linux.txt

Then FreeBSD without the clock, filtered to the lines that matter:

TerminalReal output
cargo run -q -p macvmm -- run --bios .cache/macvmm/u-boot.bin --disk .cache/f.raw --mem 2G --cpus 2 --timeout 240 --on-reset exitexit: 0--- stdout ---U-Boot 2026.04 (Apr 21 2026 - 09:17:42 +0000)FreeBSD/arm64 EFI loader, Revision 3.0FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC arm64uart0: <PrimeCell UART (PL011)> mem 0x9000000-0x9000fff irq 4 on ofwbus0uart0: console (115200,n,8,1)pl0310: <PL031 RTC> mem 0x9010000-0x9010fff irq 5 on ofwbus0pl0310: registered as a time-of-day clock, resolution 1.000000slogin: rootNov 20 10:04:21 freebsd login[1057]: ROOT LOGIN (root) ON ttyu0FreeBSD 15.1-RELEASE (GENERIC) releng/15.1-n283562-96841ea08dcfShow the version of FreeBSD installed:  freebsd-version ; uname -aTo change this login announcement, see motd(5).root@freebsd:~ # uname -srFreeBSD 15.1-RELEASEUptime: 37s--- stderr ---macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x40000000 at offset 0x12c668 (flash is read-only, write 1 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c670 (flash is read-only, write 2 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c678 (flash is read-only, write 3 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c680 (flash is read-only, write 4 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 4-byte write of 0x1 at offset 0xed4 (flash is read-only, write 5 to this bank)
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • Deliberate breakage 1, same build as 22-noapb-linux.txt: the PL011 node has no apb_pclk.
  • .cache/f.raw is a fresh cp -c clone of .cache/macvmm/freebsd-15.1-ufs.raw. A script typed root, uname -sr and shutdown -p now (after 40, 44 and 47 s).
  • Escape sequences and carriage returns removed; stdout filtered with grep -E to the lines matching uart|pl031|U-Boot 20|EFI loader|login|uname|^FreeBSD 15|Uptime.
course/captures/22-noapb-freebsd.txt

Linux lost its console without a word about the clock or the PL011. The driver loaded (Serial: AMBA PL011 UART driver), but the device was never bound: no ttyAMA0 line, and the early console was never retired. When the kernel went to start the first program, it printed Warning: unable to open an initial console. The test program's own line, macvmm-initramfs: ready, never appeared.

The primecell-ids primer has the rule. Linux's AMBA bus (Arm's on-chip bus family) asks for a clock named apb_pclk before it reads a PrimeCell's ID registers, and without it never matches a driver. FreeBSD binds its PL011 driver by compatible and does not ask; it logged in as if nothing had changed.

What you saw: one OS silently loses its console, the other notices nothing. The misconception it exposes: "if one OS boots, the machine is correct". The tool that finds it: running every guest you claim to support, and diffing each boot log against a known-good one, because an absence never shows up as an error.

Deliberate breakage 2: offer VIRTIO_BLK_F_SIZE_MAX again. This is the opening puzzle, and it is history, not invention: the reference offered this feature until the first time it booted FreeBSD. Here is the device's offer today:

crates/vmm/src/virtio/blk.rslines 620-630
fn device_features(&self) -> u64 {    let mut f = features::VERSION_1        | features::INDIRECT_DESC        | blk_features::SEG_MAX        | blk_features::BLK_SIZE        | blk_features::FLUSH;    if self.read_only {        f |= blk_features::RO;    }    f}

Add | blk_features::SIZE_MAX to the list. The feature bit promises that no single data segment (one data buffer of a request, one descriptor in chapter 18's terms) is larger than size_max, which our config space reports as 64 KiB, one bounce buffer (chapter 18).

Predict You already know who refuses. So: does the virtio specification oblige FreeBSD to accept this device, and does it oblige us to offer the bit? And U-Boot and FreeBSD's loader read this disk through whose driver: will this change touch them?

Decide before reading on; your answer to journal question 2 builds on it.

Our FreeBSD run is the opening's capture. Linux, same build, reading a disk through the same device:

TerminalReal output
scripts/run-linux.sh --test vda --disk .cache/macvmm/rootfs.img,ro --timeout 120exit: 0--- stdout ---[    0.000000] Machine model: macvmm-virt[    0.000000] Kernel command line: console=ttyAMA0 earlycon=pl011,0x09000000 macvmm.test=vdamacvmm-initramfs: ready 6.18.60-0-virt[    0.146328] virtio_blk virtio0: 1/0/0 default/read/poll queues[    0.146415] virtio_blk virtio0: [vda] 524288 512-byte logical blocks (268 MB/256 MiB)macvmm-vda: /dev/vda 524288 sectors ro=1macvmm-vda: sha256=a43f12e076f9dbd70803951713b4d4e1e77af39089a8c62e91d5eb16103b8300[    1.090510] reboot: Power down
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • Deliberate breakage 2, same build as 22-size-max-freebsd.txt: virtio-blk offers VIRTIO_BLK_F_SIZE_MAX (size_max = 64 KiB).
  • Carriage returns removed; stdout filtered with grep -E to the lines matching virtio_blk|vda|macvmm-|Power.
course/captures/22-size-max-linux.txt

Now diagnose it the way you would without being told. Who spoke last? Standard error holds nothing from the VMM but the flash writes and our timeout, so no exit went unhandled: whatever happened, happened inside the guest. The guest says vtblk0: host requires unsupported maximum segment size feature, then attach returned 45. FreeBSD's error 45 is EOPNOTSUPP (operation not supported), and the later error 19 is ENODEV (no such device): no disk, so no /dev/gpt/rootfs, so the mountroot prompt.

U-Boot and the loader both read fine. The loader's banner and the kernel banner in the opening capture prove the kernel came off this disk, through U-Boot's own virtio driver (the block io you saw in lsefi). Only FreeBSD's kernel driver reads our feature bits itself. Then the three sources:

  • The guest's source. FreeBSD's vtblk_attach, in sys/dev/virtio/block/virtio_blk.c, refuses a device that offers VIRTIO_BLK_F_SIZE_MAX with a size_max below the kernel's largest transfer, 1 MiB on arm64. Its comment says why: FreeBSD's scatter-gather lists (the lists of memory pieces that make up one transfer) merge physically adjacent pages into one segment, so it cannot promise to keep each segment small. It refuses rather than risk corrupting a transfer.
  • The specification. Virtio 1.2, section 5.2.3, lists the feature as one a device may offer. Nothing obliges a device to offer it, and nothing obliges a driver to work with every device.
  • The reference machine. QEMU's virtio-blk does not offer it.

So nobody broke a rule. Linux and U-Boot accept the small limit, which is why they worked, and the guest that refused was reasonable. Our device was the odd one out, making a promise it never needed: chapter 18's data path copies through 64 KiB buffers piece by piece whatever the segment size. Dropping the bit cost nothing, and that is the fix in the reference.

What you saw: one guest refuses a device the others drive. The misconception: "the device works, so the guest is wrong". The tool: the guest's own message, read against its source and the specification.

Security

Dropping the feature moved a limit, it did not remove one. Without SIZE_MAX, a compliant driver may send a request larger than the 126 × 64 KiB our device accepts, and the driver is never told. Our device still enforces its own cap, answering such a request with an I/O error and staying usable, never trusting a length the guest wrote. Every limit you stop advertising must still be enforced on the device side.

What the exits say

A transcript shows what the guest chose to print. The exit trace shows what it asked of our VMM. Run the login again with a trace of the power, hypervisor-call and system-register exits:

TerminalReal output
cargo run -q -p macvmm -- run --bios .cache/macvmm/u-boot.bin --disk .cache/f.raw --mem 2G --cpus 2 --timeout 240 --on-reset exit --trace exits:.cache/t.jsonl:psci,hvc,sysregexit: 0--- stdout ---Starting CPU 1 (1)FreeBSD/SMP: Multiprocessor System Detected: 2 CPUslogin: rootShow the version of FreeBSD installed:  freebsd-version ; uname -aroot@freebsd:~ # uname -srFreeBSD 15.1-RELEASEUptime: 37s--- stderr ---macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x40000000 at offset 0x12c668 (flash is read-only, write 1 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c670 (flash is read-only, write 2 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c678 (flash is read-only, write 3 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c680 (flash is read-only, write 4 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 4-byte write of 0x1 at offset 0xed4 (flash is read-only, write 5 to this bank)
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • The reference, with an exit trace of the psci, hvc and sysreg categories. .cache/f.raw is a fresh cp -c clone; a script typed root, uname -sr and shutdown -p now (after 40, 44 and 47 s).
  • Escape sequences and carriage returns removed; stdout filtered with grep -E to the lines matching CPU 1|Multiprocessor|login:|uname|^FreeBSD 15.1-RELEASE$|Uptime.
course/captures/22-trace-run.txt
TerminalReal output
sed -E s/.*"vcpu":([0-9]+).*"pc":"([^"]*)".*"(fn|sysreg)":"([^"]*)".*/vcpu \1  pc=\2  \4/ .cache/t.jsonlexit: 0--- stdout ---vcpu 0  pc=0xffff00000093242c  OSLAR_EL1vcpu 0  pc=0xffff0000009d510c  PSCI_CPU_ONvcpu 0  pc=0xffff0000009d510c  PSCI_VERSIONvcpu 0  pc=0xffff0000009d510c  PSCI_FEATURESvcpu 0  pc=0xffff0000009d510c  SMCCC_VERSIONvcpu 0  pc=0xffff0000009d510c  PSCI_FEATURESvcpu 0  pc=0xffff0000009d510c  SMCCC_VERSIONvcpu 0  pc=0xffff0000009d510c  SMCCC_ARCH_FEATURESvcpu 0  pc=0xffff0000009d510c  SMCCC_ARCH_FEATURESvcpu 0  pc=0xffff0000009d510c  SMCCC_ARCH_FEATURESvcpu 1  pc=0xffff0000009d510c  SMCCC_ARCH_FEATURESvcpu 1  pc=0xffff000000932618  OSLAR_EL1vcpu 0  pc=0xbf69a1b8  PSCI_SYSTEM_OFF
captured: real output, Apple M5 Pro, macOS 27.2.1, commit dad6c99, 2026-11-20
  • The trace written by the run in 22-trace-run.txt; sed keeps the vCPU, the PC and the call or register name of each line.
course/captures/22-trace.txt

Thirteen exits of those three kinds in the whole boot, and every one has a reason. Each CPU unlocks the debug OS lock once (OSLAR_EL1, a system register Hypervisor.framework hands to us). The calls come in an order you might not expect: FreeBSD starts CPU 1 with an early PSCI_CPU_ON, before its psci0 driver attaches and asks PSCI_VERSION. vCPU 1, on its own host thread (chapter 20), then makes one SMCCC_ARCH_FEATURES call of its own, the query a kernel uses to ask which optional calls exist (the smccc primer). Every call comes from the same pc because FreeBSD makes all of them through one helper, so they share one hvc instruction.

The last exit is the interesting one: PSCI_SYSTEM_OFF from pc=0xbf69a1b8. That is not a kernel address (FreeBSD's are the 0xffff… ones). It is inside U-Boot, which copied itself to the top of RAM at start-up and, as UEFI requires, marked its runtime code in the memory map it handed over as off-limits to the operating system. FreeBSD powered off by calling UEFI's runtime service ResetSystem, and U-Boot's code, still resident after the operating system took over, made the PSCI call. Firmware is not finished when the kernel starts.

Writing it down

A compatibility log answers, for one guest version on one VMM version:

  • how far it gets, in one line at the top, with the date and the Mac it was run on;
  • the boot chain, link by link, as you read it above;
  • the latest transcript and trace, and at any blocker, the last lines before it;
  • the root cause of each blocker, with the primary source that decided it;
  • a ranked list of what could go wrong next. The reference's has four: boot entries cannot persist, there is no random-number device at boot (Missing RNG device for EFI_RNG_PROTOCOL, and FreeBSD's arc4random warning), the device-side request cap from the Security note, and a terminal-size query that our serial filter drops (resizewin: timeout reading from terminal, a one-second wait at login).

That list is the model for yours; the reference keeps its own record in docs/compat/freebsd.md. Write it even when everything works. The next guest, or the next FreeBSD release, starts from your list.

Production note

The other stock firmware for this machine is chapter 21's alternative, EDK2's ArmVirtQemu. As that chapter's decision weighed, it keeps its UEFI variables in the second flash bank, which must accept Common Flash Interface (CFI) write and erase commands (it may also want QEMU's configuration device); our flash ignores writes. The project's decision to start with U-Boot is docs/adr/0007-firmware-path-for-freebsd.md; booting FreeBSD through EDK2 is a stretch goal, documented and not required.

Your turn

Before the checkpoint, check in learner/:

  1. Your VMM boots FreeBSD from a fresh clone to login: , uname -sr prints FreeBSD 15.1-RELEASE, and shutdown -p now exits 0, with nothing on standard error but the flash writes.
  2. Your journal has the Predict entry from before you ran breakage 1, and question 2 answered from the sources, not from which guest booted.
  3. learner/docs/compat/freebsd.md exists, with every item from the list above, including the ranked list.

Checkpoint

Checkpoint

Needs a Mac

Run this from the repository root:

scripts/checkpoint.sh 22

You should see, as the last line:

CHECKPOINT 22 PASS

It builds your VMM, boots a fresh clone of the image in a private directory with the run line above, waits for login: , types root, uname -sr and shutdown -p now, and demands exit code 0. It removes U-Boot's escape sequences before it compares the console with its list of required lines, in order, and forbidden ones (vtblk0: host requires unsupported, mountroot>, panic: and the four standard-error messages from the brief). The reference's run:

TerminalReal output
/bin/bash -c set -euo pipefail; cp -c "<repo>/.cache/macvmm/freebsd-15.1-ufs.raw" "{out}/f.raw"; "{macvmm}" run --bios "<repo>/.cache/macvmm/u-boot.bin" --disk "{out}/f.raw" --mem 2G --cpus 2 --timeout 240 --on-reset exit | /usr/bin/perl -e '$|=1; my $c=q(); while (sysread(STDIN, my $b, 4096)) { $b = $c . $b; $c = ($b =~ s/(\e(\[[0-9;?]*)?)\z//) ? $1 : q(); $b =~ s/\e\[[0-9;?]*[A-Za-z]|\e[78]|\r//g; print $b }'exit: 0--- stdout ---Bloblist at 0 not found (err=-2)alloc space exhausted ptr 400 limit 0Bloblist at 0 not found (err=-2)U-Boot 2026.04 (Apr 21 2026 - 09:17:42 +0000)DRAM:  2 GiBusing memory 0xbe65a000-0xbf69a000 for malloc()Core:  15 devices, 9 uclasses, devicetree: boardFlash: 0 BytesLoading Environment from Flash... *** Warning - bad CRC, using default environmentIn:    serial,usbkbdOut:   serial,vidconsoleErr:   serial,vidconsoleNo USB controllers foundNet:   No ethernet found.Hit any key to stop autoboot: 2Hit any key to stop autoboot: 1Hit any key to stop autoboot: 0Scanning for bootflows in all bootdevsSeq  Method       State   Uclass    Part  Name                      Filename---  -----------  ------  --------  ----  ------------------------  ----------------Scanning global bootmeth 'efi_mgr':No EFI variables loadedMissing TPMv2 device for EFI_TCG_PROTOCOLMissing RNG device for EFI_RNG_PROTOCOL  0  efi_mgr      ready   (none)       0  <NULL>                    ** Booting bootflow '<NULL>' with efi_mgrBooting: Label: virtio 0 Device path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)Consoles: EFI console      Reading loader env vars from /efi/freebsd/loader.envSetting currdev to disk0p1:FreeBSD/arm64 EFI loader, Revision 3.0   Command line arguments: loader.efi   Image base: 0xbd460000   EFI version: 2.110   EFI Firmware: Das U-Boot (rev 8230.1024)   Console: efi,comconsole (0)   Load Path: /\EFI\BOOT\BOOTAA64.EFI   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(1,GPT,155e469a-665c-11f1-067b-ff9d86f8dced,0x22,0x10418)   BootCurrent: 0000   BootOrder: 0000[*]   BootInfo Path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)Ignoring Boot0000: Only one DP foundTrying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(1,GPT,155e469a-665c-11f1-067b-ff9d86f8dced,0x22,0x10418)Setting currdev to disk0p1:|\u{8}Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(2,GPT,155e46ae-665c-11f1-1d08-61407e6af4da,0x1043a,0x200000)Setting currdev to disk0p2:/\u{8}Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,8b00000000000000)/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,17008b0000000000)/HD(3,GPT,155e46ae-665c-11f1-17a5-d14fff7c5968,0x21043a,0xa00000)Setting currdev to disk0p3:-\u{8}\\u{8}|\u{8}/\u{8}-\u{8}\\u{8}|\u{8}/\u{8}-\u{8}\\u{8}|\u{8}/\u{8}-\u{8}\\u{8}|\u{8}/\u{8}-\u{8}\\u{8}|\u{8}/\u{8}-\u{8}\\u{8}Loading /boot/defaults/loader.confLoading /boot/defaults/loader.confLoading /boot/device.hintsLoading /boot/loader.conf|\u{8}Loading /boot/loader.conf.local/\u{8}-\u{8}c\\u{8}|\u{8}  ```                        ` s` `.....---.......--.```   -/ +o   .--`         /y:`      +.  yo`:.            :o      `+-   y/               -/`   -o/  .-                  ::/sy+:.  /                     `--  / `:                          :` `:                          :`  /                          /  .-                        -.   --                      -.    `:`                  `:`      .--             `--.         .---.....----.  ```                        ` s` `.....---.......--.```   -/ +o   .--`         /y:`      +.  yo`:.            :o      `+-   y/               -/`   -o/  .-                  ::/sy+:.  /                     `--  / `:                          :` `:                          :`  /                          /  .-                        -.   --                      -.    `:`                  `:`      .--             `--.         .---.....----.  ______               ____   _____ _____   |  ____|             |  _ \ / ____|  __ \  | |___ _ __ ___  ___ | |_) | (___ | |  | | |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | | | |   | | |  __/  __/| |_) |____) | |__| | | |   | | |    |    ||     |      |      | |_|   |_|  \___|\___||____/|_____/|_____/   ______               ____   _____ _____   |  ____|             |  _ \ / ____|  __ \  | |___ _ __ ___  ___ | |_) | (___ | |  | | |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | | | |   | | |  __/  __/| |_) |____) | |__| | | |   | | |    |    ||     |      |      | |_|   |_|  \___|\___||____/|_____/|_____/ ╔╚╗╝════════════════════════════════════════════════════════════════════════════║║║║║║║║║║║║║║║║║║║║║║║║║║ Welcome to FreeBSD ++++----------------------------------------------------------------------------|||||||||||||||||||||||||| Welcome to FreeBSD 1. Boot Multi user [Enter]2. Boot Single user3. Escape to loader prompt4. Reboot5. Cons: VideoKernel:/\u{8}-\u{8}\\u{8}|\u{8}/\u{8}-\u{8}\\u{8}|\u{8}/\u{8}-\u{8}\\u{8}6. kernel (1 of 1)Options:7. Boot OptionsAutoboot in 10 seconds. [Space] to pause Autoboot in 9 seconds. [Space] to pause Autoboot in 8 seconds. [Space] to pause Autoboot in 7 seconds. [Space] to pause Autoboot in 6 seconds. [Space] to pause Autoboot in 5 seconds. [Space] to pause Autoboot in 4 seconds. [Space] to pause Autoboot in 3 seconds. [Space] to pause Autoboot in 2 seconds. [Space] to pause Autoboot in 1 seconds. [Space] to pause Autoboot in 0 seconds. [Space] to pause Loading kernel...|\u{8}/boot/kernel/kernel text=0x318 text=0xa7d088 /\u{8}-\u{8}\\u{8}|\u{8}/\u{8}-\u{8}text=0x284f00 \\u{8}data=0x16c978 |\u{8}data=0x0+0x2c2000 0x8+0x1625d0+0x8+0x18bc59/\u{8}Loading configured modules...-\u{8}can't find '/boot/entropy'can't find '/etc/hostid'Using DTB provided by EFI at 0xbd600000.\\u{8}Loading splash okLoading shutdown splash ok---<<BOOT>>---WARNING: Cannot find freebsd,dts-version property, cannot check DTB complianceCopyright (c) 1992-2025 The FreeBSD Project.Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994	The Regents of the University of California. All rights reserved.FreeBSD is a registered trademark of The FreeBSD Foundation.FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC arm64FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)VT: init without driver.real memory  = 2147483648 (2048 MB)avail memory = 2074775552 (1978 MB)Starting CPU 1 (1)FreeBSD/SMP: Multiprocessor System Detected: 2 CPUsarc4random: WARNING: initial seeding bypassed the cryptographic random device because it was not yet seeded and the knob 'bypass_before_seeding' was enabled.random: entropy device external interfacekbd0 at kbdmux0ofwbus0: <Open Firmware Device Tree>psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0smccc0: <ARM SMCCC v1.1> on psci0cpulist0: <Open Firmware CPU Group> on ofwbus0cpu0: <Open Firmware CPU> on cpulist0gic0: <ARM Generic Interrupt Controller v3.0> mem 0x8000000-0x800ffff,0x80a0000-0x80dffff on ofwbus0generic_timer0: <ARMv8 Generic Timer> irq 0,1,2,3 on ofwbus0Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000smbios0: <System Management BIOS>smbios0: Entry point: v3 (64-bit), Version: 3.7uart0: <PrimeCell UART (PL011)> mem 0x9000000-0x9000fff irq 4 on ofwbus0uart0: console (115200,n,8,1)pl0310: <PL031 RTC> mem 0x9010000-0x9010fff irq 5 on ofwbus0pl0310: registered as a time-of-day clock, resolution 1.000000svirtio_mmio0: <VirtIO MMIO adapter> mem 0xa000000-0xa0001ff irq 6 on ofwbus0vtblk0: <VirtIO Block Adapter> on virtio_mmio0vtblk0: 6176MB (12649563 512 byte sectors)armv8crypto0: <AES-CBC,AES-XTS,AES-GCM>Timecounters tick every 1.000 msecusb_needs_explore_all: no devclassCPU  0: Apple Unknown CPU r0p0 (midr: 610f0000) affinity:  0                   Cache Type = <IDC,64 byte CWG,64 byte ERG,64 byte D-cacheline,PIPT I-cache,64 byte I-cacheline,0x900000000> Instruction Set Attributes 0 = <TLBI-OSR,CondM-8.5,FHM,DP,SHA3,RDM,Atomic,CRC32,SHA2+SHA512,SHA1,AES+PMULL> Instruction Set Attributes 1 = <I8MM,EBF16,PredInv v8.9,SB,FRINTTS,GPI,RCPC-8.4,FCMA,JSCVT,Impl PAuth+FPAC+Combined,DCCVADP> Instruction Set Attributes 2 = <RPRES>         Processor Features 0 = <CSV3,CSV2,PSTATE.DIT,RAS,GIC,AdvSIMD+HP,FP+HP,EL1,EL0>         Processor Features 1 = <MTE_frac,CSV2 p2,SME2,BTI>         Processor Features 2 = <>      Memory Model Features 0 = <ExS,TGran4,TGran16,16bit ASID,1TB PA>      Memory Model Features 1 = <AFP,XNX,SpecSEI,EPAN,LO,HPD+TTPBHA,8bit VMID>      Memory Model Features 2 = <E0PD,TTL,IDS,AT,NV v8.4,32bit CCIDX,48bit VA,IESB,UAO,CnP>      Memory Model Features 3 = <>      Memory Model Features 4 = <>             Debug Features 0 = <DoubleLock,2 CTX BKPTs,4 Watchpoints,6 Breakpoints,Debugv8>             Debug Features 1 = <>         Auxiliary Features 0 = <>         Auxiliary Features 1 = <>AArch32 Instruction Set Attributes 5 = <>AArch32 Media and VFP Features 0 = <>AArch32 Media and VFP Features 1 = <>CPU  1: Apple Unknown CPU r0p0 (midr: 610f0000) affinity:  1gic0: using for IPIsRelease APs...doneTrying to mount root from ufs:/dev/gpt/rootfs [rw,noatime]...TCP_ratelimit: Is now initializedrandom: randomdev_wait_until_seeded unblock waitrandom: unblocking device.Setting hostuuid: dc6be26c-5262-4f68-aa97-f708daee03e8.Setting hostid: 0xddaafb83.Starting file system checks:/dev/gpt/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS/dev/gpt/rootfs: clean, 699397 free (5 frags, 87424 blocks, 0.0% fragmentation)/dev/gpt/efiboot0: FILESYSTEM CLEAN; SKIPPING CHECKSGrowing root partition to fill devicevtbd0 recovering is not neededvtbd0p3 resizedgrowfs: requested size 5.0GB is equal to the current filesystem size 5.0GBMounting local filesystems:.Setting up harvesting: RANDOMDEV,[CALLOUT],[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHEDFeeding entropy: .ELF ldconfig path: /lib /usr/lib /usr/local/lib /usr/local/lib/compat/pkg /usr/local/lib/compat/pkgSetting hostname: freebsd.lo0: link state changed to UPStarting Network: lo0.lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384	options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>	inet 127.0.0.1 netmask 0xff000000	inet6 ::1 prefixlen 128	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1	groups: lo	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>Starting devd.route: message indicates error: File existsadd host 127.0.0.1: gateway lo0 fib 0: route already in tableroute: message indicates error: File existsadd host ::1: gateway lo0 fib 0: route already in tableadd net fe80::: gateway ::1add net ff02::: gateway ::1add net ::ffff:0.0.0.0: gateway ::1add net ::0.0.0.0: gateway ::1Clearing /tmp (X related).Updating motd:.Updating /var/run/os-release done.Creating and/or trimming log files.Starting syslogd.Mounting late filesystems:.Starting cron.Starting background file system checks in 60 seconds.Fri Nov 20 09:57:35 UTC 2026FreeBSD/arm64 (freebsd) (ttyu0)login: rootNov 20 09:57:35 freebsd login[1057]: ROOT LOGIN (root) ON ttyu0FreeBSD 15.1-RELEASE (GENERIC) releng/15.1-n283562-96841ea08dcfWelcome to FreeBSD!Release Notes, Errata: https://www.FreeBSD.org/releases/Security Advisories:   https://www.FreeBSD.org/security/FreeBSD Handbook:      https://www.FreeBSD.org/handbook/FreeBSD FAQ:           https://www.FreeBSD.org/faq/Questions List:        https://www.FreeBSD.org/lists/questions/FreeBSD Forums:        https://forums.FreeBSD.org/Documents installed with the system are in the /usr/local/share/doc/freebsd/directory, or can be installed later with:  pkg install en-freebsd-docFor other languages, replace "en" with a language code like de or fr.Show the version of FreeBSD installed:  freebsd-version ; uname -aPlease include that output and any error messages when posting questions.Introduction to manual pages:  man manFreeBSD directory layout:      man hierTo change this login announcement, see motd(5).resizewin: timeout reading from terminalroot@freebsd:~ # uname -srFreeBSD 15.1-RELEASEroot@freebsd:~ # shutdown -p nowShutdown NOW!shutdown: [pid 1062]root@freebsd:~ #                                                                                \u{7}*** FINAL System shutdown message from root@freebsd ***                      System going down IMMEDIATELY                                                                                                                                 System shutdown time has arrivedNov 20 09:57:37 freebsd shutdown[1062]: power-down by root: Stopping cron.Waiting for PIDS: 1000.Stopping devd.Waiting for PIDS: 537.Writing entropy file: .Writing early boot entropy file: ..Nov 20 09:57:37 freebsd syslogd: exiting on signal 15Waiting (max 60 seconds) for system process `vnlru' to stop... doneWaiting (max 60 seconds) for system process `syncer' to stop... Syncing disks, vnodes remaining... 3 0 doneAll buffers synced.Uptime: 5s--- stderr ---macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x40000000 at offset 0x12c668 (flash is read-only, write 1 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c670 (flash is read-only, write 2 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c678 (flash is read-only, write 3 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 8-byte write of 0x0 at offset 0x12c680 (flash is read-only, write 4 to this bank)macvmm: warn: [vcpu0] guest: flash: ignored 4-byte write of 0x1 at offset 0xed4 (flash is read-only, write 5 to this bank)
captured: run "freebsd-login" of checkpoint 22, captured from the reference on real hardwarecourse/captures/22-freebsd-login.txt

What now works:

  • a second operating system boots on your VMM through firmware, UEFI and its own loader, on two CPUs, to a login, and powers off cleanly;
  • you can follow a boot through four programs and say which one spoke last when it stops;
  • you decide "our machine or the guest?" from the specification, the guest's source and QEMU virt, not from which guest happens to boot;
  • your compatibility log says exactly how far FreeBSD gets and what could break next.

The next chapter starts from this state (the reference at the end of chapter 22).

What's next

Part X turns to macOS as a guest. Chapter 23 takes the high road first: Apple's own Virtualization.framework, which chapter 00 set aside, where Apple supplies the firmware and every device. You boot chapter 14's kernel and test initramfs on it, see a different machine's contract change the result, and list what a VMM like ours would have to provide before macOS would run on it.

Open question

The checkpoint logs in, runs one command and powers off. It never writes a file and reads it back after a reboot, never sleeps for a measured time, never runs for an hour. What evidence would convince you that a FreeBSD boot is "working" and not merely "printing"?

Spec hunt

  • Virtio 1.2 specification, section 2.2 Feature Bits and section 5.2.3 (virtio-blk Feature bits): who decides which features a device offers, and what may a driver do with a device whose offer it cannot honour?
  • UEFI specification 2.11, section 3.5.1.1 Removable Media Boot Behavior, and the runtime service ResetSystem(): why is FreeBSD's loader at \EFI\BOOT\BOOTAA64.EFI, and what did U-Boot do when FreeBSD asked it to power off?
  • FreeBSD source, sys/dev/virtio/block/virtio_blk.c, function vtblk_attach, and Linux's Documentation/devicetree/bindings/arm/primecell.yaml: which properties and features does each guest require, and which does it ignore?
Progress is stored only in this browser.