]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
psci: fix use of clobbered registers in asm
authorSam Edwards <cfsworks@gmail.com>
Sun, 28 May 2023 00:09:42 +0000 (18:09 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 20 Jun 2023 20:08:13 +0000 (16:08 -0400)
The functions `psci_get_context_id` and `psci_get_target_pc`
are written in C, so the C compiler may clobber registers r0-r3.
Do not use these registers to save data across calls.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
arch/arm/cpu/armv7/psci.S

index 6c066e50d91eff30e4d19eb65633d580f83f0d89..41428728b7b466c7c209653fa1cbe81d71466021 100644 (file)
@@ -311,11 +311,11 @@ ENTRY(psci_cpu_entry)
        bl      psci_arch_cpu_entry
 
        bl      psci_get_cpu_id                 @ CPU ID => r0
-       mov     r2, r0                          @ CPU ID => r2
        bl      psci_get_context_id             @ context id => r0
-       mov     r1, r0                          @ context id => r1
-       mov     r0, r2                          @ CPU ID => r0
+       push    {r0}                            @ save context id
+       bl      psci_get_cpu_id                 @ CPU ID => r0
        bl      psci_get_target_pc              @ target PC => r0
+       pop     {r1}                            @ context id => r1
        b       _do_nonsec_entry
 ENDPROC(psci_cpu_entry)