diff options
author | David S. Miller <davem@davemloft.net> | 2008-04-24 06:28:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-24 06:28:52 -0400 |
commit | 77c664fa58624079f7a0fc29b46e8a32883633a5 (patch) | |
tree | 8a672a6af5d461e1f95d1a41f52dac3d95edb6ae /arch/sparc64/kernel/stacktrace.c | |
parent | 7697daaa894ca2bc5cd652269c316bcdc3ec441b (diff) |
[SPARC64]: Detect trap frames in stack backtraces.
Now that we have a magic cookie in the pt_regs, we can
properly detect trap frames in stack bactraces.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/stacktrace.c')
-rw-r--r-- | arch/sparc64/kernel/stacktrace.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/sparc64/kernel/stacktrace.c b/arch/sparc64/kernel/stacktrace.c index 84d39e873e88..01b52f561af4 100644 --- a/arch/sparc64/kernel/stacktrace.c +++ b/arch/sparc64/kernel/stacktrace.c | |||
@@ -20,6 +20,8 @@ void save_stack_trace(struct stack_trace *trace) | |||
20 | thread_base = (unsigned long) tp; | 20 | thread_base = (unsigned long) tp; |
21 | do { | 21 | do { |
22 | struct reg_window *rw; | 22 | struct reg_window *rw; |
23 | struct pt_regs *regs; | ||
24 | unsigned long pc; | ||
23 | 25 | ||
24 | /* Bogus frame pointer? */ | 26 | /* Bogus frame pointer? */ |
25 | if (fp < (thread_base + sizeof(struct thread_info)) || | 27 | if (fp < (thread_base + sizeof(struct thread_info)) || |
@@ -27,11 +29,19 @@ void save_stack_trace(struct stack_trace *trace) | |||
27 | break; | 29 | break; |
28 | 30 | ||
29 | rw = (struct reg_window *) fp; | 31 | rw = (struct reg_window *) fp; |
32 | regs = (struct pt_regs *) (rw + 1); | ||
33 | |||
34 | if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) { | ||
35 | pc = regs->tpc; | ||
36 | fp = regs->u_regs[UREG_I6] + STACK_BIAS; | ||
37 | } else { | ||
38 | pc = rw->ins[7]; | ||
39 | fp = rw->ins[6] + STACK_BIAS; | ||
40 | } | ||
41 | |||
30 | if (trace->skip > 0) | 42 | if (trace->skip > 0) |
31 | trace->skip--; | 43 | trace->skip--; |
32 | else | 44 | else |
33 | trace->entries[trace->nr_entries++] = rw->ins[7]; | 45 | trace->entries[trace->nr_entries++] = pc; |
34 | |||
35 | fp = rw->ins[6] + STACK_BIAS; | ||
36 | } while (trace->nr_entries < trace->max_entries); | 46 | } while (trace->nr_entries < trace->max_entries); |
37 | } | 47 | } |