#[derive(Default)]
#[repr(C, packed)]
pub struct Init2 {
vmsa_features: u64,
flags: u32,
ghcb_version: u16,
pad1: u16,
pad2: [u32; 8],
}
impl Init2 {
#[cfg(feature = "sev")]
pub fn init_default_sev() -> Self {
Self {
vmsa_features: 0,
flags: 0,
ghcb_version: 0,
pad1: Default::default(),
pad2: Default::default(),
}
}
#[cfg(feature = "sev")]
pub fn init_default_es() -> Self {
Self {
vmsa_features: 0x1,
flags: 0,
ghcb_version: 1,
pad1: Default::default(),
pad2: Default::default(),
}
}
#[cfg(feature = "snp")]
pub fn init_default_snp() -> Self {
Self {
vmsa_features: 0,
flags: 0,
ghcb_version: 2,
pad1: Default::default(),
pad2: Default::default(),
}
}
}