1 /*
2  * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __TFM_CORE_TRUSTZONE_H__
9 #define __TFM_CORE_TRUSTZONE_H__
10 
11 #include "security_defs.h"
12 
13 /* This file holds specification or design defined TrustZone settings. */
14 
15 /*
16  * To avoid faking jump with FNC_RETURN or EXC_RETURN in NSPE, seal the secure
17  * stack by putting two words (8 bytes) at the start of stack (higher address)
18  * of it. The Armv8-M Architecture Reference Manual recommends to use seal value
19  * 0xFEF5EDA5.
20  */
21 #define TFM_STACK_SEALED_SIZE           8
22 #define TFM_STACK_SEAL_VALUE            STACK_SEAL_PATTERN
23 #define TFM_STACK_SEAL_VALUE_64         (uint64_t)0xFEF5EDA5FEF5EDA5
24 
25 /*
26  * The numbers in 32bit words while basic FP involved in preempted context:
27  * S0 - S15, FPSCR, Reserved
28  */
29 #define TFM_BASIC_FP_CONTEXT_WORDS      18
30 
31 /*
32  * The numbers in 32bit words while addtional FP involved in preempted context:
33  * S16 - S31
34  */
35 #define TFM_ADDTIONAL_FP_CONTEXT_WORDS  16
36 
37 /*
38  * SG sets LR[0] to ZERO indicates a non-secure to secure transition.
39  * Make sure to apply this mask on a 'LR' just after 'SG' (in veneer).
40  */
41 #define TFM_VENEER_LR_BIT0_MASK         1
42 
43 #endif /* __TFM_CORE_TRUSTZONE_H__ */
44