RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / sparc64 / kernel / stacktrace.c
blob47f92a59be18ad41904891f3888974a9df9b08b1
1 #include <linux/sched.h>
2 #include <linux/stacktrace.h>
3 #include <linux/thread_info.h>
4 #include <asm/ptrace.h>
6 void save_stack_trace(struct stack_trace *trace)
8 unsigned long ksp, fp, thread_base;
9 struct thread_info *tp = task_thread_info(current);
11 flushw_all();
12 __asm__ __volatile__(
13 "mov %%fp, %0"
14 : "=r" (ksp)
17 fp = ksp + STACK_BIAS;
18 thread_base = (unsigned long) tp;
19 do {
20 struct reg_window *rw;
22 /* Bogus frame pointer? */
23 if (fp < (thread_base + sizeof(struct thread_info)) ||
24 fp >= (thread_base + THREAD_SIZE))
25 break;
27 rw = (struct reg_window *) fp;
28 if (trace->skip > 0)
29 trace->skip--;
30 else
31 trace->entries[trace->nr_entries++] = rw->ins[7];
33 fp = rw->ins[6] + STACK_BIAS;
34 } while (trace->nr_entries < trace->max_entries);