MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / get_cpu_vendor

Method get_cpu_vendor

hypervisor/src/hypervisor.rs:162–181  ·  view source on GitHub ↗

Determine CPU vendor

(&self)

Source from the content-addressed store, hash-verified

160 /// Determine CPU vendor
161 ///
162 fn get_cpu_vendor(&self) -> CpuVendor {
163 #[allow(unused_unsafe)]
164 // SAFETY: not actually unsafe, but considered unsafe by current stable
165 unsafe {
166 let leaf = x86_64::__cpuid(0x0);
167
168 if leaf.ebx == 0x756e_6547 && leaf.ecx == 0x6c65_746e && leaf.edx == 0x4965_6e69 {
169 // Vendor string GenuineIntel
170 CpuVendor::Intel
171 } else if leaf.ebx == 0x6874_7541 && leaf.ecx == 0x444d_4163 && leaf.edx == 0x6974_6e65
172 {
173 // Vendor string AuthenticAMD
174 CpuVendor::AMD
175 } else {
176 // Not known yet, the corresponding manufacturer manual should contain the
177 // necessary info. See also https://wiki.osdev.org/CPUID#CPU_Vendor_ID_String
178 CpuVendor::default()
179 }
180 }
181 }
182
183 /// This function enables the AMX related TILECFG and TILEDATA state components for guests.
184 ///

Callers 3

newMethod · 0.80
create_vcpuMethod · 0.80

Implementers 2

mod.rshypervisor/src/mshv/mod.rs
mod.rshypervisor/src/kvm/mod.rs

Calls

no outgoing calls

Tested by

no test coverage detected