hypervisor: implement get_suspend_regs for MSHV vcpu trait

This vcpu API is necessary for MSHV related debugging.
These two registers controls the vcpu_run in the
/dev/mshv driver code.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2021-06-17 15:50:36 -07:00
committed by Bo Chen
parent cff190fa5f
commit 5cd82cb2e2
3 changed files with 23 additions and 2 deletions

View File

@@ -534,6 +534,15 @@ impl cpu::Vcpu for MshvVcpu {
Ok(r)
}
#[cfg(target_arch = "x86_64")]
///
/// X86 specific call that returns the vcpu's current "suspend registers".
///
fn get_suspend_regs(&self) -> cpu::Result<SuspendRegisters> {
self.fd
.get_suspend_regs()
.map_err(|e| cpu::HypervisorCpuError::GetSuspendRegs(e.into()))
}
}
struct MshvEmulatorContext<'a> {

View File

@@ -19,8 +19,8 @@ pub use {
mshv_bindings::FloatingPointUnit as FpuState, mshv_bindings::LapicState,
mshv_bindings::MsrList, mshv_bindings::Msrs as MsrEntries, mshv_bindings::Msrs,
mshv_bindings::SegmentRegister, mshv_bindings::SpecialRegisters,
mshv_bindings::StandardRegisters, mshv_bindings::VcpuEvents, mshv_bindings::XSave as Xsave,
mshv_bindings::Xcrs as ExtendedControlRegisters,
mshv_bindings::StandardRegisters, mshv_bindings::SuspendRegisters, mshv_bindings::VcpuEvents,
mshv_bindings::XSave as Xsave, mshv_bindings::Xcrs as ExtendedControlRegisters,
};
#[derive(Clone, Serialize, Deserialize)]