hypervisor: Add VmExit::Debug for x86/KVM

This commit adds `VmExit::Debug` for x86/KVM. When the guest hits a
hardware breakpoint, `VcpuExit::Debug` vm exit occurs. This vm exit
will be handled with code implemented in the following commits.

Signed-off-by: Akira Moroo <retrage01@gmail.com>
This commit is contained in:
Akira Moroo 2022-01-30 19:26:32 +09:00 committed by Rob Bradford
parent 9f27954fbd
commit 9f111388c0
2 changed files with 4 additions and 0 deletions

View File

@ -266,6 +266,8 @@ pub enum VmExit<'a> {
Hyperv, Hyperv,
#[cfg(feature = "tdx")] #[cfg(feature = "tdx")]
Tdx, Tdx,
#[cfg(feature = "kvm")]
Debug,
} }
/// ///

View File

@ -1074,6 +1074,8 @@ impl cpu::Vcpu for KvmVcpu {
VcpuExit::Hyperv => Ok(cpu::VmExit::Hyperv), VcpuExit::Hyperv => Ok(cpu::VmExit::Hyperv),
#[cfg(feature = "tdx")] #[cfg(feature = "tdx")]
VcpuExit::Unsupported(KVM_EXIT_TDX) => Ok(cpu::VmExit::Tdx), VcpuExit::Unsupported(KVM_EXIT_TDX) => Ok(cpu::VmExit::Tdx),
VcpuExit::Debug(_) => Ok(cpu::VmExit::Debug),
r => Err(cpu::HypervisorCpuError::RunVcpu(anyhow!( r => Err(cpu::HypervisorCpuError::RunVcpu(anyhow!(
"Unexpected exit reason on vcpu run: {:?}", "Unexpected exit reason on vcpu run: {:?}",
r r