xref: /linux/arch/um/include/asm/stacktrace.h (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
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 */
43