aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Gautier <yann.gautier@st.com>2020-01-28 11:45:38 +0100
committerYann Gautier <yann.gautier@st.com>2020-02-21 15:32:38 +0100
commit30f310052672d2500479989846380d050033cd44 (patch)
tree547070f51d04d1f96e77453ae25aff876545c38a /include
parent876b38497eff517e751c5f627d62065ce94c242a (diff)
downloadplatform_external_arm-trusted-firmware-30f310052672d2500479989846380d050033cd44.tar.gz
platform_external_arm-trusted-firmware-30f310052672d2500479989846380d050033cd44.tar.bz2
platform_external_arm-trusted-firmware-30f310052672d2500479989846380d050033cd44.zip
el3_entrypoint_common: avoid overwriting arg3
At each BL entry point, the registers r9 to r12 are used to save info from the previous BL parameters put in r0 to r3. But zeromem uses r12, leading to a corruption of arg3. Therefore this change copies r12 to r7 before zeromem() call and restores r12 afterwards. It may be better to save it in r7 in el3_arch_init_common and not at the entrypoint as r7 could be used in other functions, especially platform ones. This is a fix for Task T661. Change-Id: Icc11990c69b5d4c542d08aca1a77b1f754b61a53 Signed-off-by: Yann Gautier <yann.gautier@st.com>
Diffstat (limited to 'include')
-rw-r--r--include/arch/aarch32/el3_common_macros.S10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/arch/aarch32/el3_common_macros.S b/include/arch/aarch32/el3_common_macros.S
index 7559de446..4fd746d5a 100644
--- a/include/arch/aarch32/el3_common_macros.S
+++ b/include/arch/aarch32/el3_common_macros.S
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -329,6 +329,11 @@
bl inv_dcache_range
#endif
+ /*
+ * zeromem uses r12 whereas it is used to save previous BL arg3,
+ * save it in r7
+ */
+ mov r7, r12
ldr r0, =__BSS_START__
ldr r1, =__BSS_SIZE__
bl zeromem
@@ -339,6 +344,9 @@
bl zeromem
#endif
+ /* Restore r12 */
+ mov r12, r7
+
#if defined(IMAGE_BL1) || (defined(IMAGE_BL2) && BL2_AT_EL3 && BL2_IN_XIP_MEM)
/* -----------------------------------------------------
* Copy data from ROM to RAM.