pub struct BreakpointManager<Controller, Key = (), Tag = &'static str>{ /* private fields */ }Expand description
Breakpoint manager.
Implementations§
Source§impl<Interface, Key, Tag> BreakpointManager<Interface, Key, Tag>
impl<Interface, Key, Tag> BreakpointManager<Interface, Key, Tag>
Sourcepub fn insert(
&mut self,
vmi: &VmiCore<Interface::Driver>,
breakpoint: impl Into<Breakpoint<Key, Tag>>,
) -> Result<bool, VmiError>
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.
Sourcepub fn insert_with_hint(
&mut self,
vmi: &VmiCore<Interface::Driver>,
breakpoint: impl Into<Breakpoint<Key, Tag>>,
pa: Option<Pa>,
) -> Result<bool, VmiError>
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.
Sourcepub fn remove(
&mut self,
vmi: &VmiCore<Interface::Driver>,
breakpoint: impl Into<Breakpoint<Key, Tag>>,
) -> Result<bool, VmiError>
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.
Sourcepub fn remove_with_hint(
&mut self,
vmi: &VmiCore<Interface::Driver>,
breakpoint: impl Into<Breakpoint<Key, Tag>>,
pa: Option<Pa>,
) -> Result<bool, VmiError>
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.
Sourcepub fn remove_by_event(
&mut self,
vmi: &VmiCore<Interface::Driver>,
event: &VmiEvent<<Interface::Driver as VmiDriver>::Architecture>,
key: Key,
) -> Result<Option<bool>, VmiError>
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.Noneif the breakpoint was not found.
Sourcepub fn remove_by_view(
&mut self,
vmi: &VmiCore<Interface::Driver>,
view: View,
) -> Result<bool, VmiError>
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.
Sourcepub fn get_by_event(
&mut self,
event: &VmiEvent<<Interface::Driver as VmiDriver>::Architecture>,
key: Key,
) -> Option<impl Iterator<Item = Breakpoint<Key, Tag>> + '_>
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.
Sourcepub fn contains_by_event(
&self,
event: &VmiEvent<<Interface::Driver as VmiDriver>::Architecture>,
key: Key,
) -> bool
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.
Sourcepub fn contains_by_address(
&self,
ctx: impl Into<AddressContext>,
key: Key,
) -> bool
pub fn contains_by_address( &self, ctx: impl Into<AddressContext>, key: Key, ) -> bool
Checks if a breakpoint is active for the given address.
Sourcepub fn clear(
&mut self,
vmi: &VmiCore<Interface::Driver>,
) -> Result<(), VmiError>
pub fn clear( &mut self, vmi: &VmiCore<Interface::Driver>, ) -> Result<(), VmiError>
Clears all breakpoints.
This function removes all active and pending breakpoints.
Sourcepub fn handle_ptm_event(
&mut self,
vmi: &VmiCore<Interface::Driver>,
event: &PageTableMonitorEvent,
) -> Result<bool, VmiError>
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.