aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/traps_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/traps_64.c')
-rw-r--r--arch/sparc/kernel/traps_64.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index bdc05a21908b..9da57f032983 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -17,6 +17,7 @@
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/kdebug.h> 19#include <linux/kdebug.h>
20#include <linux/gfp.h>
20 21
21#include <asm/smp.h> 22#include <asm/smp.h>
22#include <asm/delay.h> 23#include <asm/delay.h>
@@ -2202,27 +2203,6 @@ void dump_stack(void)
2202 2203
2203EXPORT_SYMBOL(dump_stack); 2204EXPORT_SYMBOL(dump_stack);
2204 2205
2205static inline int is_kernel_stack(struct task_struct *task,
2206 struct reg_window *rw)
2207{
2208 unsigned long rw_addr = (unsigned long) rw;
2209 unsigned long thread_base, thread_end;
2210
2211 if (rw_addr < PAGE_OFFSET) {
2212 if (task != &init_task)
2213 return 0;
2214 }
2215
2216 thread_base = (unsigned long) task_stack_page(task);
2217 thread_end = thread_base + sizeof(union thread_union);
2218 if (rw_addr >= thread_base &&
2219 rw_addr < thread_end &&
2220 !(rw_addr & 0x7UL))
2221 return 1;
2222
2223 return 0;
2224}
2225
2226static inline struct reg_window *kernel_stack_up(struct reg_window *rw) 2206static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
2227{ 2207{
2228 unsigned long fp = rw->ins[6]; 2208 unsigned long fp = rw->ins[6];
@@ -2251,6 +2231,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2251 show_regs(regs); 2231 show_regs(regs);
2252 add_taint(TAINT_DIE); 2232 add_taint(TAINT_DIE);
2253 if (regs->tstate & TSTATE_PRIV) { 2233 if (regs->tstate & TSTATE_PRIV) {
2234 struct thread_info *tp = current_thread_info();
2254 struct reg_window *rw = (struct reg_window *) 2235 struct reg_window *rw = (struct reg_window *)
2255 (regs->u_regs[UREG_FP] + STACK_BIAS); 2236 (regs->u_regs[UREG_FP] + STACK_BIAS);
2256 2237
@@ -2258,8 +2239,8 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2258 * find some badly aligned kernel stack. 2239 * find some badly aligned kernel stack.
2259 */ 2240 */
2260 while (rw && 2241 while (rw &&
2261 count++ < 30&& 2242 count++ < 30 &&
2262 is_kernel_stack(current, rw)) { 2243 kstack_valid(tp, (unsigned long) rw)) {
2263 printk("Caller[%016lx]: %pS\n", rw->ins[7], 2244 printk("Caller[%016lx]: %pS\n", rw->ins[7],
2264 (void *) rw->ins[7]); 2245 (void *) rw->ins[7]);
2265 2246