]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/sparc64/kernel/stacktrace.c
Pull virt-cpu-accounting into release branch
[linux-2.6-omap-h63xx.git] / arch / sparc64 / kernel / stacktrace.c
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>
6
7 void save_stack_trace(struct stack_trace *trace)
8 {
9         unsigned long ksp, fp, thread_base;
10         struct thread_info *tp = task_thread_info(current);
11
12         stack_trace_flush();
13
14         __asm__ __volatile__(
15                 "mov    %%fp, %0"
16                 : "=r" (ksp)
17         );
18
19         fp = ksp + STACK_BIAS;
20         thread_base = (unsigned long) tp;
21         do {
22                 struct reg_window *rw;
23
24                 /* Bogus frame pointer? */
25                 if (fp < (thread_base + sizeof(struct thread_info)) ||
26                     fp >= (thread_base + THREAD_SIZE))
27                         break;
28
29                 rw = (struct reg_window *) fp;
30                 if (trace->skip > 0)
31                         trace->skip--;
32                 else
33                         trace->entries[trace->nr_entries++] = rw->ins[7];
34
35                 fp = rw->ins[6] + STACK_BIAS;
36         } while (trace->nr_entries < trace->max_entries);
37 }