aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/stacktrace.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/include/asm/stacktrace.h')
-rw-r--r--arch/x86/include/asm/stacktrace.h34
1 files changed, 29 insertions, 5 deletions
diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h
index 2b16a2ad23dc..70bbe39043a9 100644
--- a/arch/x86/include/asm/stacktrace.h
+++ b/arch/x86/include/asm/stacktrace.h
@@ -7,6 +7,7 @@
7#define _ASM_X86_STACKTRACE_H 7#define _ASM_X86_STACKTRACE_H
8 8
9#include <linux/uaccess.h> 9#include <linux/uaccess.h>
10#include <linux/ptrace.h>
10 11
11extern int kstack_depth_to_print; 12extern int kstack_depth_to_print;
12 13
@@ -36,9 +37,6 @@ print_context_stack_bp(struct thread_info *tinfo,
36/* Generic stack tracer with callbacks */ 37/* Generic stack tracer with callbacks */
37 38
38struct stacktrace_ops { 39struct stacktrace_ops {
39 void (*warning)(void *data, char *msg);
40 /* msg must contain %s for the symbol */
41 void (*warning_symbol)(void *data, char *msg, unsigned long symbol);
42 void (*address)(void *data, unsigned long address, int reliable); 40 void (*address)(void *data, unsigned long address, int reliable);
43 /* On negative return stop dumping */ 41 /* On negative return stop dumping */
44 int (*stack)(void *data, char *name); 42 int (*stack)(void *data, char *name);
@@ -57,13 +55,39 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
57#define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :) 55#define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
58#endif 56#endif
59 57
58#ifdef CONFIG_FRAME_POINTER
59static inline unsigned long
60stack_frame(struct task_struct *task, struct pt_regs *regs)
61{
62 unsigned long bp;
63
64 if (regs)
65 return regs->bp;
66
67 if (task == current) {
68 /* Grab bp right from our regs */
69 get_bp(bp);
70 return bp;
71 }
72
73 /* bp is the last reg pushed by switch_to */
74 return *(unsigned long *)task->thread.sp;
75}
76#else
77static inline unsigned long
78stack_frame(struct task_struct *task, struct pt_regs *regs)
79{
80 return 0;
81}
82#endif
83
60extern void 84extern void
61show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, 85show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
62 unsigned long *stack, unsigned long bp, char *log_lvl); 86 unsigned long *stack, unsigned long bp, char *log_lvl);
63 87
64extern void 88extern void
65show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, 89show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
66 unsigned long *sp, unsigned long bp, char *log_lvl); 90 unsigned long *sp, unsigned long bp, char *log_lvl);
67 91
68extern unsigned int code_bytes; 92extern unsigned int code_bytes;
69 93