vmi_utils/bpm/controller/
mod.rs

1mod breakpoint;
2mod memory;
3use vmi_core::{Gfn, Pa, View, VmiCore, VmiDriver, VmiError, VmiEvent};
4
5pub use self::{breakpoint::BreakpointController, memory::MemoryController};
6
7/// Trait for breakpoint controller implementations.
8pub trait TapController {
9    /// VMI driver type.
10    type Driver: VmiDriver;
11
12    /// Creates a new `TapController`.
13    fn new() -> Self;
14
15    /// Checks if the given event was caused by a breakpoint.
16    fn check_event(
17        &self,
18        event: &VmiEvent<<Self::Driver as VmiDriver>::Architecture>,
19    ) -> Option<(View, Gfn)>;
20
21    /// Inserts a breakpoint at the given physical address.
22    fn insert_breakpoint(
23        &mut self,
24        vmi: &VmiCore<Self::Driver>,
25        pa: Pa,
26        view: View,
27    ) -> Result<(), VmiError>;
28
29    /// Removes a breakpoint at the given physical address.
30    fn remove_breakpoint(
31        &mut self,
32        vmi: &VmiCore<Self::Driver>,
33        pa: Pa,
34        view: View,
35    ) -> Result<(), VmiError>;
36
37    /// Monitors the given guest frame number.
38    fn monitor(
39        &mut self,
40        vmi: &VmiCore<Self::Driver>,
41        gfn: Gfn,
42        view: View,
43    ) -> Result<(), VmiError>;
44
45    /// Unmonitors the given guest frame number.
46    fn unmonitor(
47        &mut self,
48        vmi: &VmiCore<Self::Driver>,
49        gfn: Gfn,
50        view: View,
51    ) -> Result<(), VmiError>;
52}