6 #include <linux/sched.h>
8 #include <linux/module.h>
10 #include <asm/stacktrace.h>
12 static int save_stack_stack(
void *
data,
char *
name)
18 __save_stack_address(
void *
data,
unsigned long addr,
bool reliable,
bool nosched)
21 #ifdef CONFIG_FRAME_POINTER
27 if (trace->skip > 0) {
31 if (trace->nr_entries < trace->max_entries)
32 trace->entries[trace->nr_entries++] =
addr;
35 static void save_stack_address(
void *data,
unsigned long addr,
int reliable)
37 return __save_stack_address(data, addr, reliable,
false);
41 save_stack_address_nosched(
void *data,
unsigned long addr,
int reliable)
43 return __save_stack_address(data, addr, reliable,
true);
47 .stack = save_stack_stack,
48 .address = save_stack_address,
53 .stack = save_stack_stack,
54 .address = save_stack_address_nosched,
64 if (trace->nr_entries < trace->max_entries)
65 trace->entries[trace->nr_entries++] =
ULONG_MAX;
72 if (trace->nr_entries < trace->max_entries)
73 trace->entries[trace->nr_entries++] =
ULONG_MAX;
79 if (trace->nr_entries < trace->max_entries)
80 trace->entries[trace->nr_entries++] =
ULONG_MAX;
108 static inline void __save_stack_trace_user(
struct stack_trace *trace)
113 if (trace->nr_entries < trace->max_entries)
114 trace->entries[trace->nr_entries++] = regs->ip;
116 while (trace->nr_entries < trace->max_entries) {
121 if (!copy_stack_frame(fp, &
frame))
123 if ((
unsigned long)fp < regs->
sp)
125 if (
frame.ret_addr) {
126 trace->entries[trace->nr_entries++] =
129 if (fp ==
frame.next_fp)
141 __save_stack_trace_user(trace);
143 if (trace->nr_entries < trace->max_entries)
144 trace->entries[trace->nr_entries++] =
ULONG_MAX;