blob: c4d15f2762b9e37579b73bc3e11e6219682b65b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <linux/sched.h>
#include <linux/stacktrace.h>
#include <linux/thread_info.h>
#include <asm/ptrace.h>
void save_stack_trace(struct stack_trace *trace, struct task_struct *task)
{
unsigned long ksp, fp, thread_base;
struct thread_info *tp;
if (!task)
task = current;
tp = task_thread_info(task);
if (task == current) {
flushw_all();
__asm__ __volatile__(
"mov %%fp, %0"
: "=r" (ksp)
);
} else
ksp = tp->ksp;
fp = ksp + STACK_BIAS;
thread_base = (unsigned long) tp;
do {
struct reg_window *rw;
/* Bogus frame pointer? */
if (fp < (thread_base + sizeof(struct thread_info)) ||
fp >= (thread_base + THREAD_SIZE))
break;
rw = (struct reg_window *) fp;
if (trace->skip > 0)
trace->skip--;
else
trace->entries[trace->nr_entries++] = rw->ins[7];
fp = rw->ins[6] + STACK_BIAS;
} while (trace->nr_entries < trace->max_entries);
}
|