aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/stacktrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/stacktrace.c')
-rw-r--r--arch/sparc64/kernel/stacktrace.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c
index e9d7f0660f2e..4e21d4a57d3b 100644
--- a/arch/sparc64/kernel/stacktrace.c
+++ b/arch/sparc64/kernel/stacktrace.c
@@ -5,10 +5,12 @@
5#include <asm/ptrace.h> 5#include <asm/ptrace.h>
6#include <asm/stacktrace.h> 6#include <asm/stacktrace.h>
7 7
8#include "kstack.h"
9
8void save_stack_trace(struct stack_trace *trace) 10void save_stack_trace(struct stack_trace *trace)
9{ 11{
10 unsigned long ksp, fp, thread_base;
11 struct thread_info *tp = task_thread_info(current); 12 struct thread_info *tp = task_thread_info(current);
13 unsigned long ksp, fp;
12 14
13 stack_trace_flush(); 15 stack_trace_flush();
14 16
@@ -18,23 +20,18 @@ void save_stack_trace(struct stack_trace *trace)
18 ); 20 );
19 21
20 fp = ksp + STACK_BIAS; 22 fp = ksp + STACK_BIAS;
21 thread_base = (unsigned long) tp;
22 do { 23 do {
23 struct sparc_stackf *sf; 24 struct sparc_stackf *sf;
24 struct pt_regs *regs; 25 struct pt_regs *regs;
25 unsigned long pc; 26 unsigned long pc;
26 27
27 /* Bogus frame pointer? */ 28 if (!kstack_valid(tp, fp))
28 if (fp < (thread_base + sizeof(struct thread_info)) ||
29 fp > (thread_base + THREAD_SIZE - sizeof(struct sparc_stackf)))
30 break; 29 break;
31 30
32 sf = (struct sparc_stackf *) fp; 31 sf = (struct sparc_stackf *) fp;
33 regs = (struct pt_regs *) (sf + 1); 32 regs = (struct pt_regs *) (sf + 1);
34 33
35 if (((unsigned long)regs <= 34 if (kstack_is_trap_frame(tp, regs)) {
36 (thread_base + THREAD_SIZE - sizeof(*regs))) &&
37 (regs->magic & ~0x1ff) == PT_REGS_MAGIC) {
38 if (!(regs->tstate & TSTATE_PRIV)) 35 if (!(regs->tstate & TSTATE_PRIV))
39 break; 36 break;
40 pc = regs->tpc; 37 pc = regs->tpc;