aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-05-08 03:23:29 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:14:58 -0400
commitab1b6f03a10ba1f5638188ab06bf46e33ac3a160 (patch)
tree2dc7ce01df5d51d81e250dd9cee1b7b04627466e /arch/mips/kernel
parent7e4c3690b07f04b1942c39db358a5c8a72831daa (diff)
simplify the stacktrace code
Simplify the stacktrace code: - remove the unused task argument to save_stack_trace, it's always current - remove the all_contexts flag, it's alwasy 0 Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Andi Kleen <ak@suse.de> Cc: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mips/kernel')
-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}