Skip to main content

AxVMHal

Trait AxVMHal 

Source
pub trait AxVMHal: Sized {
    type PagingHandler: PagingHandler;

    // Required methods
    fn virt_to_phys(vaddr: HostVirtAddr) -> HostPhysAddr;
    fn current_time_nanos() -> u64;
    fn current_vm_id() -> usize;
    fn current_vcpu_id() -> usize;
    fn current_pcpu_id() -> usize;
    fn vcpu_resides_on(vm_id: usize, vcpu_id: usize) -> AxResult<usize>;
    fn inject_irq_to_vcpu(vm_id: usize, vcpu_id: usize, irq: usize) -> AxResult;
}
Expand description

The interfaces which the underlying software (kernel or hypervisor) must implement.

Required Associated Types§

Source

type PagingHandler: PagingHandler

The low-level OS-dependent helpers that must be provided for physical address management.

Required Methods§

Source

fn virt_to_phys(vaddr: HostVirtAddr) -> HostPhysAddr

Converts a virtual address to the corresponding physical address.

Source

fn current_time_nanos() -> u64

Current time in nanoseconds.

Source

fn current_vm_id() -> usize

Current VM ID.

Source

fn current_vcpu_id() -> usize

Current Virtual CPU ID.

Source

fn current_pcpu_id() -> usize

Current Physical CPU ID.

Source

fn vcpu_resides_on(vm_id: usize, vcpu_id: usize) -> AxResult<usize>

Get the Physical CPU ID where the specified VCPU of the current VM resides.

Returns an error if the VCPU is not found.

Source

fn inject_irq_to_vcpu(vm_id: usize, vcpu_id: usize, irq: usize) -> AxResult

Inject an IRQ to the specified VCPU.

This method should find the physical CPU where the specified VCPU resides and inject the IRQ to it on that physical CPU with axvcpu::AxVCpu::inject_interrupt.

Returns an error if the VCPU is not found.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§