Ken Liu | 5885250 | 2021-08-10 15:48:23 +0800 | [diff] [blame] | 1 | /* |
Kevin Peng | 1de1e7a | 2022-06-07 17:38:01 +0800 | [diff] [blame] | 2 | * Copyright (c) 2021-2022, Arm Limited. All rights reserved. |
Ken Liu | 5885250 | 2021-08-10 15:48:23 +0800 | [diff] [blame] | 3 | * |
| 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 Liu | 3a80caf | 2022-06-17 14:58:01 +0800 | [diff] [blame] | 19 | #if (defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) |
| 20 | |
Kevin Peng | 1de1e7a | 2022-06-07 17:38:01 +0800 | [diff] [blame] | 21 | /* Attributes for psa api secure gateway functions */ |
| 22 | #if defined(__GNUC__) && !defined(__ARMCC_VERSION) |
| 23 | /* |
Anton Komlev | c88e2ac | 2024-09-12 16:46:39 +0100 | [diff] [blame^] | 24 | * LLVM offers 'noduplicate' attribute as 'noclone' equivalent in GNUARM |
| 25 | */ |
| 26 | #if defined(__clang__) |
| 27 | #define noclone noduplicate |
| 28 | #endif /* __clang__ */ |
| 29 | /* |
Kevin Peng | 1de1e7a | 2022-06-07 17:38:01 +0800 | [diff] [blame] | 30 | * GNUARM requires noclone attribute to protect gateway function symbol from |
| 31 | * being renamed and cloned |
| 32 | */ |
| 33 | #define __tz_c_veneer \ |
chesun01 | 7e757b0 | 2023-11-07 14:12:40 +0800 | [diff] [blame] | 34 | __attribute__((cmse_nonsecure_entry, noclone)) |
Kevin Peng | 1de1e7a | 2022-06-07 17:38:01 +0800 | [diff] [blame] | 35 | #define __tz_naked_veneer \ |
chesun01 | 7e757b0 | 2023-11-07 14:12:40 +0800 | [diff] [blame] | 36 | __attribute__((cmse_nonsecure_entry, noclone, naked)) |
Ken Liu | 3a80caf | 2022-06-17 14:58:01 +0800 | [diff] [blame] | 37 | |
Kevin Peng | 1de1e7a | 2022-06-07 17:38:01 +0800 | [diff] [blame] | 38 | #else /* __GNUC__ && !__ARMCC_VERSION */ |
Ken Liu | 3a80caf | 2022-06-17 14:58:01 +0800 | [diff] [blame] | 39 | |
Kevin Peng | 1de1e7a | 2022-06-07 17:38:01 +0800 | [diff] [blame] | 40 | #define __tz_c_veneer \ |
chesun01 | 7e757b0 | 2023-11-07 14:12:40 +0800 | [diff] [blame] | 41 | __attribute__((cmse_nonsecure_entry)) |
Kevin Peng | 1de1e7a | 2022-06-07 17:38:01 +0800 | [diff] [blame] | 42 | #define __tz_naked_veneer \ |
chesun01 | 7e757b0 | 2023-11-07 14:12:40 +0800 | [diff] [blame] | 43 | __attribute__((cmse_nonsecure_entry, naked)) |
Ken Liu | 3a80caf | 2022-06-17 14:58:01 +0800 | [diff] [blame] | 44 | |
Kevin Peng | 1de1e7a | 2022-06-07 17:38:01 +0800 | [diff] [blame] | 45 | #endif /* __GNUC__ && !__ARMCC_VERSION */ |
| 46 | |
Ken Liu | 3a80caf | 2022-06-17 14:58:01 +0800 | [diff] [blame] | 47 | #endif /* __ARM_FEATURE_CMSE */ |
| 48 | |
Ken Liu | 5885250 | 2021-08-10 15:48:23 +0800 | [diff] [blame] | 49 | #endif /* __SECURITY_DEFS_H__ */ |