Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_UML_STACKTRACE_H
0003 #define _ASM_UML_STACKTRACE_H
0004 
0005 #include <linux/uaccess.h>
0006 #include <linux/ptrace.h>
0007 
0008 struct stack_frame {
0009     struct stack_frame *next_frame;
0010     unsigned long return_address;
0011 };
0012 
0013 struct stacktrace_ops {
0014     void (*address)(void *data, unsigned long address, int reliable);
0015 };
0016 
0017 #ifdef CONFIG_FRAME_POINTER
0018 static inline unsigned long
0019 get_frame_pointer(struct task_struct *task, struct pt_regs *segv_regs)
0020 {
0021     if (!task || task == current)
0022         return segv_regs ? PT_REGS_BP(segv_regs) : current_bp();
0023     return KSTK_EBP(task);
0024 }
0025 #else
0026 static inline unsigned long
0027 get_frame_pointer(struct task_struct *task, struct pt_regs *segv_regs)
0028 {
0029     return 0;
0030 }
0031 #endif
0032 
0033 static inline unsigned long
0034 *get_stack_pointer(struct task_struct *task, struct pt_regs *segv_regs)
0035 {
0036     if (!task || task == current)
0037         return segv_regs ? (unsigned long *)PT_REGS_SP(segv_regs) : current_sp();
0038     return (unsigned long *)KSTK_ESP(task);
0039 }
0040 
0041 void dump_trace(struct task_struct *tsk, const struct stacktrace_ops *ops, void *data);
0042 
0043 #endif /* _ASM_UML_STACKTRACE_H */