Project

General

Profile

Feature #16430

Updated by Joshua M. Clulow about 2 months ago

On x86 systems, **determine_platform()** will use various mechanisms to identify the kind of environment in which the OS is running.    In particular, this is either **HW_NATIVE** (usually bare metal, though could still be some unacknowledged emulated system), or one of various known hypervisors (e.g., VMware, KVM, etc). 

 Because the contents that we store in **platform_type** are clearly arranged as a bitfield, one would be forgiven for thinking that you could be on more than one platform at once.    This is a nonsense, though: though; in reality it seems that the bitfield was used so that one could use the **HW_VIRTUAL** mask to cover fully virtualised hypervisor environments.    Notably this mask does not cover **HW_XEN_PV**, which _is_ a virtualised environment, but I suppose not in the way we usually mean; at any rate, "that planet is one of those scheduled for demolition.":https://github.com/illumos/ipd/blob/master/ipd/0023/README.md 

 So that people can be clear on the state of things here, we should redo these values as an enumeration.    We should also replace the use of the @(get_hwenv() **(get_hwenv() & HW_VIRTUAL)@ HW_VIRTUAL)** pattern with a separate symbol that clearly describes what we're looking for; e.g., **bool is_hypervisor(void)**.

Back