1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_STACKTRACE_H
3 #define __ASM_STACKTRACE_H
5 #include <asm/ptrace.h>
6 #include <linux/llist.h>
10 * FP member should hold R7 when CONFIG_THUMB2_KERNEL is enabled
18 /* address of the LR value on the stack */
19 unsigned long *lr_addr;
20 #ifdef CONFIG_KRETPROBES
21 struct llist_node *kr_cur;
22 struct task_struct *tsk;
24 #ifdef CONFIG_UNWINDER_FRAME_POINTER
29 static inline bool on_thread_stack(void)
31 unsigned long delta = current_stack_pointer ^ (unsigned long)current->stack;
33 return delta < THREAD_SIZE;
36 static __always_inline
37 void arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame)
39 frame->fp = frame_pointer(regs);
40 frame->sp = regs->ARM_sp;
41 frame->lr = regs->ARM_lr;
42 frame->pc = regs->ARM_pc;
43 #ifdef CONFIG_KRETPROBES
47 #ifdef CONFIG_UNWINDER_FRAME_POINTER
48 frame->ex_frame = in_entry_text(frame->pc);
52 extern int unwind_frame(struct stackframe *frame);
53 extern void walk_stackframe(struct stackframe *frame,
54 bool (*fn)(void *, unsigned long), void *data);
55 extern void dump_mem(const char *lvl, const char *str, unsigned long bottom,
57 extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
60 #endif /* __ASM_STACKTRACE_H */