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§
Sourcetype PagingHandler: PagingHandler
type PagingHandler: PagingHandler
The low-level OS-dependent helpers that must be provided for physical address management.
Required Methods§
Sourcefn virt_to_phys(vaddr: HostVirtAddr) -> HostPhysAddr
fn virt_to_phys(vaddr: HostVirtAddr) -> HostPhysAddr
Converts a virtual address to the corresponding physical address.
Sourcefn current_time_nanos() -> u64
fn current_time_nanos() -> u64
Current time in nanoseconds.
Sourcefn current_vm_id() -> usize
fn current_vm_id() -> usize
Current VM ID.
Sourcefn current_vcpu_id() -> usize
fn current_vcpu_id() -> usize
Current Virtual CPU ID.
Sourcefn current_pcpu_id() -> usize
fn current_pcpu_id() -> usize
Current Physical CPU ID.
Sourcefn vcpu_resides_on(vm_id: usize, vcpu_id: usize) -> AxResult<usize>
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.
Sourcefn inject_irq_to_vcpu(vm_id: usize, vcpu_id: usize, irq: usize) -> AxResult
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.