Skip to main content

VmArchVcpuOps

Trait VmArchVcpuOps 

Source
pub trait VmArchVcpuOps: Sized {
    type CreateConfig;
    type SetupConfig;
    type Exit: Debug;

Show 13 methods // Required methods fn new( vm_id: VMId, vcpu_id: VCpuId, config: Self::CreateConfig, ) -> AxVmResult<Self>; fn set_entry(&mut self, entry: GuestPhysAddr) -> AxVmResult; fn set_nested_page_table( &mut self, config: NestedPagingConfig, ) -> AxVmResult; fn setup(&mut self, config: Self::SetupConfig) -> AxVmResult; fn run(&mut self) -> AxVmResult<Self::Exit>; fn bind(&mut self) -> AxVmResult; fn unbind(&mut self) -> AxVmResult; fn set_gpr(&mut self, reg: usize, val: usize); fn inject_interrupt(&mut self, vector: usize) -> AxVmResult; fn set_return_value(&mut self, val: usize); // Provided methods fn decode_mmio_fault( &mut self, _fault_addr: GuestPhysAddr, _access_flags: MappingFlags, ) -> Option<VmExit> { ... } fn inject_interrupt_with_trigger( &mut self, vector: usize, trigger: InterruptTriggerMode, ) -> AxVmResult { ... } fn handle_eoi(&mut self) -> Option<u8> { ... }
}
Expand description

Architecture-specific vCPU operations consumed by AxVM.

Required Associated Types§

Source

type CreateConfig

Architecture-specific creation configuration.

Source

type SetupConfig

Architecture-specific setup configuration.

Source

type Exit: Debug

Architecture-specific VM-exit type returned by Self::run.

Required Methods§

Source

fn new( vm_id: VMId, vcpu_id: VCpuId, config: Self::CreateConfig, ) -> AxVmResult<Self>

Creates a new architecture-specific vCPU.

Source

fn set_entry(&mut self, entry: GuestPhysAddr) -> AxVmResult

Sets the guest entry point.

Source

fn set_nested_page_table(&mut self, config: NestedPagingConfig) -> AxVmResult

Sets the nested page table selected by AxVM.

Source

fn setup(&mut self, config: Self::SetupConfig) -> AxVmResult

Completes architecture-specific setup.

Source

fn run(&mut self) -> AxVmResult<Self::Exit>

Runs the vCPU until an architecture-specific VM exit.

Source

fn bind(&mut self) -> AxVmResult

Binds the vCPU to the current physical CPU.

Source

fn unbind(&mut self) -> AxVmResult

Unbinds the vCPU from the current physical CPU.

Source

fn set_gpr(&mut self, reg: usize, val: usize)

Sets a general-purpose register.

Source

fn inject_interrupt(&mut self, vector: usize) -> AxVmResult

Injects an interrupt into the vCPU.

Source

fn set_return_value(&mut self, val: usize)

Sets the guest return value.

Provided Methods§

Source

fn decode_mmio_fault( &mut self, _fault_addr: GuestPhysAddr, _access_flags: MappingFlags, ) -> Option<VmExit>

Decodes an architecture-specific memory fault as a legacy normalized MMIO event when possible.

This is kept as a transition helper for backends that still route device faults through VmExit. New raw vCPU exits should use Self::Exit and be handled in the architecture-local AxVM adapter.

Source

fn inject_interrupt_with_trigger( &mut self, vector: usize, trigger: InterruptTriggerMode, ) -> AxVmResult

Injects an interrupt with trigger-mode metadata.

Source

fn handle_eoi(&mut self) -> Option<u8>

Processes a guest EOI and returns an external EOI vector when needed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§