diff options
Diffstat (limited to 'arch/mips/include/asm/stacktrace.h')
| -rw-r--r-- | arch/mips/include/asm/stacktrace.h | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/arch/mips/include/asm/stacktrace.h b/arch/mips/include/asm/stacktrace.h index 780ee2c2a2ac..10c4e9c84448 100644 --- a/arch/mips/include/asm/stacktrace.h +++ b/arch/mips/include/asm/stacktrace.h | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | #define _ASM_STACKTRACE_H | 2 | #define _ASM_STACKTRACE_H |
| 3 | 3 | ||
| 4 | #include <asm/ptrace.h> | 4 | #include <asm/ptrace.h> |
| 5 | #include <asm/asm.h> | ||
| 6 | #include <linux/stringify.h> | ||
| 5 | 7 | ||
| 6 | #ifdef CONFIG_KALLSYMS | 8 | #ifdef CONFIG_KALLSYMS |
| 7 | extern int raw_show_trace; | 9 | extern int raw_show_trace; |
| @@ -20,6 +22,14 @@ static inline unsigned long unwind_stack(struct task_struct *task, | |||
| 20 | } | 22 | } |
| 21 | #endif | 23 | #endif |
| 22 | 24 | ||
| 25 | #define STR_PTR_LA __stringify(PTR_LA) | ||
| 26 | #define STR_LONG_S __stringify(LONG_S) | ||
| 27 | #define STR_LONG_L __stringify(LONG_L) | ||
| 28 | #define STR_LONGSIZE __stringify(LONGSIZE) | ||
| 29 | |||
| 30 | #define STORE_ONE_REG(r) \ | ||
| 31 | STR_LONG_S " $" __stringify(r)",("STR_LONGSIZE"*"__stringify(r)")(%1)\n\t" | ||
| 32 | |||
| 23 | static __always_inline void prepare_frametrace(struct pt_regs *regs) | 33 | static __always_inline void prepare_frametrace(struct pt_regs *regs) |
| 24 | { | 34 | { |
| 25 | #ifndef CONFIG_KALLSYMS | 35 | #ifndef CONFIG_KALLSYMS |
| @@ -32,21 +42,47 @@ static __always_inline void prepare_frametrace(struct pt_regs *regs) | |||
| 32 | __asm__ __volatile__( | 42 | __asm__ __volatile__( |
| 33 | ".set push\n\t" | 43 | ".set push\n\t" |
| 34 | ".set noat\n\t" | 44 | ".set noat\n\t" |
| 35 | #ifdef CONFIG_64BIT | 45 | /* Store $1 so we can use it */ |
| 36 | "1: dla $1, 1b\n\t" | 46 | STR_LONG_S " $1,"STR_LONGSIZE"(%1)\n\t" |
| 37 | "sd $1, %0\n\t" | 47 | /* Store the PC */ |
| 38 | "sd $29, %1\n\t" | 48 | "1: " STR_PTR_LA " $1, 1b\n\t" |
| 39 | "sd $31, %2\n\t" | 49 | STR_LONG_S " $1,%0\n\t" |
| 40 | #else | 50 | STORE_ONE_REG(2) |
| 41 | "1: la $1, 1b\n\t" | 51 | STORE_ONE_REG(3) |
| 42 | "sw $1, %0\n\t" | 52 | STORE_ONE_REG(4) |
| 43 | "sw $29, %1\n\t" | 53 | STORE_ONE_REG(5) |
| 44 | "sw $31, %2\n\t" | 54 | STORE_ONE_REG(6) |
| 45 | #endif | 55 | STORE_ONE_REG(7) |
| 56 | STORE_ONE_REG(8) | ||
| 57 | STORE_ONE_REG(9) | ||
| 58 | STORE_ONE_REG(10) | ||
| 59 | STORE_ONE_REG(11) | ||
| 60 | STORE_ONE_REG(12) | ||
| 61 | STORE_ONE_REG(13) | ||
| 62 | STORE_ONE_REG(14) | ||
| 63 | STORE_ONE_REG(15) | ||
| 64 | STORE_ONE_REG(16) | ||
| 65 | STORE_ONE_REG(17) | ||
| 66 | STORE_ONE_REG(18) | ||
| 67 | STORE_ONE_REG(19) | ||
| 68 | STORE_ONE_REG(20) | ||
| 69 | STORE_ONE_REG(21) | ||
| 70 | STORE_ONE_REG(22) | ||
| 71 | STORE_ONE_REG(23) | ||
| 72 | STORE_ONE_REG(24) | ||
| 73 | STORE_ONE_REG(25) | ||
| 74 | STORE_ONE_REG(26) | ||
| 75 | STORE_ONE_REG(27) | ||
| 76 | STORE_ONE_REG(28) | ||
| 77 | STORE_ONE_REG(29) | ||
| 78 | STORE_ONE_REG(30) | ||
| 79 | STORE_ONE_REG(31) | ||
| 80 | /* Restore $1 */ | ||
| 81 | STR_LONG_L " $1,"STR_LONGSIZE"(%1)\n\t" | ||
| 46 | ".set pop\n\t" | 82 | ".set pop\n\t" |
| 47 | : "=m" (regs->cp0_epc), | 83 | : "=m" (regs->cp0_epc) |
| 48 | "=m" (regs->regs[29]), "=m" (regs->regs[31]) | 84 | : "r" (regs->regs) |
| 49 | : : "memory"); | 85 | : "memory"); |
| 50 | } | 86 | } |
| 51 | 87 | ||
| 52 | #endif /* _ASM_STACKTRACE_H */ | 88 | #endif /* _ASM_STACKTRACE_H */ |
