vmi_utils/bpm/controller/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
mod breakpoint;
mod memory;
use vmi_core::{Gfn, Pa, View, VmiCore, VmiDriver, VmiError, VmiEvent};

pub use self::{breakpoint::BreakpointController, memory::MemoryController};

/// Trait for breakpoint controller implementations.
pub trait TapController {
    /// VMI driver type.
    type Driver: VmiDriver;

    /// Creates a new `TapController`.
    fn new() -> Self;

    /// Checks if the given event was caused by a breakpoint.
    fn check_event(
        &self,
        event: &VmiEvent<<Self::Driver as VmiDriver>::Architecture>,
    ) -> Option<(View, Gfn)>;

    /// Inserts a breakpoint at the given physical address.
    fn insert_breakpoint(
        &mut self,
        vmi: &VmiCore<Self::Driver>,
        pa: Pa,
        view: View,
    ) -> Result<(), VmiError>;

    /// Removes a breakpoint at the given physical address.
    fn remove_breakpoint(
        &mut self,
        vmi: &VmiCore<Self::Driver>,
        pa: Pa,
        view: View,
    ) -> Result<(), VmiError>;

    /// Monitors the given guest frame number.
    fn monitor(
        &mut self,
        vmi: &VmiCore<Self::Driver>,
        gfn: Gfn,
        view: View,
    ) -> Result<(), VmiError>;

    /// Unmonitors the given guest frame number.
    fn unmonitor(
        &mut self,
        vmi: &VmiCore<Self::Driver>,
        gfn: Gfn,
        view: View,
    ) -> Result<(), VmiError>;
}