Primers
Primers
Short, standalone tutorials on the ideas the course uses but does not build: calling conventions, file formats, page tables, firmware. Each takes 15 to 30 minutes. A chapter names the primers it needs in its "Concepts you'll need" box.
OS basics: processes, memory, syscalls, interrupts
process and exit status; privilege (user versus kernel); virtual memory and page faults; the syscall at the hardware level: the mode switch, the PC jumping to a kernel entry address taken from a table of handler addresses (the exception vector table), and the return address saved in a register, not on a stack, on Arm; interrupts; what firmware and a kernel do at boot ("firmware is the program the CPU runs first; it sets up the hardware, then loads and starts the kernel, and stays behind to answer a few requests such as power-off").
~30 min · first needed in chapter 00
Code signing and entitlements
Need to know (10 minutes): "macOS will not let an unsigned program use the virtualization hardware; we sign ours ad hoc with one permission, com.apple.security.hypervisor, and the kernel checks it when we call", plus how to read codesign -d --entitlements -. Going deeper (optional until chapter 19 and chapter 25): ad-hoc signing, entitlements, why com.apple.security.hypervisor is checked at run time, the hardened runtime and why DYLD_* injection matters, restricted entitlements and provisioning profiles (com.apple.vm.networking), and a plain statement that macvmm needs no SIP change and no sudo, with the reason
~20 min · first needed in chapter 01
Reading AArch64: registers, instructions, byte order
general registers, xN/wN, register 31 as xzr or sp, pc, lr; the AAPCS64 argument and result registers (x0 to x7, x0); system-register naming (MRS/MSR, _ELn); fixed 32-bit instruction words and their fields; the dozen instructions in our traces; reading a disassembly; byte order
~30 min · first needed in chapter 02
SMCCC: the calling convention for calls to a higher level
SMC Calling Convention: function-ID fields, conduits, registers as the API (builds on AAPCS64 from aarch64-reading)
~20 min · first needed in chapter 03
Bare-metal Rust: no_std, linker scripts, flat binaries
what no_std and no_main remove; target triples and rustup target add; the sections a linker produces (.text, .rodata, .data, .bss); a linker script that puts _start at 0x4008_0000; load versus run address; BSS and stack; ELF to flat binary with objcopy
~25 min · first needed in chapter 03
Page granules: 4 KiB and 16 KiB
4 KiB and 16 KiB granules; stage 1 belongs to the guest, stage 2 to HVF, and they are independent
~15 min · first needed in chapter 04
Page tables: stage-1 translation
stage-1 translation: VA split, TTBR0/1, TCR, levels, descriptors, MMU on and off; memory attributes (Normal versus Device memory, MAIR_EL1, cacheability) in one section
~30 min · first needed in chapter 05
Caches and coherency
cache lines, data versus instruction caches, Point of Coherency and Point of Unification, clean and invalidate, CTR_EL0.DIC/IDC, cacheable versus Device memory, what booting.rst means by "cleaned to PoC"; ends with the two evidence experiments (MMU-off memtest, the BRK I-cache test) and says which result was observed
~20 min · first needed in chapter 13
The arm64 boot protocol
Documentation/arch/arm64/booting.rst: registers, MMU and cache state, placement; marks which part chapter 06 (MMU and caches), chapter 10 (x0) and chapter 13 (everything) need
~25 min · first needed in chapter 06
Reading the ARM ARM and other primary specs
how the ARM ARM (DDI 0487) is organised, a register page and its field tables, the ESR ISS tables, pseudocode conventions, and the vocabulary RAZ/WI, RES0/RES1, UNDEFINED, UNKNOWN, IMPLEMENTATION DEFINED; a short section on virtio's MUST/SHOULD and the DT spec's chapter 5
~25 min · first needed in chapter 07
Host concurrency: threads, locks, atomics
threads and per-thread state, timer-driven preemption and file descriptors; threads in Rust, Arc, Mutex, Condvar (spurious wake-ups and the predicate loop), thread::scope, channels, atomics as flags with SeqCst, deadlock and a fixed lock order; what the borrow checker proves about data races and what it leaves to you
~30 min · first needed in chapter 09
Unix signals: who decides how a program ends
what a signal is, default actions, exit status 128 + n, async-signal safety, the self-pipe trick; SIGINT, SIGTERM and SIGUSR1 as macvmm uses them
~15 min · first needed in chapter 09
TTYs, termios and escape sequences: who owns your keystrokes
TTY, pty and script; canonical versus raw mode, echo, how the line discipline turns Ctrl-C into SIGINT, stty -g; escape sequences (CSI, OSC, DCS) and why bytes from a guest can change, query or spoof the host terminal
~20 min · first needed in chapter 09
PrimeCell peripheral IDs
AMBA PrimeCell and Peripheral ID registers at 0xFE0, how Linux matches on them
~15 min · first needed in chapter 09
ELF: the file the linker hands you
ELF64 headers and program headers, filesz versus memsz
~20 min · first needed in chapter 13
cpio and the initramfs
newc cpio, how the kernel unpacks an initramfs
~15 min · first needed in chapter 13
EFI zboot: the kernel that is also a program
why Alpine's vmlinuz-virt is an EFI zboot wrapper, and how cargo xtask unzboot gets the Image; gzip (RFC 1952) as a container; one page on UEFI applications and the PE/COFF header, pointing at uefi for the rest
~20 min · first needed in chapter 13
The Linux boot sequence
from the first instruction at the Image entry to /init: early console, MMU on, DT unflattening, driver binding by compatible, clocksource and delay calibration, initcalls, initramfs unpacking, /init and BusyBox, dmesg; kernel modules and Alpine's modloop; each stage mapped to the boot-log lines learners will see
~30 min · first needed in chapter 14
Memory ordering and barriers
weak memory on arm64, acquire and release, fences, paired barriers, the lost-wakeup race, the doorbell as a synchronisation point; starts from the atomics of host-concurrency
~30 min · first needed in chapter 16
Block storage: disk images, ext4, durability
sectors and raw images (versus qcow2), a filesystem on a whole disk, ext4 in one picture (superblock, journal), mkfs and e2fsck, mounting and root=, the page cache, fsync versus F_FULLFSYNC on macOS, pread/pwrite, advisory file locks (flock, fcntl), APFS clones (cp -c)
~30 min · first needed in chapter 18
Unix domain sockets: a wire between two programs, named by a file
Unix domain sockets, stream versus datagram (message boundaries), the filesystem path and its permissions (0600, a 0700 directory), stale socket files and why macvmm replaces only a socket it owns, why no entitlement is needed
~15 min · first needed in chapter 19
UEFI: the interface between firmware and an OS loader
UEFI as an interface, not a program: boot services versus runtime services, EFI applications as PE/COFF images, the EFI system partition, configuration tables (how a DTB or ACPI reaches the OS), where U-Boot's bootefi and EDK2 fit
~25 min · first needed in chapter 21
U-Boot: the firmware we run first
what U-Boot does, its prompt, bootefi, virtio scan, its environment; assumes uefi
~20 min · first needed in chapter 21
The macOS sandbox, rlimits and other one-way doors
Seatbelt and SBPL in brief, sandbox-exec versus sandbox_init, (deny default) and the operation classes macvmm denies (file, network, process-exec, mach-lookup, iokit-open); resource limits (RLIMIT_CORE, RLIMIT_NOFILE) and core dumps; umask, O_CLOEXEC, and why the run path never uses fork/exec; which parts are undocumented and what was observed
~25 min · first needed in chapter 25