Skip to content

Commit

Permalink
nds32: Add macro definition for offset of lp register on stack
Browse files Browse the repository at this point in the history
Use macro to replace the magic number.

Signed-off-by: Zong Li <zong@andestech.com>
Acked-by: Greentime Hu <greentime@andestech.com>
Signed-off-by: Greentime Hu <greentime@andestech.com>
  • Loading branch information
Zong Li authored and Greentime Hu committed Sep 4, 2018
1 parent c5fdf7e commit 95f93ed
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions arch/nds32/include/asm/nds32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion arch/nds32/kernel/stacktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion arch/nds32/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {

Expand Down

0 comments on commit 95f93ed

Please sign in to comment.