Struct BreakpointManager

Source
pub struct BreakpointManager<Controller, Key = (), Tag = &'static str>
where Controller: TapController, Controller::Driver: VmiDriver, Key: KeyType, Tag: TagType,
{ /* private fields */ }
Expand description

Breakpoint manager.

Implementations§

Source§

impl<Interface, Key, Tag> BreakpointManager<Interface, Key, Tag>
where Interface: TapController, Interface::Driver: VmiDriver, Key: KeyType, Tag: TagType,

Source

pub fn new() -> Self

Creates a new breakpoint manager.

Source

pub fn insert( &mut self, vmi: &VmiCore<Interface::Driver>, breakpoint: impl Into<Breakpoint<Key, Tag>>, ) -> Result<bool, VmiError>

Inserts a breakpoint.

The breakpoint is registered as pending when the translation for the virtual address is not present. When the translation is present, the breakpoint is immediately inserted.

Consider using insert_with_hint when the physical address is known.

Returns true if the breakpoint was newly inserted, false if it was already present.

Source

pub fn insert_with_hint( &mut self, vmi: &VmiCore<Interface::Driver>, breakpoint: impl Into<Breakpoint<Key, Tag>>, pa: Option<Pa>, ) -> Result<bool, VmiError>

Inserts a breakpoint with a hint for the physical address. If the physical address is None, the breakpoint is registered as pending.

This function is useful when the physical address is known in advance, for example, when the breakpoint is inserted in response to a page table update.

The user is responsible for ensuring that the physical address is correct.

Returns true if the breakpoint was newly inserted, false if it was already present.

Source

pub fn remove( &mut self, vmi: &VmiCore<Interface::Driver>, breakpoint: impl Into<Breakpoint<Key, Tag>>, ) -> Result<bool, VmiError>

Removes a breakpoint.

When a translation for the virtual address is not present, the breakpoint is removed from the pending breakpoints. When the translation is present, the breakpoint is removed from the active breakpoints.

Returns true if the breakpoint was removed, false if it was not found.

Source

pub fn remove_with_hint( &mut self, vmi: &VmiCore<Interface::Driver>, breakpoint: impl Into<Breakpoint<Key, Tag>>, pa: Option<Pa>, ) -> Result<bool, VmiError>

Removes a breakpoint with a hint for the physical address.

If the physical address is None, the breakpoint is removed from the pending breakpoints. If the physical address is provided, the breakpoint is removed from the active breakpoints.

Returns true if the breakpoint was removed, false if it was not found.

Source

pub fn remove_by_event( &mut self, vmi: &VmiCore<Interface::Driver>, event: &VmiEvent<<Interface::Driver as VmiDriver>::Architecture>, key: Key, ) -> Result<Option<bool>, VmiError>

Removes a breakpoint by event that caused the breakpoint.

Returns either:

  • Some(true) if the breakpoint was removed and it was the last breakpoint for the (view, GFN) pair.
  • Some(false) if the breakpoint was removed but there are still other breakpoints for the (view, GFN) pair.
  • None if the breakpoint was not found.
Source

pub fn remove_by_view( &mut self, vmi: &VmiCore<Interface::Driver>, view: View, ) -> Result<bool, VmiError>

Removes all breakpoints for a given view.

Returns true if any breakpoints were removed, false otherwise.

Source

pub fn get_by_event( &mut self, event: &VmiEvent<<Interface::Driver as VmiDriver>::Architecture>, key: Key, ) -> Option<impl Iterator<Item = Breakpoint<Key, Tag>> + '_>

Returns an iterator over the breakpoints for the given event.

Source

pub fn contains_by_event( &self, event: &VmiEvent<<Interface::Driver as VmiDriver>::Architecture>, key: Key, ) -> bool

Checks if the given event was caused by a breakpoint.

Source

pub fn contains_by_address( &self, ctx: impl Into<AddressContext>, key: Key, ) -> bool

Checks if a breakpoint is active for the given address.

Source

pub fn clear( &mut self, vmi: &VmiCore<Interface::Driver>, ) -> Result<(), VmiError>

Clears all breakpoints.

This function removes all active and pending breakpoints.

Source

pub fn handle_ptm_event( &mut self, vmi: &VmiCore<Interface::Driver>, event: &PageTableMonitorEvent, ) -> Result<bool, VmiError>

Handles a page table monitor event.

This function should be called when a page table monitor event is received. It will update the internal state of the breakpoint manager accordingly.

On page-in events, the function will check if there are any pending breakpoints that can be made active.

On page-out events, the function will check if there are any active breakpoints that need to made pending.

Returns true if any breakpoints were updated, false otherwise.

Auto Trait Implementations§

§

impl<Controller, Key, Tag> Freeze for BreakpointManager<Controller, Key, Tag>
where Controller: Freeze,

§

impl<Controller, Key, Tag> RefUnwindSafe for BreakpointManager<Controller, Key, Tag>
where Controller: RefUnwindSafe, Key: RefUnwindSafe, Tag: RefUnwindSafe,

§

impl<Controller, Key, Tag> Send for BreakpointManager<Controller, Key, Tag>
where Controller: Send, Key: Send, Tag: Send,

§

impl<Controller, Key, Tag> Sync for BreakpointManager<Controller, Key, Tag>
where Controller: Sync, Key: Sync, Tag: Sync,

§

impl<Controller, Key, Tag> Unpin for BreakpointManager<Controller, Key, Tag>
where Controller: Unpin, Key: Unpin, Tag: Unpin,

§

impl<Controller, Key, Tag> UnwindSafe for BreakpointManager<Controller, Key, Tag>
where Controller: UnwindSafe, Key: UnwindSafe, Tag: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,