1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! CPUID for the detection that reads it, on every x86 backend. `__cpuid` needs
//! no privilege and touches no memory; every leaf read here is checked against
//! the highest leaf the processor reports.
use ;
use ;
/// The bit CPUID leaf 1 sets in ECX under a hypervisor.
const HYPERVISOR_BIT: u32 = 1 << 31;
const HYPERVISOR_LEAF: u32 = 0x4000_0000;
/// Hyper-V's partition privilege flags (Hypervisor TLFS).
const HYPERV_FEATURES_LEAF: u32 = 0x4000_0003;
/// `CreatePartitions`, set only for the root partition: bit 0 of EBX.
const CREATE_PARTITIONS: u32 = 1;
// `__cpuid` is `unsafe` on the oldest supported toolchain and safe on newer ones.
/// The hypervisor's vendor signature, when CPUID says there is one.
pub
/// Whether this is Hyper-V's root partition: a Windows host with Hyper-V, WSL 2,
/// or VBS, not a VM (E-46).
pub
/// The processor's family, model, and stepping: CPUID leaf 1 EAX.
pub