HomeFreeBSD

x86: Distinguish Xen from non-Xen PVH boots

Description

x86: Distinguish Xen from non-Xen PVH boots

The PVH boot protocol, introduced by Xen, is now used by some non-Xen
platforms (e.g. the Firecracker VM) as well. In order to accommodate
these, we use CPUID to detect Xen and only perform Xen-specific setup
when running on that platform.

The "isxen" function duplicates some work done by identcpu.c later in
the boot process; but we need it here since this is the very first C
code which runs when PVH booting (even before hammer_time).

In many places the existing code had

xc_printf(...);
HYPERVISOR_shutdown(SHUTDOWN_crash);

making use of Xen functionality to print a message and shut down; in
the places where this idiom can be reached in the non-xen case, we
replace it idiom with a CRASH(...) macro which calls those in the Xen
case and halts in the non-Xen case.

Reviewed by: royger
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D35801

Details

Provenance
cpercivaAuthored on Jul 13 2022, 12:46 AM
Reviewer
royger
Differential Revision
D35801: x86: Distinguish Xen from non-Xen PVH boots
Parents
rG023a025b5cb1: x86: Add support for PVH version 1 memmap
Branches
Unknown
Tags
Unknown