diff options
Diffstat (limited to 'hypervisor/src/lib.rs')
-rw-r--r-- | hypervisor/src/lib.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/hypervisor/src/lib.rs b/hypervisor/src/lib.rs new file mode 100644 index 0000000..056070b --- /dev/null +++ b/hypervisor/src/lib.rs @@ -0,0 +1,25 @@ +// Copyright 2020 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! A crate for abstracting the underlying kernel hypervisor used in crosvm. +pub mod caps; +pub mod kvm; +pub mod types; + +use sys_util::Result; + +pub use crate::caps::*; +pub use crate::types::*; + +/// A trait for managing the underlying cpu information for the hypervisor and to check its capabilities. +trait Hypervisor { + // Checks if a particular `HypervisorCap` is available. + fn check_capability(&self, cap: &HypervisorCap) -> bool; + // Get the system supported CPUID values. + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn get_supported_cpuid(&self) -> Result<CpuId>; + // Get the system emulated CPUID values. + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + fn get_emulated_cpuid(&self) -> Result<CpuId>; +} |