From 3e6b0a5eabe9dd9b3d752d2fa806aa7e858d3182 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Sun, 21 Aug 2022 16:36:02 +0000 Subject: [PATCH] vmm: unify TranslateVirtualAddress error for both x86_64 and aarch64 Using anyhow::Error should cover both architectures. Signed-off-by: Wei Liu --- vmm/src/cpu.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 197799567..32e3ecabf 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -155,11 +155,7 @@ pub enum Error { #[error("Error during CPU debug: {0}")] CpuDebug(#[source] hypervisor::HypervisorCpuError), - #[cfg(all(target_arch = "x86_64", feature = "gdb"))] - #[error("Error translating virtual address: {0}")] - TranslateVirtualAddress(#[source] hypervisor::HypervisorCpuError), - - #[cfg(all(target_arch = "aarch64", feature = "gdb"))] + #[cfg(feature = "gdb")] #[error("Error translating virtual address: {0}")] TranslateVirtualAddress(#[source] anyhow::Error), @@ -1505,7 +1501,7 @@ impl CpuManager { .unwrap() .vcpu .translate_gva(gva, /* flags: unused */ 0) - .map_err(Error::TranslateVirtualAddress)?; + .map_err(|e| Error::TranslateVirtualAddress(e.into()))?; Ok(gpa) }