pub struct MemoryAccess(/* private fields */);Expand description
Memory access permission flags.
Implementations§
Source§impl MemoryAccess
impl MemoryAccess
Sourcepub const R: MemoryAccess
Available on crate features injector and utils only.
pub const R: MemoryAccess
injector and utils only.Read permission.
Sourcepub const W: MemoryAccess
Available on crate features injector and utils only.
pub const W: MemoryAccess
injector and utils only.Write permission.
Sourcepub const X: MemoryAccess
Available on crate features injector and utils only.
pub const X: MemoryAccess
injector and utils only.Execute permission.
Sourcepub const RW: MemoryAccess
Available on crate features injector and utils only.
pub const RW: MemoryAccess
injector and utils only.Combined Read and Write permissions.
Sourcepub const WX: MemoryAccess
Available on crate features injector and utils only.
pub const WX: MemoryAccess
injector and utils only.Combined Write and Execute permissions.
Sourcepub const RX: MemoryAccess
Available on crate features injector and utils only.
pub const RX: MemoryAccess
injector and utils only.Combined Read and Execute permissions.
Sourcepub const RWX: MemoryAccess
Available on crate features injector and utils only.
pub const RWX: MemoryAccess
injector and utils only.Full access: Read, Write, and Execute permissions.
Source§impl MemoryAccess
impl MemoryAccess
Sourcepub const fn empty() -> MemoryAccess
Available on crate features injector and utils only.
pub const fn empty() -> MemoryAccess
injector and utils only.Get a flags value with all bits unset.
Sourcepub const fn all() -> MemoryAccess
Available on crate features injector and utils only.
pub const fn all() -> MemoryAccess
injector and utils only.Get a flags value with all known bits set.
Sourcepub const fn bits(&self) -> u8
Available on crate features injector and utils only.
pub const fn bits(&self) -> u8
injector and utils only.Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u8) -> Option<MemoryAccess>
Available on crate features injector and utils only.
pub const fn from_bits(bits: u8) -> Option<MemoryAccess>
injector and utils only.Convert from a bits value.
This method will return None if any unknown bits are set.
Sourcepub const fn from_bits_truncate(bits: u8) -> MemoryAccess
Available on crate features injector and utils only.
pub const fn from_bits_truncate(bits: u8) -> MemoryAccess
injector and utils only.Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u8) -> MemoryAccess
Available on crate features injector and utils only.
pub const fn from_bits_retain(bits: u8) -> MemoryAccess
injector and utils only.Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<MemoryAccess>
Available on crate features injector and utils only.
pub fn from_name(name: &str) -> Option<MemoryAccess>
injector and utils only.Get a flags value with the bits of a flag with the given name set.
This method will return None if name is empty or doesn’t
correspond to any named flag.
Sourcepub const fn is_empty(&self) -> bool
Available on crate features injector and utils only.
pub const fn is_empty(&self) -> bool
injector and utils only.Whether all bits in self are unset.
Sourcepub const fn is_all(&self) -> bool
Available on crate features injector and utils only.
pub const fn is_all(&self) -> bool
injector and utils only.Whether all known bits in this flags value are set.
Sourcepub const fn intersects(&self, other: MemoryAccess) -> bool
Available on crate features injector and utils only.
pub const fn intersects(&self, other: MemoryAccess) -> bool
injector and utils only.Whether any set bits in other are also set in self.
Sourcepub const fn contains(&self, other: MemoryAccess) -> bool
Available on crate features injector and utils only.
pub const fn contains(&self, other: MemoryAccess) -> bool
injector and utils only.Whether all set bits in other are also set in self.
Examples found in repository?
237 fn memory_access(
238 &mut self,
239 vmi: &VmiContext<WindowsOs<Driver>>,
240 ) -> Result<VmiEventResponse<Amd64>, VmiError> {
241 let memory_access = vmi.event().reason().as_memory_access();
242
243 if memory_access.access.contains(MemoryAccess::W) {
244 self.ptm
245 .mark_dirty_entry(memory_access.pa, self.view, vmi.event().vcpu_id());
246
247 Ok(VmiEventResponse::singlestep().with_view(vmi.default_view()))
248 }
249 else if memory_access.access.contains(MemoryAccess::R) {
250 Ok(VmiEventResponse::fast_singlestep(vmi.default_view()))
251 }
252 else {
253 panic!("unhandled memory access: {memory_access:?}");
254 }
255 }More examples
242 fn memory_access(
243 &mut self,
244 vmi: &VmiContext<WindowsOs<Driver>>,
245 ) -> Result<VmiEventResponse<Amd64>, VmiError> {
246 let memory_access = vmi.event().reason().as_memory_access();
247
248 tracing::trace!(
249 pa = %memory_access.pa,
250 va = %memory_access.va,
251 access = %memory_access.access,
252 );
253
254 if memory_access.access.contains(MemoryAccess::W) {
255 // It is assumed that a write memory access event is caused by a
256 // page table modification.
257 //
258 // The page table entry is marked as dirty in the page table monitor
259 // and a singlestep is performed to process the dirty entries.
260 self.ptm
261 .mark_dirty_entry(memory_access.pa, self.view, vmi.event().vcpu_id());
262
263 Ok(VmiEventResponse::singlestep().with_view(vmi.default_view()))
264 }
265 else if memory_access.access.contains(MemoryAccess::R) {
266 // When the guest tries to read from the memory, a fast-singlestep
267 // is performed over the instruction that tried to read the memory.
268 // This is done to allow the instruction to read the original memory
269 // content.
270 Ok(VmiEventResponse::fast_singlestep(vmi.default_view()))
271 }
272 else {
273 panic!("Unhandled memory access: {memory_access:?}");
274 }
275 }Sourcepub fn insert(&mut self, other: MemoryAccess)
Available on crate features injector and utils only.
pub fn insert(&mut self, other: MemoryAccess)
injector and utils only.The bitwise or (|) of the bits in self and other.
Sourcepub fn remove(&mut self, other: MemoryAccess)
Available on crate features injector and utils only.
pub fn remove(&mut self, other: MemoryAccess)
injector and utils only.The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
remove won’t truncate other, but the ! operator will.
Sourcepub fn toggle(&mut self, other: MemoryAccess)
Available on crate features injector and utils only.
pub fn toggle(&mut self, other: MemoryAccess)
injector and utils only.The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub fn set(&mut self, other: MemoryAccess, value: bool)
Available on crate features injector and utils only.
pub fn set(&mut self, other: MemoryAccess, value: bool)
injector and utils only.Call insert when value is true or remove when value is false.
Sourcepub const fn intersection(self, other: MemoryAccess) -> MemoryAccess
Available on crate features injector and utils only.
pub const fn intersection(self, other: MemoryAccess) -> MemoryAccess
injector and utils only.The bitwise and (&) of the bits in self and other.
Sourcepub const fn union(self, other: MemoryAccess) -> MemoryAccess
Available on crate features injector and utils only.
pub const fn union(self, other: MemoryAccess) -> MemoryAccess
injector and utils only.The bitwise or (|) of the bits in self and other.
Sourcepub const fn difference(self, other: MemoryAccess) -> MemoryAccess
Available on crate features injector and utils only.
pub const fn difference(self, other: MemoryAccess) -> MemoryAccess
injector and utils only.The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Sourcepub const fn symmetric_difference(self, other: MemoryAccess) -> MemoryAccess
Available on crate features injector and utils only.
pub const fn symmetric_difference(self, other: MemoryAccess) -> MemoryAccess
injector and utils only.The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub const fn complement(self) -> MemoryAccess
Available on crate features injector and utils only.
pub const fn complement(self) -> MemoryAccess
injector and utils only.The bitwise negation (!) of the bits in self, truncating the result.
Source§impl MemoryAccess
impl MemoryAccess
Sourcepub const fn iter(&self) -> Iter<MemoryAccess> ⓘ
Available on crate features injector and utils only.
pub const fn iter(&self) -> Iter<MemoryAccess> ⓘ
injector and utils only.Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
Sourcepub const fn iter_names(&self) -> IterNames<MemoryAccess> ⓘ
Available on crate features injector and utils only.
pub const fn iter_names(&self) -> IterNames<MemoryAccess> ⓘ
injector and utils only.Yield a set of contained named flags values.
This method is like iter, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Trait Implementations§
Source§impl Binary for MemoryAccess
impl Binary for MemoryAccess
Source§impl BitAnd for MemoryAccess
impl BitAnd for MemoryAccess
Source§fn bitand(self, other: MemoryAccess) -> MemoryAccess
fn bitand(self, other: MemoryAccess) -> MemoryAccess
The bitwise and (&) of the bits in self and other.
Source§type Output = MemoryAccess
type Output = MemoryAccess
& operator.Source§impl BitAndAssign for MemoryAccess
impl BitAndAssign for MemoryAccess
Source§fn bitand_assign(&mut self, other: MemoryAccess)
fn bitand_assign(&mut self, other: MemoryAccess)
The bitwise and (&) of the bits in self and other.
Source§impl BitOr for MemoryAccess
impl BitOr for MemoryAccess
Source§fn bitor(self, other: MemoryAccess) -> MemoryAccess
fn bitor(self, other: MemoryAccess) -> MemoryAccess
The bitwise or (|) of the bits in self and other.
Source§type Output = MemoryAccess
type Output = MemoryAccess
| operator.Source§impl BitOrAssign for MemoryAccess
impl BitOrAssign for MemoryAccess
Source§fn bitor_assign(&mut self, other: MemoryAccess)
fn bitor_assign(&mut self, other: MemoryAccess)
The bitwise or (|) of the bits in self and other.
Source§impl BitXor for MemoryAccess
impl BitXor for MemoryAccess
Source§fn bitxor(self, other: MemoryAccess) -> MemoryAccess
fn bitxor(self, other: MemoryAccess) -> MemoryAccess
The bitwise exclusive-or (^) of the bits in self and other.
Source§type Output = MemoryAccess
type Output = MemoryAccess
^ operator.Source§impl BitXorAssign for MemoryAccess
impl BitXorAssign for MemoryAccess
Source§fn bitxor_assign(&mut self, other: MemoryAccess)
fn bitxor_assign(&mut self, other: MemoryAccess)
The bitwise exclusive-or (^) of the bits in self and other.
Source§impl Clone for MemoryAccess
impl Clone for MemoryAccess
Source§fn clone(&self) -> MemoryAccess
fn clone(&self) -> MemoryAccess
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MemoryAccess
Source§impl Debug for MemoryAccess
impl Debug for MemoryAccess
Source§impl Default for MemoryAccess
impl Default for MemoryAccess
Source§fn default() -> MemoryAccess
fn default() -> MemoryAccess
Source§impl<'de> Deserialize<'de> for MemoryAccess
impl<'de> Deserialize<'de> for MemoryAccess
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MemoryAccess, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MemoryAccess, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for MemoryAccess
impl Display for MemoryAccess
impl Eq for MemoryAccess
Source§impl Extend<MemoryAccess> for MemoryAccess
impl Extend<MemoryAccess> for MemoryAccess
Source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = MemoryAccess>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = MemoryAccess>,
The bitwise or (|) of the bits in each flags value.
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Flags for MemoryAccess
impl Flags for MemoryAccess
Source§const FLAGS: &'static [Flag<MemoryAccess>]
const FLAGS: &'static [Flag<MemoryAccess>]
Source§fn from_bits_retain(bits: u8) -> MemoryAccess
fn from_bits_retain(bits: u8) -> MemoryAccess
Source§fn all_named() -> MemoryAccess
fn all_named() -> MemoryAccess
Source§fn known_bits(&self) -> Self::Bits
fn known_bits(&self) -> Self::Bits
Source§fn unknown_bits(&self) -> Self::Bits
fn unknown_bits(&self) -> Self::Bits
Source§fn contains_unknown_bits(&self) -> bool
fn contains_unknown_bits(&self) -> bool
true if any unknown bits are set.Source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
Source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
Source§fn iter_names(&self) -> IterNames<Self> ⓘ
fn iter_names(&self) -> IterNames<Self> ⓘ
Source§fn iter_defined_names() -> IterDefinedNames<Self> ⓘ
fn iter_defined_names() -> IterDefinedNames<Self> ⓘ
Self::FLAGS.Source§fn iter_equal_names(&self) -> IterEqualNames<Self> ⓘ
fn iter_equal_names(&self) -> IterEqualNames<Self> ⓘ
Source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.Source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.Source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in self and other.Source§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in self and other.Source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in self and other.Source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
Source§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in self and other.Source§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in self, truncating the result.Source§impl FromIterator<MemoryAccess> for MemoryAccess
impl FromIterator<MemoryAccess> for MemoryAccess
Source§fn from_iter<T>(iterator: T) -> MemoryAccesswhere
T: IntoIterator<Item = MemoryAccess>,
fn from_iter<T>(iterator: T) -> MemoryAccesswhere
T: IntoIterator<Item = MemoryAccess>,
The bitwise or (|) of the bits in each flags value.
Source§impl Hash for MemoryAccess
impl Hash for MemoryAccess
Source§impl IntoIterator for MemoryAccess
impl IntoIterator for MemoryAccess
Source§type Item = MemoryAccess
type Item = MemoryAccess
Source§type IntoIter = Iter<MemoryAccess>
type IntoIter = Iter<MemoryAccess>
Source§fn into_iter(self) -> <MemoryAccess as IntoIterator>::IntoIter
fn into_iter(self) -> <MemoryAccess as IntoIterator>::IntoIter
Source§impl LowerHex for MemoryAccess
impl LowerHex for MemoryAccess
Source§impl Not for MemoryAccess
impl Not for MemoryAccess
Source§fn not(self) -> MemoryAccess
fn not(self) -> MemoryAccess
The bitwise negation (!) of the bits in self, truncating the result.
Source§type Output = MemoryAccess
type Output = MemoryAccess
! operator.Source§impl Octal for MemoryAccess
impl Octal for MemoryAccess
Source§impl Ord for MemoryAccess
impl Ord for MemoryAccess
Source§fn cmp(&self, other: &MemoryAccess) -> Ordering
fn cmp(&self, other: &MemoryAccess) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for MemoryAccess
impl PartialEq for MemoryAccess
Source§impl PartialOrd for MemoryAccess
impl PartialOrd for MemoryAccess
Source§impl Serialize for MemoryAccess
impl Serialize for MemoryAccess
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for MemoryAccess
Source§impl Sub for MemoryAccess
impl Sub for MemoryAccess
Source§fn sub(self, other: MemoryAccess) -> MemoryAccess
fn sub(self, other: MemoryAccess) -> MemoryAccess
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Source§type Output = MemoryAccess
type Output = MemoryAccess
- operator.Source§impl SubAssign for MemoryAccess
impl SubAssign for MemoryAccess
Source§fn sub_assign(&mut self, other: MemoryAccess)
fn sub_assign(&mut self, other: MemoryAccess)
The intersection of self with the complement of other (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Auto Trait Implementations§
impl Freeze for MemoryAccess
impl RefUnwindSafe for MemoryAccess
impl Send for MemoryAccess
impl Sync for MemoryAccess
impl Unpin for MemoryAccess
impl UnsafeUnpin for MemoryAccess
impl UnwindSafe for MemoryAccess
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> KeyType for T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.