From: Michael Ellerman <mpe@ellerman.id.au>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH v3 2/5] powerpc: Add current_stack_pointer as a register global
Date: Thu, 20 Feb 2020 22:51:38 +1100 [thread overview]
Message-ID: <20200220115141.2707-2-mpe@ellerman.id.au> (raw)
In-Reply-To: <20200220115141.2707-1-mpe@ellerman.id.au>
From: Christophe Leroy <christophe.leroy@c-s.fr>
current_stack_frame() doesn't return the stack pointer, but the
caller's stack frame. See commit bfe9a2cfe91a ("powerpc: Reimplement
__get_SP() as a function not a define") and commit
acf620ecf56c ("powerpc: Rename __get_SP() to current_stack_pointer()")
for details.
In some cases this is overkill or incorrect, as it doesn't return the
current value of r1.
So add a current_stack_pointer register global to get the value of r1
directly.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
[mpe: Split out of other patch, tweak change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/435e0030e942507766cbef5bc95f906262d2ccf2.1579849665.git.christophe.leroy@c-s.fr
---
arch/powerpc/include/asm/reg.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 1b1ffdba6097..da5cab038e25 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1450,6 +1450,8 @@ static inline void mtsrin(u32 val, u32 idx)
extern unsigned long current_stack_frame(void);
+register unsigned long current_stack_pointer asm("r1");
+
extern unsigned long scom970_read(unsigned int address);
extern void scom970_write(unsigned int address, unsigned long value);
--
2.21.1
v3: Split out, and use current_stack_pointer not get_sp()
next prev parent reply other threads:[~2020-02-20 11:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 11:51 [PATCH v3 1/5] powerpc: Rename current_stack_pointer() to current_stack_frame() Michael Ellerman
2020-02-20 11:51 ` Michael Ellerman [this message]
2020-02-20 11:51 ` [PATCH v3 3/5] powerpc/irq: Use current_stack_pointer in check_stack_overflow() Michael Ellerman
2020-02-20 11:51 ` [PATCH v3 4/5] powerpc/irq: use IS_ENABLED() " Michael Ellerman
2020-02-20 11:51 ` [PATCH v3 5/5] powerpc/irq: Use current_stack_pointer in do_IRQ() Michael Ellerman
2020-02-20 13:26 ` [PATCH v3 1/5] powerpc: Rename current_stack_pointer() to current_stack_frame() Christophe Leroy
2020-03-06 0:27 ` Michael Ellerman
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=20200220115141.2707-2-mpe@ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=linuxppc-dev@ozlabs.org \
/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;
as well as URLs for NNTP newsgroup(s).