Struct SystemState
pub struct SystemState<A: Arch> {
pub use_trap_flag: bool,
pub contains_valid_addrs: bool,
/* private fields */
}
Expand description
A CPU state consisting of the architecture-specific state part and memory mappings.
Fields§
§use_trap_flag: bool
True if the trap flag should be used to observe this system state.
contains_valid_addrs: bool
True if the state’s memory mapping contains valid addresses.
Implementations§
§impl<A: Arch> SystemState<A>
impl<A: Arch> SystemState<A>
pub fn memory(&self) -> &MemoryState
pub fn memory(&self) -> &MemoryState
Returns the memory mappings
pub fn memory_mut(&mut self) -> &mut MemoryState
pub fn memory_mut(&mut self) -> &mut MemoryState
Returns a mutable reference to the memory mappings
pub fn new(cpu: A::CpuState, memory: MemoryState) -> SystemState<A>
pub fn new(cpu: A::CpuState, memory: MemoryState) -> SystemState<A>
Creates a new SystemState
.
Sets use_trap_flag
and contains_valid_addrs
to true.
pub fn new_without_memory(cpu: A::CpuState) -> SystemState<A>
pub fn new_without_memory(cpu: A::CpuState) -> SystemState<A>
Creates a new SystemState
without any memory mappings.
Sets use_trap_flag
and contains_valid_addrs
to true.
pub fn with_new_memory(
self,
_num_memory: usize,
_num_bytes: usize,
memory: MemoryState,
) -> SystemState<A>
pub fn with_new_memory( self, _num_memory: usize, _num_bytes: usize, memory: MemoryState, ) -> SystemState<A>
Returns a new SystemState
with all memory mappings replaced by memory
.
Sets use_trap_flag
and contains_valid_addrs
to true.
pub fn with_location(&self, loc: &Location<A>, value: Value<'_>) -> Self
pub fn with_location(&self, loc: &Location<A>, value: Value<'_>) -> Self
Returns a new SystemState
with storage location loc
set to value
.
pub fn modify_dest(&mut self, dest: &Dest<A>, modify: impl FnOnce(MutValue<'_>))
pub fn modify_dest(&mut self, dest: &Dest<A>, modify: impl FnOnce(MutValue<'_>))
Allows the value of dest
to be modified through a MutValue
.
pub fn with_dest(&self, dest: &Dest<A>, v: &Value<'_>) -> Self
pub fn with_dest(&self, dest: &Dest<A>, v: &Value<'_>) -> Self
Returns a new SystemState
where dest
is set to v
.
pub fn set_location(&mut self, loc: &Location<A>, value: Value<'_>)
pub fn set_location(&mut self, loc: &Location<A>, value: Value<'_>)
Writes the value of loc
.
pub fn get_location(&self, loc: &Location<A>) -> Option<Value<'_>>
pub fn get_location(&self, loc: &Location<A>) -> Option<Value<'_>>
Returns the value of loc
, or returns None
if loc
refers to a non-existant memory access.
Trait Implementations§
§impl<A: Arch> AsRef<SystemState<A>> for ComplexStateRef<'_, A>
impl<A: Arch> AsRef<SystemState<A>> for ComplexStateRef<'_, A>
§fn as_ref(&self) -> &SystemState<A>
fn as_ref(&self) -> &SystemState<A>
§impl<A: Arch> AsRef<SystemState<A>> for GpRegStateRef<'_, A>
impl<A: Arch> AsRef<SystemState<A>> for GpRegStateRef<'_, A>
§fn as_ref(&self) -> &SystemState<A>
fn as_ref(&self) -> &SystemState<A>
§impl<A: Arch> AsRef<SystemState<A>> for MaybeRef<'_, A>
impl<A: Arch> AsRef<SystemState<A>> for MaybeRef<'_, A>
§fn as_ref(&self) -> &SystemState<A>
fn as_ref(&self) -> &SystemState<A>
§impl<A: Arch> AsRef<SystemState<A>> for Ref<'_, SystemState<A>>
impl<A: Arch> AsRef<SystemState<A>> for Ref<'_, SystemState<A>>
§fn as_ref(&self) -> &SystemState<A>
fn as_ref(&self) -> &SystemState<A>
§impl<A: Arch> AsRef<SystemState<A>> for SimpleStateRef<'_, A>
impl<A: Arch> AsRef<SystemState<A>> for SimpleStateRef<'_, A>
§fn as_ref(&self) -> &SystemState<A>
fn as_ref(&self) -> &SystemState<A>
§impl<A: Arch> AsRef<SystemState<A>> for SystemState<A>
impl<A: Arch> AsRef<SystemState<A>> for SystemState<A>
§fn as_ref(&self) -> &SystemState<A>
fn as_ref(&self) -> &SystemState<A>
§impl<A: Arch> AsSystemState<A> for &SystemState<A>
impl<A: Arch> AsSystemState<A> for &SystemState<A>
§type Output<'a> = &'a SystemState<A>
where
Self: 'a
type Output<'a> = &'a SystemState<A> where Self: 'a
Self::as_system_state
.§fn as_system_state(&self) -> Self::Output<'_>
fn as_system_state(&self) -> Self::Output<'_>
AsRef<SystemState<A>>
.
Should be a cheap operation, as it may be called often.§fn num_memory_mappings(&self) -> usize
fn num_memory_mappings(&self) -> usize
Self::as_system_state
will return.§impl<A: Arch> AsSystemState<A> for Box<SystemState<A>>
impl<A: Arch> AsSystemState<A> for Box<SystemState<A>>
§type Output<'a> = &'a SystemState<A>
type Output<'a> = &'a SystemState<A>
Self::as_system_state
.§fn as_system_state(&self) -> Self::Output<'_>
fn as_system_state(&self) -> Self::Output<'_>
AsRef<SystemState<A>>
.
Should be a cheap operation, as it may be called often.§fn num_memory_mappings(&self) -> usize
fn num_memory_mappings(&self) -> usize
Self::as_system_state
will return.§impl<A: Arch> AsSystemState<A> for SystemState<A>
impl<A: Arch> AsSystemState<A> for SystemState<A>
§type Output<'a> = &'a SystemState<A>
type Output<'a> = &'a SystemState<A>
Self::as_system_state
.§fn as_system_state(&self) -> Self::Output<'_>
fn as_system_state(&self) -> Self::Output<'_>
AsRef<SystemState<A>>
.
Should be a cheap operation, as it may be called often.§fn num_memory_mappings(&self) -> usize
fn num_memory_mappings(&self) -> usize
Self::as_system_state
will return.§impl<A: Clone + Arch> Clone for SystemState<A>
impl<A: Clone + Arch> Clone for SystemState<A>
§fn clone(&self) -> SystemState<A>
fn clone(&self) -> SystemState<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<A: Arch> Debug for SystemState<A>
impl<A: Arch> Debug for SystemState<A>
§impl<A: Arch> Default for SystemState<A>
impl<A: Arch> Default for SystemState<A>
§impl<A: Arch> From<SystemState<A>> for MaybeJitState<'_, A>
impl<A: Arch> From<SystemState<A>> for MaybeJitState<'_, A>
§fn from(value: SystemState<A>) -> Self
fn from(value: SystemState<A>) -> Self
§impl<A: PartialEq + Arch> PartialEq for SystemState<A>
impl<A: PartialEq + Arch> PartialEq for SystemState<A>
impl<A: Eq + Arch> Eq for SystemState<A>
impl<A: Arch> StructuralPartialEq for SystemState<A>
Auto Trait Implementations§
impl<A> Freeze for SystemState<A>
impl<A> RefUnwindSafe for SystemState<A>
impl<A> Send for SystemState<A>
impl<A> Sync for SystemState<A>
impl<A> Unpin for SystemState<A>
impl<A> UnwindSafe for SystemState<A>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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>
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>
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