Merge branch 'linux-next' of git://git.infradead.org/~dedekind/ubifs-2.6
[deliverable/linux.git] / arch / sparc64 / kernel / stacktrace.c
CommitLineData
10e26723
DM
1#include <linux/sched.h>
2#include <linux/stacktrace.h>
3#include <linux/thread_info.h>
a05fe038 4#include <linux/module.h>
10e26723 5#include <asm/ptrace.h>
85a79353 6#include <asm/stacktrace.h>
10e26723 7
4f70f7a9
DM
8#include "kstack.h"
9
ab1b6f03 10void save_stack_trace(struct stack_trace *trace)
10e26723 11{
ab1b6f03 12 struct thread_info *tp = task_thread_info(current);
6f63e781 13 unsigned long ksp, fp;
10e26723 14
85a79353
DM
15 stack_trace_flush();
16
ab1b6f03
CH
17 __asm__ __volatile__(
18 "mov %%fp, %0"
19 : "=r" (ksp)
20 );
10e26723
DM
21
22 fp = ksp + STACK_BIAS;
10e26723 23 do {
14d2c68b 24 struct sparc_stackf *sf;
77c664fa
DM
25 struct pt_regs *regs;
26 unsigned long pc;
10e26723 27
4f70f7a9 28 if (!kstack_valid(tp, fp))
10e26723
DM
29 break;
30
14d2c68b
DM
31 sf = (struct sparc_stackf *) fp;
32 regs = (struct pt_regs *) (sf + 1);
77c664fa 33
4f70f7a9 34 if (kstack_is_trap_frame(tp, regs)) {
14d2c68b
DM
35 if (!(regs->tstate & TSTATE_PRIV))
36 break;
77c664fa
DM
37 pc = regs->tpc;
38 fp = regs->u_regs[UREG_I6] + STACK_BIAS;
39 } else {
14d2c68b
DM
40 pc = sf->callers_pc;
41 fp = (unsigned long)sf->fp + STACK_BIAS;
77c664fa
DM
42 }
43
10e26723
DM
44 if (trace->skip > 0)
45 trace->skip--;
46 else
77c664fa 47 trace->entries[trace->nr_entries++] = pc;
10e26723
DM
48 } while (trace->nr_entries < trace->max_entries);
49}
7b4c9505 50EXPORT_SYMBOL_GPL(save_stack_trace);
This page took 0.193244 seconds and 5 git commands to generate.