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
, struct task_struct
*task
)
8 unsigned long ksp
, fp
, thread_base
;
9 struct thread_info
*tp
;
13 tp
= task_thread_info(task
);
14 if (task
== current
) {
23 fp
= ksp
+ STACK_BIAS
;
24 thread_base
= (unsigned long) tp
;
26 struct reg_window
*rw
;
28 /* Bogus frame pointer? */
29 if (fp
< (thread_base
+ sizeof(struct thread_info
)) ||
30 fp
>= (thread_base
+ THREAD_SIZE
))
33 rw
= (struct reg_window
*) fp
;
37 trace
->entries
[trace
->nr_entries
++] = rw
->ins
[7];
39 fp
= rw
->ins
[6] + STACK_BIAS
;
40 } while (trace
->nr_entries
< trace
->max_entries
);