From: Zong Li <zong@andestech.com>
To: <green.hu@gmail.com>, <linux-kernel@vger.kernel.org>
Cc: <zongbox@gmail.com>, <greentime@andestech.com>,
Zong Li <zong@andestech.com>
Subject: [PATCH 2/2] nds32: Add macro definition for offset of lp register on stack
Date: Mon, 20 Aug 2018 10:15:05 +0800 [thread overview]
Message-ID: <12f4abaca33749b0d8aa697866797d33e3ab12ce.1534730156.git.zong@andestech.com> (raw)
In-Reply-To: <cover.1534730156.git.zong@andestech.com>
Use macro to replace the magic number.
Signed-off-by: Zong Li <zong@andestech.com>
---
arch/nds32/include/asm/nds32.h | 1 +
arch/nds32/kernel/stacktrace.c | 2 +-
arch/nds32/kernel/traps.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/nds32/include/asm/nds32.h b/arch/nds32/include/asm/nds32.h
index 19b1939..68c3815 100644
--- a/arch/nds32/include/asm/nds32.h
+++ b/arch/nds32/include/asm/nds32.h
@@ -17,6 +17,7 @@
#else
#define FP_OFFSET (-2)
#endif
+#define LP_OFFSET (-1)
extern void __init early_trap_init(void);
static inline void GIE_ENABLE(void)
diff --git a/arch/nds32/kernel/stacktrace.c b/arch/nds32/kernel/stacktrace.c
index 36bc870..d974c0c 100644
--- a/arch/nds32/kernel/stacktrace.c
+++ b/arch/nds32/kernel/stacktrace.c
@@ -31,7 +31,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
&& (fpn >= (unsigned long *)TASK_SIZE)) {
unsigned long lpp, fpp;
- lpp = fpn[-1];
+ lpp = fpn[LP_OFFSET];
fpp = fpn[FP_OFFSET];
if (!__kernel_text_address(lpp))
break;
diff --git a/arch/nds32/kernel/traps.c b/arch/nds32/kernel/traps.c
index f432310..b0b85b7 100644
--- a/arch/nds32/kernel/traps.c
+++ b/arch/nds32/kernel/traps.c
@@ -117,7 +117,7 @@ static void __dump(struct task_struct *tsk, unsigned long *base_reg)
!((unsigned long)base_reg & 0x3) &&
((unsigned long)base_reg >= TASK_SIZE)) {
unsigned long next_fp;
- ret_addr = base_reg[-1];
+ ret_addr = base_reg[LP_OFFSET];
next_fp = base_reg[FP_OFFSET];
if (__kernel_text_address(ret_addr)) {
--
2.7.4
next prev parent reply other threads:[~2018-08-20 2:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 2:15 [PATCH 0/2] Remove the deprecated ABI implementation Zong Li
2018-08-20 2:15 ` [PATCH 1/2] nds32: " Zong Li
2018-08-20 2:15 ` Zong Li [this message]
2018-08-21 7:02 ` [PATCH 0/2] " Greentime Hu
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=12f4abaca33749b0d8aa697866797d33e3ab12ce.1534730156.git.zong@andestech.com \
--to=zong@andestech.com \
--cc=green.hu@gmail.com \
--cc=greentime@andestech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zongbox@gmail.com \
/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).