diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 45556bbb1..05e522fe0 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -328,6 +328,12 @@ impl Vcpu { self.mpidr } + /// Gets the saved vCPU state. + #[cfg(target_arch = "aarch64")] + pub fn get_saved_state(&self) -> Option { + self.saved_state.clone() + } + /// Runs the VCPU until it exits, returning the reason. /// /// Note that the state of the VCPU and associated VM must be setup first for this to do @@ -1041,6 +1047,14 @@ impl CpuManager { .collect() } + #[cfg(target_arch = "aarch64")] + pub fn get_saved_states(&self) -> Vec { + self.vcpus + .iter() + .map(|cpu| cpu.lock().unwrap().get_saved_state().unwrap()) + .collect() + } + #[cfg(feature = "acpi")] pub fn create_madt(&self) -> SDT { // This is also checked in the commandline parsing.