nds32: Add macro definition for offset of lp register on stack

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>
This commit is contained in:
Zong Li 2018-08-20 09:51:29 +08:00 committed by Greentime Hu
parent c5fdf7e00d
commit 95f93ed7fe
3 changed files with 3 additions and 2 deletions

View File

@ -17,6 +17,7 @@
#else #else
#define FP_OFFSET (-2) #define FP_OFFSET (-2)
#endif #endif
#define LP_OFFSET (-1)
extern void __init early_trap_init(void); extern void __init early_trap_init(void);
static inline void GIE_ENABLE(void) static inline void GIE_ENABLE(void)

View File

@ -31,7 +31,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
&& (fpn >= (unsigned long *)TASK_SIZE)) { && (fpn >= (unsigned long *)TASK_SIZE)) {
unsigned long lpp, fpp; unsigned long lpp, fpp;
lpp = fpn[-1]; lpp = fpn[LP_OFFSET];
fpp = fpn[FP_OFFSET]; fpp = fpn[FP_OFFSET];
if (!__kernel_text_address(lpp)) if (!__kernel_text_address(lpp))
break; break;

View File

@ -117,7 +117,7 @@ static void __dump(struct task_struct *tsk, unsigned long *base_reg)
!((unsigned long)base_reg & 0x3) && !((unsigned long)base_reg & 0x3) &&
((unsigned long)base_reg >= TASK_SIZE)) { ((unsigned long)base_reg >= TASK_SIZE)) {
unsigned long next_fp; unsigned long next_fp;
ret_addr = base_reg[-1]; ret_addr = base_reg[LP_OFFSET];
next_fp = base_reg[FP_OFFSET]; next_fp = base_reg[FP_OFFSET];
if (__kernel_text_address(ret_addr)) { if (__kernel_text_address(ret_addr)) {