mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-08 13:55:19 +00:00
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
@ -7,7 +7,8 @@ version = "0.1.0"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
kvm = ["kvm-bindings", "kvm-ioctls", "vfio-ioctls/kvm"]
|
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"]
|
sev_snp = ["igvm", "igvm_defs"]
|
||||||
tdx = []
|
tdx = []
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
// Copyright © 2020, Microsoft Corporation
|
// 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 emulator;
|
||||||
pub mod gdt;
|
pub mod gdt;
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
|
@ -202,7 +202,10 @@ pub enum StandardRegisters {
|
|||||||
Kvm(kvm_bindings::kvm_regs),
|
Kvm(kvm_bindings::kvm_regs),
|
||||||
#[cfg(all(feature = "kvm", target_arch = "riscv64"))]
|
#[cfg(all(feature = "kvm", target_arch = "riscv64"))]
|
||||||
Kvm(kvm_bindings::kvm_riscv_core),
|
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),
|
Mshv(mshv_bindings::StandardRegisters),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +218,7 @@ macro_rules! set_x86_64_reg {
|
|||||||
match self {
|
match self {
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(feature = "kvm")]
|
||||||
StandardRegisters::Kvm(s) => s.$reg_name = val,
|
StandardRegisters::Kvm(s) => s.$reg_name = val,
|
||||||
#[cfg(feature = "mshv")]
|
#[cfg(any(feature = "mshv", feature = "mshv_emulator"))]
|
||||||
StandardRegisters::Mshv(s) => s.$reg_name = val,
|
StandardRegisters::Mshv(s) => s.$reg_name = val,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,7 +236,7 @@ macro_rules! get_x86_64_reg {
|
|||||||
match self {
|
match self {
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(feature = "kvm")]
|
||||||
StandardRegisters::Kvm(s) => s.$reg_name,
|
StandardRegisters::Kvm(s) => s.$reg_name,
|
||||||
#[cfg(feature = "mshv")]
|
#[cfg(any(feature = "mshv", feature = "mshv_emulator"))]
|
||||||
StandardRegisters::Mshv(s) => s.$reg_name,
|
StandardRegisters::Mshv(s) => s.$reg_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user