diff options
author | Daniel Walter <dwalter@google.com> | 2014-08-20 05:56:00 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2014-10-13 15:46:25 -0400 |
commit | 970e51feaddbc33ed0e7d187af7f69d1a12c7b6a (patch) | |
tree | dbe47fda5a1271dc5404c9c96d7965a870320fc2 /arch/um/include/asm | |
parent | 2a2361228c5e6d8c1733f00653481de918598e50 (diff) |
um: Add support for CONFIG_STACKTRACE
Add stacktrace support for User Mode Linux
Signed-off-by: Daniel Walter <dwalter@google.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/include/asm')
-rw-r--r-- | arch/um/include/asm/stacktrace.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/um/include/asm/stacktrace.h b/arch/um/include/asm/stacktrace.h new file mode 100644 index 000000000000..9a864328c67f --- /dev/null +++ b/arch/um/include/asm/stacktrace.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _ASM_UML_STACKTRACE_H | ||
2 | #define _ASM_UML_STACKTRACE_H | ||
3 | |||
4 | #include <linux/uaccess.h> | ||
5 | #include <linux/ptrace.h> | ||
6 | |||
7 | struct stack_frame { | ||
8 | struct stack_frame *next_frame; | ||
9 | unsigned long return_address; | ||
10 | }; | ||
11 | |||
12 | struct stacktrace_ops { | ||
13 | void (*address)(void *data, unsigned long address, int reliable); | ||
14 | }; | ||
15 | |||
16 | #ifdef CONFIG_FRAME_POINTER | ||
17 | static inline unsigned long | ||
18 | get_frame_pointer(struct task_struct *task, struct pt_regs *segv_regs) | ||
19 | { | ||
20 | if (!task || task == current) | ||
21 | return segv_regs ? PT_REGS_BP(segv_regs) : current_bp(); | ||
22 | return KSTK_EBP(task); | ||
23 | } | ||
24 | #else | ||
25 | static inline unsigned long | ||
26 | get_frame_pointer(struct task_struct *task, struct pt_regs *segv_regs) | ||
27 | { | ||
28 | return 0; | ||
29 | } | ||
30 | #endif | ||
31 | |||
32 | static inline unsigned long | ||
33 | *get_stack_pointer(struct task_struct *task, struct pt_regs *segv_regs) | ||
34 | { | ||
35 | if (!task || task == current) | ||
36 | return segv_regs ? (unsigned long *)PT_REGS_SP(segv_regs) : current_sp(); | ||
37 | return (unsigned long *)KSTK_ESP(task); | ||
38 | } | ||
39 | |||
40 | void dump_trace(struct task_struct *tsk, const struct stacktrace_ops *ops, void *data); | ||
41 | |||
42 | #endif /* _ASM_UML_STACKTRACE_H */ | ||