ia64/kvm: compilation fix. export account_system_vtime.
[pv_ops_mirror.git] / arch / sparc64 / kernel / stacktrace.c
blob01b52f561af49f86a0bb5e0f1513af60fe9aaef4
1 #include <linux/sched.h>
2 #include <linux/stacktrace.h>
3 #include <linux/thread_info.h>
4 #include <asm/ptrace.h>
5 #include <asm/stacktrace.h>
7 void save_stack_trace(struct stack_trace *trace)
9 unsigned long ksp, fp, thread_base;
10 struct thread_info *tp = task_thread_info(current);
12 stack_trace_flush();
14 __asm__ __volatile__(
15 "mov %%fp, %0"
16 : "=r" (ksp)
19 fp = ksp + STACK_BIAS;
20 thread_base = (unsigned long) tp;
21 do {
22 struct reg_window *rw;
23 struct pt_regs *regs;
24 unsigned long pc;
26 /* Bogus frame pointer? */
27 if (fp < (thread_base + sizeof(struct thread_info)) ||
28 fp >= (thread_base + THREAD_SIZE))
29 break;
31 rw = (struct reg_window *) fp;
32 regs = (struct pt_regs *) (rw + 1);
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;
42 if (trace->skip > 0)
43 trace->skip--;
44 else
45 trace->entries[trace->nr_entries++] = pc;
46 } while (trace->nr_entries < trace->max_entries);