Struct FakeOracle
pub struct FakeOracle<F, M> { /* private fields */ }Expand description
A fake observer for FakeArch.
Observations are performed by invoking a closure provided to FakeOracle::new.
Implementations§
§impl<F, M> FakeOracle<F, M>where
    F: Fn(&SystemState<FakeArch>) -> Result<SystemState<FakeArch>, OracleError>,
    M: Fn(&SystemState<FakeArch>) -> Result<Vec<Addr>, OracleError>,
 
impl<F, M> FakeOracle<F, M>where
    F: Fn(&SystemState<FakeArch>) -> Result<SystemState<FakeArch>, OracleError>,
    M: Fn(&SystemState<FakeArch>) -> Result<Vec<Addr>, OracleError>,
pub fn new(op: F, scan_memory_accesses: M) -> FakeOracle<F, M>
pub fn new(op: F, scan_memory_accesses: M) -> FakeOracle<F, M>
Instantiates a new oracle.
The op function should execute the instruction on the provided CPU state.
The scan_memory_accesses function should return a list of all memory addresses accessed by the instruction, given the specific CPU state.
Trait Implementations§
§impl<F, M> Oracle<FakeArch> for FakeOracle<F, M>where
    F: Fn(&SystemState<FakeArch>) -> Result<SystemState<FakeArch>, OracleError>,
    M: Fn(&SystemState<FakeArch>) -> Result<Vec<Addr>, OracleError>,
 
impl<F, M> Oracle<FakeArch> for FakeOracle<F, M>where
    F: Fn(&SystemState<FakeArch>) -> Result<SystemState<FakeArch>, OracleError>,
    M: Fn(&SystemState<FakeArch>) -> Result<Vec<Addr>, OracleError>,
§const UNRELIABLE_INSTRUCTION_FETCH_ERRORS: bool = false
 
const UNRELIABLE_INSTRUCTION_FETCH_ERRORS: bool = false
Set to true if the instruction fetch errors are unreliable.
§type MappableArea = AnyArea
 
type MappableArea = AnyArea
The memory addresses that can be mapped by this oracle.
§fn mappable_area(&self) -> Self::MappableArea
 
fn mappable_area(&self) -> Self::MappableArea
Returns the memory addresses that can be mapped by this oracle.
§fn observe(
    &mut self,
    before: &SystemState<FakeArch>,
) -> Result<SystemState<FakeArch>, OracleError>
 
fn observe( &mut self, before: &SystemState<FakeArch>, ) -> Result<SystemState<FakeArch>, OracleError>
Observes the output state after executing a single instruction in the 
before state.§fn scan_memory_accesses(
    &mut self,
    before: &SystemState<FakeArch>,
) -> Result<Vec<Addr>, OracleError>
 
fn scan_memory_accesses( &mut self, before: &SystemState<FakeArch>, ) -> Result<Vec<Addr>, OracleError>
Uses debugging registers to determine all memory addresses accessed by the instruction.
If this is not supported, returns an empty 
Vec.§fn debug_dump(&mut self)
 
fn debug_dump(&mut self)
Prints debugging information about the oracle.
§fn batch_observe_iter<'a, S: AsSystemState<FakeArch> + 'a, I: IntoIterator<Item = S> + 'a>(
    &'a mut self,
    states: I,
) -> impl Iterator<Item = Observation<S, FakeArch>>
 
fn batch_observe_iter<'a, S: AsSystemState<FakeArch> + 'a, I: IntoIterator<Item = S> + 'a>( &'a mut self, states: I, ) -> impl Iterator<Item = Observation<S, FakeArch>>
Performs many observations in one go.
Behaves idential to 
Self::observe, but is much more efficient.§fn batch_observe_gpreg_only_iter<'a, S: AsSystemState<FakeArch> + 'a, I: IntoIterator<Item = S> + 'a>(
    &'a mut self,
    states: I,
) -> impl Iterator<Item = Observation<S, FakeArch>>
 
fn batch_observe_gpreg_only_iter<'a, S: AsSystemState<FakeArch> + 'a, I: IntoIterator<Item = S> + 'a>( &'a mut self, states: I, ) -> impl Iterator<Item = Observation<S, FakeArch>>
Performs many observations in one go.
Only reads and writes the general-purpose registers.
Other registers may have arbitrary values.
§fn random_mappable_page(&self, rng: &mut impl Rng) -> Page<A>
 
fn random_mappable_page(&self, rng: &mut impl Rng) -> Page<A>
Returns a random mappable page.
§fn observe_carefully(
    &mut self,
    before: &SystemState<A>,
) -> Result<SystemState<A>, OracleError>
 
fn observe_carefully( &mut self, before: &SystemState<A>, ) -> Result<SystemState<A>, OracleError>
Observes the output state after executing a single instruction in the 
before state.
If possible, uses debugging registers to exhaustively check the exact memory locations that are accessed.
Returns a memory access error if a memory is accessed that is not set in before. Read more§fn batch_observe<'a, const N: usize, S: AsSystemState<A> + 'a>(
    &mut self,
    states: [S; N],
) -> [Observation<S, A>; N]
 
fn batch_observe<'a, const N: usize, S: AsSystemState<A> + 'a>( &mut self, states: [S; N], ) -> [Observation<S, A>; N]
Performs many observations in one go.
Behaves idential to 
Self::observe, but is much more efficient.Auto Trait Implementations§
impl<F, M> Freeze for FakeOracle<F, M>
impl<F, M> RefUnwindSafe for FakeOracle<F, M>where
    F: RefUnwindSafe,
    M: RefUnwindSafe,
impl<F, M> Send for FakeOracle<F, M>
impl<F, M> Sync for FakeOracle<F, M>
impl<F, M> Unpin for FakeOracle<F, M>
impl<F, M> UnwindSafe for FakeOracle<F, M>where
    F: UnwindSafe,
    M: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Identity for Twhere
    T: ?Sized,
 
impl<T> Identity for Twhere
    T: ?Sized,
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more