hypervisor: introduce an mshv_emulator feature
This will become useful when we build the fuzzing target for the instruction emulator, because there is no need to pull in the rest of the hypervisor crate in that situation. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
73e1451a12
commit
fe24a7a24f
3 changed files with 9 additions and 5 deletions
|
|
@ -7,7 +7,8 @@ version = "0.1.0"
|
|||
|
||||
[features]
|
||||
kvm = ["kvm-bindings", "kvm-ioctls", "vfio-ioctls/kvm"]
|
||||
mshv = ["iced-x86", "mshv-bindings", "mshv-ioctls", "vfio-ioctls/mshv"]
|
||||
mshv = ["mshv-bindings", "mshv-ioctls", "mshv_emulator", "vfio-ioctls/mshv"]
|
||||
mshv_emulator = ["iced-x86", "mshv-bindings"]
|
||||
sev_snp = ["igvm", "igvm_defs"]
|
||||
tdx = []
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// Copyright © 2020, Microsoft Corporation
|
||||
//
|
||||
|
||||
#[cfg(all(feature = "mshv", target_arch = "x86_64"))]
|
||||
#[cfg(all(feature = "mshv_emulator", target_arch = "x86_64"))]
|
||||
pub mod emulator;
|
||||
pub mod gdt;
|
||||
#[allow(non_camel_case_types)]
|
||||
|
|
|
|||
|
|
@ -202,7 +202,10 @@ pub enum StandardRegisters {
|
|||
Kvm(kvm_bindings::kvm_regs),
|
||||
#[cfg(all(feature = "kvm", target_arch = "riscv64"))]
|
||||
Kvm(kvm_bindings::kvm_riscv_core),
|
||||
#[cfg(all(feature = "mshv", target_arch = "x86_64"))]
|
||||
#[cfg(all(
|
||||
any(feature = "mshv", feature = "mshv_emulator"),
|
||||
target_arch = "x86_64"
|
||||
))]
|
||||
Mshv(mshv_bindings::StandardRegisters),
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +218,7 @@ macro_rules! set_x86_64_reg {
|
|||
match self {
|
||||
#[cfg(feature = "kvm")]
|
||||
StandardRegisters::Kvm(s) => s.$reg_name = val,
|
||||
#[cfg(feature = "mshv")]
|
||||
#[cfg(any(feature = "mshv", feature = "mshv_emulator"))]
|
||||
StandardRegisters::Mshv(s) => s.$reg_name = val,
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +236,7 @@ macro_rules! get_x86_64_reg {
|
|||
match self {
|
||||
#[cfg(feature = "kvm")]
|
||||
StandardRegisters::Kvm(s) => s.$reg_name,
|
||||
#[cfg(feature = "mshv")]
|
||||
#[cfg(any(feature = "mshv", feature = "mshv_emulator"))]
|
||||
StandardRegisters::Mshv(s) => s.$reg_name,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue