vmm: AArch64: add methods to get saved vCPU states
The construction of `GICR_TYPER` register will need vCPU states.
Therefore this commit adds methods to extract saved vCPU states
from the cpu manager.
@@ -328,6 +328,12 @@ impl Vcpu {
self.mpidr
}
+ /// Gets the saved vCPU state.
+ #[cfg(target_arch = "aarch64")]
+ pub fn get_saved_state(&self) -> Option<CpuState> {
+ 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<CpuState> {
+ 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.
