pub trait VmiDriver {
type Architecture: Architecture + ?Sized;
Show 24 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 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<'a>(
&'a self,
timeout: Duration,
handler: Box<VmiEventCallback<'a, Self::Architecture>>,
) -> Result<(), VmiError>;
fn reset_state(&self) -> Result<(), VmiError>;
}Expand description
A trait for implementing a VMI driver.
Required Associated Types§
Sourcetype Architecture: Architecture + ?Sized
type Architecture: Architecture + ?Sized
The architecture supported by the driver.
Required Methods§
Sourcefn registers(
&self,
vcpu: VcpuId,
) -> Result<<Self::Architecture as Architecture>::Registers, VmiError>
fn registers( &self, vcpu: VcpuId, ) -> Result<<Self::Architecture as Architecture>::Registers, VmiError>
Retrieves the registers of a specific virtual CPU.
Sourcefn set_registers(
&self,
vcpu: VcpuId,
registers: <Self::Architecture as Architecture>::Registers,
) -> Result<(), VmiError>
fn set_registers( &self, vcpu: VcpuId, registers: <Self::Architecture as Architecture>::Registers, ) -> Result<(), VmiError>
Sets the registers of a specific virtual CPU.
Sourcefn memory_access(&self, gfn: Gfn, view: View) -> Result<MemoryAccess, VmiError>
fn memory_access(&self, gfn: Gfn, view: View) -> Result<MemoryAccess, VmiError>
Retrieves the memory access permissions for a specific GFN.
Sourcefn set_memory_access(
&self,
gfn: Gfn,
view: View,
access: MemoryAccess,
) -> Result<(), VmiError>
fn set_memory_access( &self, gfn: Gfn, view: View, access: MemoryAccess, ) -> Result<(), VmiError>
Sets the memory access permissions for a specific GFN.
Sourcefn read_page(&self, gfn: Gfn) -> Result<VmiMappedPage, VmiError>
fn read_page(&self, gfn: Gfn) -> Result<VmiMappedPage, VmiError>
Reads a page of memory from the virtual machine.
Sourcefn write_page(
&self,
gfn: Gfn,
offset: u64,
content: &[u8],
) -> Result<VmiMappedPage, VmiError>
fn write_page( &self, gfn: Gfn, offset: u64, content: &[u8], ) -> Result<VmiMappedPage, VmiError>
Writes data to a page of memory in the virtual machine.
Sourcefn default_view(&self) -> View
fn default_view(&self) -> View
Returns the default view for the virtual machine.
Sourcefn create_view(&self, default_access: MemoryAccess) -> Result<View, VmiError>
fn create_view(&self, default_access: MemoryAccess) -> Result<View, VmiError>
Creates a new view with the specified default access permissions.
Sourcefn change_view_gfn(
&self,
view: View,
old_gfn: Gfn,
new_gfn: Gfn,
) -> Result<(), VmiError>
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.
Sourcefn reset_view_gfn(&self, view: View, gfn: Gfn) -> Result<(), VmiError>
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.
Sourcefn monitor_enable(
&self,
option: <Self::Architecture as Architecture>::EventMonitor,
) -> Result<(), VmiError>
fn monitor_enable( &self, option: <Self::Architecture as Architecture>::EventMonitor, ) -> Result<(), VmiError>
Enables monitoring of specific events.
Sourcefn monitor_disable(
&self,
option: <Self::Architecture as Architecture>::EventMonitor,
) -> Result<(), VmiError>
fn monitor_disable( &self, option: <Self::Architecture as Architecture>::EventMonitor, ) -> Result<(), VmiError>
Disables monitoring of specific events.
Sourcefn inject_interrupt(
&self,
vcpu: VcpuId,
interrupt: <Self::Architecture as Architecture>::Interrupt,
) -> Result<(), VmiError>
fn inject_interrupt( &self, vcpu: VcpuId, interrupt: <Self::Architecture as Architecture>::Interrupt, ) -> Result<(), VmiError>
Injects an interrupt into a specific virtual CPU.
Sourcefn events_pending(&self) -> usize
fn events_pending(&self) -> usize
Returns the number of pending events.
Sourcefn event_processing_overhead(&self) -> Duration
fn event_processing_overhead(&self) -> Duration
Returns the time spent processing events.
Sourcefn wait_for_event<'a>(
&'a self,
timeout: Duration,
handler: Box<VmiEventCallback<'a, Self::Architecture>>,
) -> Result<(), VmiError>
fn wait_for_event<'a>( &'a self, timeout: Duration, handler: Box<VmiEventCallback<'a, Self::Architecture>>, ) -> Result<(), VmiError>
Waits for an event to occur and processes it with the provided handler.
Sourcefn reset_state(&self) -> Result<(), VmiError>
fn reset_state(&self) -> Result<(), VmiError>
Resets the state of the VMI system.