summaryrefslogtreecommitdiff
path: root/include/common
diff options
context:
space:
mode:
authorOlivier Deprez <olivier.deprez@arm.com>2020-08-18 14:55:16 +0000
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2020-08-18 14:55:16 +0000
commit953ec59b3ed74380c690e550c85eefe19b07716f (patch)
tree2293a7fcfa63ed11dd88b4bb65e1249f9052c79b /include/common
parent56c3942b4eaa2ad85749b11d5895fad6bfb5b61c (diff)
parent7fac162cd9439783ef60aaf266d22ad454445ace (diff)
Merge changes from topic "af/add_branch_protection_makefiles"
* changes: TFTF: Add ARMv8.5 BTI support in makefiles TFTF: Add ARMv8.5 BTI support in xlat_tables_v2 library TFTF: Add ARMv8.5 BTI support in assembler files TFTF: Add ARMv8.5 BTI-related definitions
Diffstat (limited to 'include/common')
-rw-r--r--include/common/aarch64/asm_macros.S24
-rw-r--r--include/common/asm_macros_common.S8
2 files changed, 30 insertions, 2 deletions
diff --git a/include/common/aarch64/asm_macros.S b/include/common/aarch64/asm_macros.S
index 5298ae0..d829133 100644
--- a/include/common/aarch64/asm_macros.S
+++ b/include/common/aarch64/asm_macros.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -192,4 +192,26 @@
b \label_error
.endm
+ /*
+ * Helper macro to read system register value into x0
+ */
+ .macro read reg:req
+#if ENABLE_BTI
+ bti j
+#endif
+ mrs x0, \reg
+ ret
+ .endm
+
+ /*
+ * Helper macro to write value from x1 to system register
+ */
+ .macro write reg:req
+#if ENABLE_BTI
+ bti j
+#endif
+ msr \reg, x1
+ ret
+ .endm
+
#endif /* __ASM_MACROS_S__ */
diff --git a/include/common/asm_macros_common.S b/include/common/asm_macros_common.S
index d38dcce..1cf94f4 100644
--- a/include/common/asm_macros_common.S
+++ b/include/common/asm_macros_common.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -7,6 +7,12 @@
#ifndef __ASM_MACROS_COMMON_S__
#define __ASM_MACROS_COMMON_S__
+#include <lib/utils_def.h>
+
+#if ENABLE_BTI && !ARM_ARCH_AT_LEAST(8, 5)
+#error Branch Target Identification requires ARM_ARCH_MINOR >= 5
+#endif
+
/*
* This macro is used to create a function label and place the
* code into a separate text section based on the function name