Expand description
s9vm : machine-code payloads used by the host-side smoke tests.
The payloads live in a pure module so they can be decoded by the kernel’s own instruction decoder in a host test, not only executed on a machine that exposes hardware virtualization. A wrong payload encoding otherwise only shows up as a triple fault at boot: the guest walks into zero-filled memory and faults far away from the real problem, which is expensive to diagnose on hardware.
The guestos phase payload is deliberately not stored here: it is
assembled at run time by crate::s9vm::guestprog::guestos, so every
instruction is a typed encoding that the host tests re-decode. The arrays
below remain hand-written for the phases that predate the assembler.
§Loader payload
LOADER_CODE is the guest program of the image-loader phase: publish the
marker on the debug port, then halt.
| Bytes | Instruction |
|---|---|
B0 <marker> | mov al, marker |
E6 E9 | out 0xE9, al |
F4 | hlt |
The I/O instruction uses the immediate-port form on purpose: in 64-bit
mode BA is MOV r32, imm32 (five bytes), not MOV DX, imm16; the
register-port form would need a 66 operand-size prefix. A first version of
this payload used BA E9 00 EE F4, which the processor decoded as
mov edx, 0xF4EE00E9: the guest then ran into the zero-filled tail of its
page and triple-faulted at the page boundary.
Constants§
- ACPI_
CODE - Guest program of the ACPI-discovery phase.
- ACPI_
FAIL_ MARKER - Byte published by the ACPI-discovery guest when a check failed.
- ACPI_
FAIL_ TAIL - Offset of the failure tail (failure marker +
hlt) insideACPI_CODE. - ACPI_
MARKER - Byte published by the ACPI-discovery guest when every check passed.
- ACPI_
SUCCESS_ TAIL - Offset of the success tail (marker + count +
hlt) insideACPI_CODE. - DEBUG_
PORT - I/O port the loader-phase guest writes its marker to.
- HLT
hltopcode, the last instruction of every payload.- LOADER_
CODE - Guest program of the image-loader phase (see the module documentation).
- LOADER_
MARKER - Byte published by the loader-phase guest on the debug port.
- SMP_
CODE_ 0 - Guest program of the first vCPU of the SMP phase.
- SMP_
CODE_ 1 - Guest program of the second vCPU of the SMP phase.
- SMP_
HLT_ OFFSET - Offset of the final
hltinsideSMP_CODE_0andSMP_CODE_1. - SMP_
MARKERS - Per-vCPU markers published by the SMP payloads (
[vcpu0, vcpu1]). - SMP_
OUT_ INSTRUCTION_ LEN - Length of the
outinstruction in the SMP payloads (out 0xE9, al). - SMP_
SHARED_ GPA - Guest-physical page shared by both vCPUs of the SMP phase.