From: Sam Edwards <cfsworks@gmail.com>
To: u-boot@lists.denx.de
Cc: Tom Rini <trini@konsulko.com>, Sam Edwards <CFSworks@gmail.com>
Subject: [PATCH] psci: fix use of clobbered registers in asm
Date: Sat, 27 May 2023 18:09:42 -0600 [thread overview]
Message-ID: <20230528000942.231907-1-CFSworks@gmail.com> (raw)
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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/armv7/psci.S b/arch/arm/cpu/armv7/psci.S
index 6c066e50d9..41428728b7 100644
--- a/arch/arm/cpu/armv7/psci.S
+++ b/arch/arm/cpu/armv7/psci.S
@@ -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)
--
2.39.2
next reply other threads:[~2023-05-28 0:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-28 0:09 Sam Edwards [this message]
2023-06-21 18:40 ` [PATCH] psci: fix use of clobbered registers in asm Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230528000942.231907-1-CFSworks@gmail.com \
--to=cfsworks@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox