aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/stacktrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/stacktrace.c')
-rw-r--r--arch/mips/kernel/stacktrace.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
index a586aba337a7..ebd9db8d1ece 100644
--- a/arch/mips/kernel/stacktrace.c
+++ b/arch/mips/kernel/stacktrace.c
@@ -31,8 +31,7 @@ static void save_raw_context_stack(struct stack_trace *trace,
31 } 31 }
32} 32}
33 33
34static void save_context_stack(struct stack_trace *trace, 34static void save_context_stack(struct stack_trace *trace, struct pt_regs *regs)
35 struct task_struct *task, struct pt_regs *regs)
36{ 35{
37 unsigned long sp = regs->regs[29]; 36 unsigned long sp = regs->regs[29];
38#ifdef CONFIG_KALLSYMS 37#ifdef CONFIG_KALLSYMS
@@ -41,7 +40,7 @@ static void save_context_stack(struct stack_trace *trace,
41 40
42 if (raw_show_trace || !__kernel_text_address(pc)) { 41 if (raw_show_trace || !__kernel_text_address(pc)) {
43 unsigned long stack_page = 42 unsigned long stack_page =
44 (unsigned long)task_stack_page(task); 43 (unsigned long)task_stack_page(current);
45 if (stack_page && sp >= stack_page && 44 if (stack_page && sp >= stack_page &&
46 sp <= stack_page + THREAD_SIZE - 32) 45 sp <= stack_page + THREAD_SIZE - 32)
47 save_raw_context_stack(trace, sp); 46 save_raw_context_stack(trace, sp);
@@ -54,7 +53,7 @@ static void save_context_stack(struct stack_trace *trace,
54 trace->entries[trace->nr_entries++] = pc; 53 trace->entries[trace->nr_entries++] = pc;
55 if (trace->nr_entries >= trace->max_entries) 54 if (trace->nr_entries >= trace->max_entries)
56 break; 55 break;
57 pc = unwind_stack(task, &sp, pc, &ra); 56 pc = unwind_stack(current, &sp, pc, &ra);
58 } while (pc); 57 } while (pc);
59#else 58#else
60 save_raw_context_stack(trace, sp); 59 save_raw_context_stack(trace, sp);
@@ -64,22 +63,13 @@ static void save_context_stack(struct stack_trace *trace,
64/* 63/*
65 * Save stack-backtrace addresses into a stack_trace buffer. 64 * Save stack-backtrace addresses into a stack_trace buffer.
66 */ 65 */
67void save_stack_trace(struct stack_trace *trace, struct task_struct *task) 66void save_stack_trace(struct stack_trace *trace)
68{ 67{
69 struct pt_regs dummyregs; 68 struct pt_regs dummyregs;
70 struct pt_regs *regs = &dummyregs; 69 struct pt_regs *regs = &dummyregs;
71 70
72 WARN_ON(trace->nr_entries || !trace->max_entries); 71 WARN_ON(trace->nr_entries || !trace->max_entries);
73 72
74 if (task && task != current) { 73 prepare_frametrace(regs);
75 regs->regs[29] = task->thread.reg29; 74 save_context_stack(trace, regs);
76 regs->regs[31] = 0;
77 regs->cp0_epc = task->thread.reg31;
78 } else {
79 if (!task)
80 task = current;
81 prepare_frametrace(regs);
82 }
83
84 save_context_stack(trace, task, regs);
85} 75}