blob: a0483569df1e0c398d653e40df2b501935a93d9e [file] [log] [blame]
Ken Liu58852502021-08-10 15:48:23 +08001/*
Kevin Peng1de1e7a2022-06-07 17:38:01 +08002 * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
Ken Liu58852502021-08-10 15:48:23 +08003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __SECURITY_DEFS_H__
9#define __SECURITY_DEFS_H__
10
11/* Generic security-related definitions */
12
13/*
14 * Stack SEAL is involved since Security Extension exists, it becomes
15 * a generic security defs used by both SPM and Partitions.
16 */
17#define STACK_SEAL_PATTERN 0xFEF5EDA5
18
Ken Liu3a80caf2022-06-17 14:58:01 +080019#if (defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))
20
Kevin Peng1de1e7a2022-06-07 17:38:01 +080021/* Attributes for psa api secure gateway functions */
22#if defined(__GNUC__) && !defined(__ARMCC_VERSION)
23/*
24 * GNUARM requires noclone attribute to protect gateway function symbol from
25 * being renamed and cloned
26 */
27#define __tz_c_veneer \
chesun017e757b02023-11-07 14:12:40 +080028 __attribute__((cmse_nonsecure_entry, noclone))
Kevin Peng1de1e7a2022-06-07 17:38:01 +080029#define __tz_naked_veneer \
chesun017e757b02023-11-07 14:12:40 +080030 __attribute__((cmse_nonsecure_entry, noclone, naked))
Ken Liu3a80caf2022-06-17 14:58:01 +080031
Kevin Peng1de1e7a2022-06-07 17:38:01 +080032#else /* __GNUC__ && !__ARMCC_VERSION */
Ken Liu3a80caf2022-06-17 14:58:01 +080033
Kevin Peng1de1e7a2022-06-07 17:38:01 +080034#define __tz_c_veneer \
chesun017e757b02023-11-07 14:12:40 +080035 __attribute__((cmse_nonsecure_entry))
Kevin Peng1de1e7a2022-06-07 17:38:01 +080036#define __tz_naked_veneer \
chesun017e757b02023-11-07 14:12:40 +080037 __attribute__((cmse_nonsecure_entry, naked))
Ken Liu3a80caf2022-06-17 14:58:01 +080038
Kevin Peng1de1e7a2022-06-07 17:38:01 +080039#endif /* __GNUC__ && !__ARMCC_VERSION */
40
Ken Liu3a80caf2022-06-17 14:58:01 +080041#endif /* __ARM_FEATURE_CMSE */
42
Ken Liu58852502021-08-10 15:48:23 +080043#endif /* __SECURITY_DEFS_H__ */