Skip to content

Commit

Permalink
soc: arm: viper: Fix callee saved register corruption in el3 init
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Abhishek-brcm authored and carlescufi committed Jul 13, 2020
1 parent 8344b80 commit 3a63e85
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions soc/arm/bcm_vk/viper/plat_core.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ 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)
msr ICC_SRE_EL3, x0
/* L2 config */
bl plat_l2_init

mov x30, x19
mov x30, x20
ret


Expand Down

0 comments on commit 3a63e85

Please sign in to comment.