]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nds32: Add macro definition for offset of lp register on stack
authorZong Li <zong@andestech.com>
Mon, 20 Aug 2018 01:51:29 +0000 (09:51 +0800)
committerGreentime Hu <greentime@andestech.com>
Tue, 4 Sep 2018 06:45:19 +0000 (14:45 +0800)
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>
arch/nds32/include/asm/nds32.h
arch/nds32/kernel/stacktrace.c
arch/nds32/kernel/traps.c

index 19b19394a936cfdecaa51dba9159ee03473b76e7..68c38151c3e41c24c24081f92449a097bf077f02 100644 (file)
@@ -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)
index 36bc87003e83f43ff915f055fc230bb50e9f5cfa..d974c0c1c65f34123af8c7d2a63e2fb3e390e9f9 100644 (file)
@@ -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;
index f432310f3d02e7cf5c9f707bde1c2c7e63da110b..b0b85b7ab0792a56b3bb9da5867a7991da015e5b 100644 (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 >= 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)) {