cortex_m::cmse

Struct TestTarget

Source
pub struct TestTarget { /* private fields */ }
Expand description

Abstraction of TT instructions and helper functions to determine the security and privilege attribute of a target address, accessed in different ways.

Implementations§

Source§

impl TestTarget

Source

pub fn check(addr: *mut u32, access_type: AccessType) -> Self

Creates a Test Target Response Payload by testing addr using access_type.

Source

pub fn check_range( addr: *mut u32, size: usize, access_type: AccessType, ) -> Option<Self>

Creates a Test Target Response Payload by testing the zone from addr to addr + size - 1 using access_type. Returns None if:

  • the address zone overlaps SAU, IDAU or MPU region boundaries
  • size is 0
  • addr + size - 1 overflows
Source

pub fn access_type(self) -> AccessType

Access type that was used for this test target.

Source

pub fn as_u32(self) -> u32

Get the raw u32 value returned by the TT instruction used.

Source

pub fn readable(self) -> bool

Read accessibility of the target address. Only returns the MPU settings without checking the Security state of the target. For Unprivileged and NonSecureUnprivileged access types, returns the permissions for unprivileged access, regardless of whether the current mode is privileged or unprivileged. Returns false if the TT instruction was executed from an unprivileged mode and the NonSecure access type was not specified. Returns false if the address matches multiple MPU regions.

Source

pub fn read_and_writable(self) -> bool

Read and write accessibility of the target address. Only returns the MPU settings without checking the Security state of the target. For Unprivileged and NonSecureUnprivileged access types, returns the permissions for unprivileged access, regardless of whether the current mode is privileged or unprivileged. Returns false if the TT instruction was executed from an unprivileged mode and the NonSecure access type was not specified. Returns false if the address matches multiple MPU regions.

Source

pub fn mpu_region(self) -> Option<u8>

Indicate the MPU region number containing the target address. Returns None if the value is not valid:

  • the MPU is not implemented or MPU_CTRL.ENABLE is set to zero
  • the register argument specified by the MREGION field does not match any enabled MPU regions
  • the address matched multiple MPU regions
  • the address specified by the SREGION field is exempt from the secure memory attribution
  • the TT instruction was executed from an unprivileged mode and the A flag was not specified.
Source

pub fn secure(self) -> bool

Indicates the Security attribute of the target address. Independent of AccessType. Always zero when the test target is done in the Non-Secure state.

Source

pub fn ns_readable(self) -> bool

Non-Secure Read accessibility of the target address. Same as readable() && !secure()

Source

pub fn ns_read_and_writable(self) -> bool

Non-Secure Read and Write accessibility of the target address. Same as read_and_writable() && !secure()

Source

pub fn idau_region(self) -> Option<u8>

Indicate the IDAU region number containing the target address. Independent of AccessType. Returns None if the value is not valid:

  • the IDAU cannot provide a region number
  • the address is exempt from security attribution
  • the test target is done from Non-Secure state
Source

pub fn sau_region(self) -> Option<u8>

Indicate the SAU region number containing the target address. Independent of AccessType. Returns None if the value is not valid:

  • SAU_CTRL.ENABLE is set to zero
  • the register argument specified in the SREGION field does not match any enabled SAU regions
  • the address specified matches multiple enabled SAU regions
  • the address specified by the SREGION field is exempt from the secure memory attribution
  • the TT instruction was executed from the Non-secure state or the Security Extension is not implemented

Trait Implementations§

Source§

impl Clone for TestTarget

Source§

fn clone(&self) -> TestTarget

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TestTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TestTarget

Source§

fn eq(&self, other: &TestTarget) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TestTarget

Source§

impl StructuralPartialEq for TestTarget

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.