aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2020-04-02 16:20:21 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2020-04-03 11:56:51 +0900
commit3cde15fadea9cee8863c05e6908166166e5bca9b (patch)
tree10b62c0df50b1174aef89f8f26a00c942ce2cf93 /lib
parentcb2e35b58a1bc370f80d54ce107c858bc60ab612 (diff)
downloadplatform_external_arm-trusted-firmware-3cde15fadea9cee8863c05e6908166166e5bca9b.tar.gz
platform_external_arm-trusted-firmware-3cde15fadea9cee8863c05e6908166166e5bca9b.tar.bz2
platform_external_arm-trusted-firmware-3cde15fadea9cee8863c05e6908166166e5bca9b.zip
xlat_tables_v2: use get_current_el_maybe_constant() in is_dcache_enabled()
Using get_current_el_maybe_constant() produces more optimized code because in most cases, we know the exception level at build-time. For example, BL31 runs at EL3, so unneeded code will be trimmed. [before] 0000000000000000 <is_dcache_enabled>: 0: d5384240 mrs x0, currentel 4: 53020c00 ubfx w0, w0, #2, #2 8: 7100041f cmp w0, #0x1 c: 54000081 b.ne 1c <is_dcache_enabled+0x1c> // b.any 10: d5381000 mrs x0, sctlr_el1 14: 53020800 ubfx w0, w0, #2, #1 18: d65f03c0 ret 1c: 7100081f cmp w0, #0x2 20: 54000061 b.ne 2c <is_dcache_enabled+0x2c> // b.any 24: d53c1000 mrs x0, sctlr_el2 28: 17fffffb b 14 <is_dcache_enabled+0x14> 2c: d53e1000 mrs x0, sctlr_el3 30: 17fffff9 b 14 <is_dcache_enabled+0x14> [after] 0000000000000000 <is_dcache_enabled>: 0: d53e1000 mrs x0, sctlr_el3 4: 53020800 ubfx w0, w0, #2, #1 8: d65f03c0 ret Change-Id: I3698fae9b517022ff9fbfd4cad3a320c6e137e10 Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/xlat_tables_v2/aarch64/xlat_tables_arch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/xlat_tables_v2/aarch64/xlat_tables_arch.c b/lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
index 8eeeea1dd..3832b0703 100644
--- a/lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
+++ b/lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -135,7 +135,7 @@ bool is_mmu_enabled_ctx(const xlat_ctx_t *ctx)
bool is_dcache_enabled(void)
{
- unsigned int el = (unsigned int)GET_EL(read_CurrentEl());
+ unsigned int el = get_current_el_maybe_constant();
if (el == 1U) {
return (read_sctlr_el1() & SCTLR_C_BIT) != 0U;