Trait VmiDriver

Source
pub trait VmiDriver: 'static {
    type Architecture: Architecture + ?Sized;

Show 25 methods // Required methods fn info(&self) -> Result<VmiInfo, VmiError>; fn pause(&self) -> Result<(), VmiError>; fn resume(&self) -> Result<(), VmiError>; fn registers( &self, vcpu: VcpuId, ) -> Result<<Self::Architecture as Architecture>::Registers, VmiError>; fn set_registers( &self, vcpu: VcpuId, registers: <Self::Architecture as Architecture>::Registers, ) -> Result<(), VmiError>; fn memory_access( &self, gfn: Gfn, view: View, ) -> Result<MemoryAccess, VmiError>; fn set_memory_access( &self, gfn: Gfn, view: View, access: MemoryAccess, ) -> Result<(), VmiError>; fn set_memory_access_with_options( &self, gfn: Gfn, view: View, access: MemoryAccess, options: MemoryAccessOptions, ) -> Result<(), VmiError>; fn read_page(&self, gfn: Gfn) -> Result<VmiMappedPage, VmiError>; fn write_page( &self, gfn: Gfn, offset: u64, content: &[u8], ) -> Result<VmiMappedPage, VmiError>; fn allocate_gfn(&self, gfn: Gfn) -> Result<(), VmiError>; fn free_gfn(&self, gfn: Gfn) -> Result<(), VmiError>; fn default_view(&self) -> View; fn create_view( &self, default_access: MemoryAccess, ) -> Result<View, VmiError>; fn destroy_view(&self, view: View) -> Result<(), VmiError>; fn switch_to_view(&self, view: View) -> Result<(), VmiError>; fn change_view_gfn( &self, view: View, old_gfn: Gfn, new_gfn: Gfn, ) -> Result<(), VmiError>; fn reset_view_gfn(&self, view: View, gfn: Gfn) -> Result<(), VmiError>; fn monitor_enable( &self, option: <Self::Architecture as Architecture>::EventMonitor, ) -> Result<(), VmiError>; fn monitor_disable( &self, option: <Self::Architecture as Architecture>::EventMonitor, ) -> Result<(), VmiError>; fn inject_interrupt( &self, vcpu: VcpuId, interrupt: <Self::Architecture as Architecture>::Interrupt, ) -> Result<(), VmiError>; fn events_pending(&self) -> usize; fn event_processing_overhead(&self) -> Duration; fn wait_for_event( &self, timeout: Duration, handler: impl FnMut(&VmiEvent<Self::Architecture>) -> VmiEventResponse<Self::Architecture>, ) -> Result<(), VmiError>; fn reset_state(&self) -> Result<(), VmiError>;
}
Expand description

A trait for implementing a VMI driver.

Required Associated Types§

Source

type Architecture: Architecture + ?Sized

The architecture supported by the driver.

Required Methods§

Source

fn info(&self) -> Result<VmiInfo, VmiError>

Returns information about the virtual machine.

Source

fn pause(&self) -> Result<(), VmiError>

Pauses the virtual machine.

Source

fn resume(&self) -> Result<(), VmiError>

Resumes the virtual machine.

Source

fn registers( &self, vcpu: VcpuId, ) -> Result<<Self::Architecture as Architecture>::Registers, VmiError>

Returns the registers of a specific virtual CPU.

Source

fn set_registers( &self, vcpu: VcpuId, registers: <Self::Architecture as Architecture>::Registers, ) -> Result<(), VmiError>

Sets the registers of a specific virtual CPU.

Source

fn memory_access(&self, gfn: Gfn, view: View) -> Result<MemoryAccess, VmiError>

Returns the memory access permissions for a specific GFN.

Source

fn set_memory_access( &self, gfn: Gfn, view: View, access: MemoryAccess, ) -> Result<(), VmiError>

Sets the memory access permissions for a specific GFN.

Source

fn set_memory_access_with_options( &self, gfn: Gfn, view: View, access: MemoryAccess, options: MemoryAccessOptions, ) -> Result<(), VmiError>

Sets the memory access permissions for a specific GFN with additional options.

Source

fn read_page(&self, gfn: Gfn) -> Result<VmiMappedPage, VmiError>

Reads a page of memory from the virtual machine.

Source

fn write_page( &self, gfn: Gfn, offset: u64, content: &[u8], ) -> Result<VmiMappedPage, VmiError>

Writes data to a page of memory in the virtual machine.

Source

fn allocate_gfn(&self, gfn: Gfn) -> Result<(), VmiError>

Allocates a specific GFN.

Source

fn free_gfn(&self, gfn: Gfn) -> Result<(), VmiError>

Frees a previously allocated GFN.

Source

fn default_view(&self) -> View

Returns the default view for the virtual machine.

Source

fn create_view(&self, default_access: MemoryAccess) -> Result<View, VmiError>

Creates a new view with the specified default access permissions.

Source

fn destroy_view(&self, view: View) -> Result<(), VmiError>

Destroys a previously created view.

Source

fn switch_to_view(&self, view: View) -> Result<(), VmiError>

Switches to a different view.

Source

fn change_view_gfn( &self, view: View, old_gfn: Gfn, new_gfn: Gfn, ) -> Result<(), VmiError>

Changes the mapping of a GFN in a specific view.

Source

fn reset_view_gfn(&self, view: View, gfn: Gfn) -> Result<(), VmiError>

Resets the mapping of a GFN in a specific view to its original state.

Source

fn monitor_enable( &self, option: <Self::Architecture as Architecture>::EventMonitor, ) -> Result<(), VmiError>

Enables monitoring of specific events.

Source

fn monitor_disable( &self, option: <Self::Architecture as Architecture>::EventMonitor, ) -> Result<(), VmiError>

Disables monitoring of specific events.

Source

fn inject_interrupt( &self, vcpu: VcpuId, interrupt: <Self::Architecture as Architecture>::Interrupt, ) -> Result<(), VmiError>

Injects an interrupt into a specific virtual CPU.

Source

fn events_pending(&self) -> usize

Returns the number of pending events.

Source

fn event_processing_overhead(&self) -> Duration

Returns the time spent processing events.

Source

fn wait_for_event( &self, timeout: Duration, handler: impl FnMut(&VmiEvent<Self::Architecture>) -> VmiEventResponse<Self::Architecture>, ) -> Result<(), VmiError>

Waits for an event to occur and processes it with the provided handler.

Source

fn reset_state(&self) -> Result<(), VmiError>

Resets the state of the VMI system.

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§