TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_arch_v8m.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "cmsis_compiler.h"
#include "tfm_core_trustzone.h"
#include "utilities.h"
Include dependency graph for tfm_arch_v8m.h:

Go to the source code of this file.

Macros

#define EXC_RETURN_INDICATOR   (0xFF << 24)
 
#define EXC_RETURN_RES1   (0x1FFFF << 7)
 
#define EXC_RETURN_SECURE_STACK   (1 << 6)
 
#define EXC_RETURN_STACK_RULE   (1 << 5)
 
#define EXC_RETURN_FPU_FRAME_BASIC   (1 << 4)
 
#define EXC_RETURN_MODE_THREAD   (1 << 3)
 
#define EXC_RETURN_STACK_PROCESS   (1 << 2)
 
#define EXC_RETURN_RES0   (0 << 1)
 
#define EXC_RETURN_EXC_SECURE   (1)
 
#define EXC_RETURN_THREAD_S_PSP
 
#define TFM_NS_EXC_DISABLE()   __TZ_set_PRIMASK_NS(1)
 
#define TFM_NS_EXC_ENABLE()   __TZ_set_PRIMASK_NS(0)
 

Functions

__STATIC_INLINE bool is_return_secure_stack (uint32_t lr)
 Check whether Secure or Non-secure stack is used to restore stack frame on exception return. More...
 
__STATIC_INLINE bool is_stack_alloc_fp_space (uint32_t lr)
 Check whether the stack frame for this exception has space allocated for Floating Point(FP) state information. More...
 
__STATIC_INLINE void tfm_arch_set_psplim (uint32_t psplim)
 Set PSPLIM register. More...
 
__STATIC_INLINE uintptr_t tfm_arch_seal_thread_stack (uintptr_t stk)
 Seal the thread stack. More...
 
__STATIC_INLINE void tfm_arch_update_ctx (struct tfm_arch_ctx_t *p_actx)
 Update architecture context value into hardware. More...
 
__STATIC_INLINE void tfm_arch_init_secure_msp (uint32_t msplim)
 Set MSPLIM register and seal the MSP. More...
 

Macro Definition Documentation

#define EXC_RETURN_EXC_SECURE   (1)

Definition at line 25 of file tfm_arch_v8m.h.

#define EXC_RETURN_FPU_FRAME_BASIC   (1 << 4)

Definition at line 21 of file tfm_arch_v8m.h.

#define EXC_RETURN_INDICATOR   (0xFF << 24)

Definition at line 17 of file tfm_arch_v8m.h.

#define EXC_RETURN_MODE_THREAD   (1 << 3)

Definition at line 22 of file tfm_arch_v8m.h.

#define EXC_RETURN_RES0   (0 << 1)

Definition at line 24 of file tfm_arch_v8m.h.

#define EXC_RETURN_RES1   (0x1FFFF << 7)

Definition at line 18 of file tfm_arch_v8m.h.

#define EXC_RETURN_SECURE_STACK   (1 << 6)

Definition at line 19 of file tfm_arch_v8m.h.

#define EXC_RETURN_STACK_PROCESS   (1 << 2)

Definition at line 23 of file tfm_arch_v8m.h.

#define EXC_RETURN_STACK_RULE   (1 << 5)

Definition at line 20 of file tfm_arch_v8m.h.

#define EXC_RETURN_THREAD_S_PSP
Value:
#define EXC_RETURN_EXC_SECURE
Definition: tfm_arch_v8m.h:25
#define EXC_RETURN_STACK_PROCESS
Definition: tfm_arch_v8m.h:23
#define EXC_RETURN_FPU_FRAME_BASIC
Definition: tfm_arch_v8m.h:21
#define EXC_RETURN_MODE_THREAD
Definition: tfm_arch_v8m.h:22
#define EXC_RETURN_STACK_RULE
Definition: tfm_arch_v8m.h:20
#define EXC_RETURN_RES1
Definition: tfm_arch_v8m.h:18
#define EXC_RETURN_RES0
Definition: tfm_arch_v8m.h:24
#define EXC_RETURN_INDICATOR
Definition: tfm_arch_v8m.h:17
#define EXC_RETURN_SECURE_STACK
Definition: tfm_arch_v8m.h:19

Definition at line 28 of file tfm_arch_v8m.h.

#define TFM_NS_EXC_DISABLE ( )    __TZ_set_PRIMASK_NS(1)

Definition at line 68 of file tfm_arch_v8m.h.

#define TFM_NS_EXC_ENABLE ( )    __TZ_set_PRIMASK_NS(0)

Definition at line 70 of file tfm_arch_v8m.h.

Function Documentation

__STATIC_INLINE bool is_return_secure_stack ( uint32_t  lr)

Check whether Secure or Non-secure stack is used to restore stack frame on exception return.

Parameters
[in]lrLR register containing the EXC_RETURN value.
Return values
trueSecure stack is used to restore stack frame on exception return.
falseNon-secure stack is used to restore stack frame on exception return.

Definition at line 83 of file tfm_arch_v8m.h.

__STATIC_INLINE bool is_stack_alloc_fp_space ( uint32_t  lr)

Check whether the stack frame for this exception has space allocated for Floating Point(FP) state information.

Parameters
[in]lrLR register containing the EXC_RETURN value.
Return values
trueThe stack allocates space for FP information
falseThe stack doesn't allocate space for FP information

Definition at line 97 of file tfm_arch_v8m.h.

Here is the caller graph for this function:

__STATIC_INLINE void tfm_arch_init_secure_msp ( uint32_t  msplim)

Set MSPLIM register and seal the MSP.

This function assumes that the caller is using PSP when calling this function.

Parameters
[in]msplimRegister value to be written into MSPLIM.

Definition at line 151 of file tfm_arch_v8m.h.

__STATIC_INLINE uintptr_t tfm_arch_seal_thread_stack ( uintptr_t  stk)

Seal the thread stack.

This function must be called only when the caller is using MSP.

Parameters
[in]stkThread stack address.
Return values
stackUpdated thread stack address.

Definition at line 121 of file tfm_arch_v8m.h.

__STATIC_INLINE void tfm_arch_set_psplim ( uint32_t  psplim)

Set PSPLIM register.

Parameters
[in]psplimRegister value to be written into PSPLIM.

Definition at line 107 of file tfm_arch_v8m.h.

__STATIC_INLINE void tfm_arch_update_ctx ( struct tfm_arch_ctx_t p_actx)

Update architecture context value into hardware.

Parameters
[in]p_actxPointer of context data

Definition at line 137 of file tfm_arch_v8m.h.