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);
19 fp = ksp + STACK_BIAS;
20 thread_base = (unsigned long) tp;
22 struct reg_window *rw;
24 /* Bogus frame pointer? */
25 if (fp < (thread_base + sizeof(struct thread_info)) ||
26 fp >= (thread_base + THREAD_SIZE))
29 rw = (struct reg_window *) fp;
33 trace->entries[trace->nr_entries++] = rw->ins[7];
35 fp = rw->ins[6] + STACK_BIAS;
36 } while (trace->nr_entries < trace->max_entries);