⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

VmSnapshot

Struct VmSnapshot 

Source
pub struct VmSnapshot {
    pub header: SnapshotHeader,
    pub regions: Vec<SnapshotRegionDescriptor>,
    pub vmcs_states: Vec<SerializedVmcs>,
    pub register_states: Vec<GuestRegisters>,
    pub msr_states: Vec<Vec<MsrEntry>>,
    pub lapic_states: Vec<LapicSnapshot>,
    pub memory_page_indices: Vec<u64>,
    pub device_states: Vec<DeviceStateBlob>,
}
Expand description

Complete VM snapshot (in-memory representation)

Fields§

§header: SnapshotHeader

Snapshot header

§regions: Vec<SnapshotRegionDescriptor>

Region descriptors

§vmcs_states: Vec<SerializedVmcs>

Serialized VMCS per vCPU

§register_states: Vec<GuestRegisters>

General register state per vCPU

§msr_states: Vec<Vec<MsrEntry>>

MSR values per vCPU

§lapic_states: Vec<LapicSnapshot>

LAPIC state per vCPU (serialized as raw register values)

§memory_page_indices: Vec<u64>

Dirty page indices (pages included in snapshot)

§device_states: Vec<DeviceStateBlob>

Device state blobs

Implementations§

Source§

impl VmSnapshot

Source

pub fn new( vm_id: u64, vcpu_count: u32, memory_pages: u64, timestamp: u64, ) -> Self

Create a new empty snapshot

Source

pub fn add_register_state(&mut self, vcpu_idx: u32, regs: GuestRegisters)

Add register state for a vCPU

Source

pub fn add_vmcs_state(&mut self, vcpu_idx: u32, vmcs: SerializedVmcs)

Add VMCS state for a vCPU

Source

pub fn add_msr_state(&mut self, vcpu_idx: u32, msrs: Vec<MsrEntry>)

Add MSR state for a vCPU

Source

pub fn add_lapic_state(&mut self, vcpu_idx: u32, lapic: &VirtualLapic)

Add LAPIC state for a vCPU

Source

pub fn add_memory_page(&mut self, page_index: u64)

Add a memory page to the snapshot

Source

pub fn add_device_state(&mut self, name: String, data: Vec<u8>)

Add device state blob

Source

pub fn finalize(&mut self)

Finalize snapshot: compute total size and checksum

Source

pub fn validate(&self) -> bool

Validate snapshot header

Source

pub fn region_count(&self) -> usize

Source

pub fn memory_page_count(&self) -> usize

Source

pub fn vcpu_state_count(&self) -> usize

Source

pub fn device_state_count(&self) -> usize

Auto Trait Implementations§

§

impl Freeze for VmSnapshot

§

impl RefUnwindSafe for VmSnapshot

§

impl Send for VmSnapshot

§

impl Sync for VmSnapshot

§

impl Unpin for VmSnapshot

§

impl UnwindSafe for VmSnapshot

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.