Expand description
s9vm : guest boot parameters (firmware hand-off block).
bootinfo is the compact s9vm-specific boot page.
A real operating-system guest needs a richer hand-off: the physical memory
map, the kernel command line, initrd/module ranges, console and device
hints, and the RSDP pointer of the firmware tables built by
acpi. This module defines that block.
The block has a fixed 1024-byte little-endian layout with a magic, a version, counts, a byte checksum (all the bytes of the block sum to zero modulo 256) and fixed-capacity arrays. Encoding and decoding are pure code and allocate nothing, so the kernel fills a stack buffer and copies it into guest memory, and a guest can validate the block with a single linear sum.
§Layout
| Offset | Size | Field |
|---|---|---|
0x000 | 8 | magic S9VMBP\0\0 (little-endian u64) |
0x008 | 4 | version (VERSION) |
0x00C | 4 | block size (SIZE) |
0x010 | 4 | boot flags |
0x014 | 4 | memory entry count (<= 32) |
0x018 | 4 | module count (<= 4) |
0x01C | 4 | command-line length (<= 256) |
0x020 | 8 | ACPI RSDP guest-physical address (0 = absent) |
0x028 | 8 | console MMIO base (virtio-mmio transport page) |
0x030 | 4 | console I/O APIC line |
0x034 | 1 | checksum |
0x035 | 3 | reserved, zero |
0x038 | 640 | memory map: 32 entries of 20 packed bytes |
0x2B8 | 64 | modules: 4 entries of 16 packed bytes |
0x2F8 | 256 | command line, NUL padded |
0x3F8 | 8 | reserved, zero |
A memory entry is base: u64, len: u64, kind: u32; a module entry is
base: u64, len: u64. Entries and the entry count are the only source of
truth: unused trailing bytes are zero and must be ignored by readers.
The command line is not NUL-terminated: its length is authoritative and the remaining bytes of the 256-byte field are NUL padding, so a 256-byte command line uses the whole field with no terminator.
§Invariants
- the magic, the version and the size match this module;
- the checksum of the whole block is zero;
memory_count <= MAX_MEMORY_ENTRIES,module_count <= MAX_MODULE_ENTRIESandcmdline_len <= CMDLINE_MAX;- every memory entry uses one of the
memory_kindvalues; - every flag set in
BootParams::flagsbelongs toflags.
This module is pure core code and is host-tested by s9vm-tests.
Modules§
- flags
- Boot flags.
- memory_
kind - Kind of a memory map entry.
Structs§
- Boot
Params - Guest boot parameters block.
- Memory
Entry - One memory map entry.
- Module
Entry - One initrd/module entry.
Enums§
- Boot
Params Error - Decoding and construction errors.
Constants§
- CMDLINE_
MAX - Maximum length of the inline kernel command line, in bytes.
- CMDLINE_
OFFSET - Offset of the inline command line.
- MAGIC
- Magic value: the ASCII bytes
S9VMBPfollowed by two NUL bytes, read as a little-endianu64. - MAX_
MEMORY_ ENTRIES - Maximum number of memory map entries.
- MAX_
MODULE_ ENTRIES - Maximum number of initrd/module entries.
- MEMORY_
ENTRY_ SIZE - Wire size of one memory map entry:
base: u64,len: u64,kind: u32. - MEMORY_
OFFSET - Offset of the memory map, packed entries of
MEMORY_ENTRY_SIZEbytes. - MODULE_
ENTRY_ SIZE - Wire size of one module entry:
base: u64,len: u64. - MODULE_
OFFSET - Offset of the module table, packed entries of
MODULE_ENTRY_SIZEbytes. - OFF_
CHECKSUM - Offset of the checksum byte.
- OFF_
CMDLINE_ LEN - Offset of the command-line length field.
- OFF_
CONSOLE_ IRQ - Offset of the console I/O APIC line field.
- OFF_
CONSOLE_ MMIO - Offset of the console MMIO base field.
- OFF_
FLAGS - Offset of the boot flags field.
- OFF_
MAGIC - Offset of the magic field.
- OFF_
MEMORY_ COUNT - Offset of the memory entry count field.
- OFF_
MODULE_ COUNT - Offset of the module count field.
- OFF_
RSDP_ GPA - Offset of the ACPI RSDP address field.
- OFF_
SIZE - Offset of the block size field.
- OFF_
VERSION - Offset of the version field.
- SIZE
- Total size of the block, in bytes.
- VERSION
- Layout version.