diff options
author | Alexei Fedorov <Alexei.Fedorov@arm.com> | 2020-06-17 19:13:42 +0100 |
---|---|---|
committer | Alexei Fedorov <Alexei.Fedorov@arm.com> | 2020-08-18 14:52:44 +0000 |
commit | d6fdb6b10147038d99643a7547821c3cff76ce76 (patch) | |
tree | dd15b765586801ebfaefd26a9c3883343f16a93b /lib | |
parent | 45ada40c895b1087de08c05d6d6a311cb0f47c79 (diff) | |
download | tf-a-tests-d6fdb6b10147038d99643a7547821c3cff76ce76.tar.gz |
TFTF: Add ARMv8.5 BTI support in xlat_tables_v2 library
This patch adds BTI-related changes in xlat_tables_v2 library
which fully correspond to those in TF-A source tree.
Signed-off-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Change-Id: I77f3ae7e9a365406ebb3edd500dbc71d3f07ecad
Diffstat (limited to 'lib')
-rw-r--r-- | lib/xlat_tables_v2/xlat_tables_core.c | 12 | ||||
-rw-r--r-- | lib/xlat_tables_v2/xlat_tables_utils.c | 9 |
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/xlat_tables_v2/xlat_tables_core.c b/lib/xlat_tables_v2/xlat_tables_core.c index 933b17a12..c3dd4453e 100644 --- a/lib/xlat_tables_v2/xlat_tables_core.c +++ b/lib/xlat_tables_v2/xlat_tables_core.c @@ -1,9 +1,10 @@ /* - * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ +#include <arch_features.h> #include <arch_helpers.h> #include <assert.h> #include <debug.h> @@ -193,6 +194,15 @@ uint64_t xlat_desc(const xlat_ctx_t *ctx, uint32_t attr, if (mem_type == MT_MEMORY) { desc |= LOWER_ATTRS(ATTR_IWBWA_OWBWA_NTR_INDEX | ISH); +#if ENABLE_BTI + /* Check if Branch Target Identification is implemented */ + if (is_armv8_5_bti_present() && + ((attr & (MT_TYPE_MASK | MT_RW | + MT_EXECUTE_NEVER)) == MT_CODE)) { + /* Set GP bit for block and page code entries */ + desc |= GP; + } +#endif } else { assert(mem_type == MT_NON_CACHEABLE); desc |= LOWER_ATTRS(ATTR_NON_CACHEABLE_INDEX | OSH); diff --git a/lib/xlat_tables_v2/xlat_tables_utils.c b/lib/xlat_tables_v2/xlat_tables_utils.c index 41c01aee7..168d492fc 100644 --- a/lib/xlat_tables_v2/xlat_tables_utils.c +++ b/lib/xlat_tables_v2/xlat_tables_utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -94,6 +94,13 @@ static void xlat_desc_print(const xlat_ctx_t *ctx, uint64_t desc) } printf(((LOWER_ATTRS(NS) & desc) != 0ULL) ? "-NS" : "-S"); + +#ifdef __aarch64__ + /* Check Guarded Page bit */ + if ((desc & GP) != 0ULL) { + printf("-GP"); + } +#endif } static const char * const level_spacers[] = { |