From 3a63e8564ea174be9660630f2e5e6f89e435ee08 Mon Sep 17 00:00:00 2001 From: Abhishek Shah Date: Fri, 10 Jul 2020 11:58:28 +0530 Subject: [PATCH] soc: arm: viper: Fix callee saved register corruption in el3 init x19 is callee saved register. z_arch_el3_plat_init being a callee, it should save it before using it. However, at this point, stack has not been setup. So, let's just use x20 instead which is not being used caller yet. This bug was causing VBAR_EL1 corruption, but since [10:0] bits are reserved, bug was hidden. Signed-off-by: Abhishek Shah --- soc/arm/bcm_vk/viper/plat_core.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soc/arm/bcm_vk/viper/plat_core.S b/soc/arm/bcm_vk/viper/plat_core.S index c8f602afce3..61b2dccc7c3 100644 --- a/soc/arm/bcm_vk/viper/plat_core.S +++ b/soc/arm/bcm_vk/viper/plat_core.S @@ -20,7 +20,7 @@ GTEXT(plat_l2_init) SECTION_FUNC(TEXT, z_arch_el3_plat_init) - mov x19, x30 + mov x20, x30 /* Enable GIC v3 system interface */ mov_imm x0, (ICC_SRE_ELx_DFB | ICC_SRE_ELx_DIB | \ ICC_SRE_ELx_SRE | ICC_SRE_EL3_EN) @@ -28,7 +28,7 @@ SECTION_FUNC(TEXT, z_arch_el3_plat_init) /* L2 config */ bl plat_l2_init - mov x30, x19 + mov x30, x20 ret