at v5.17 40 lines 933 B view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __ASM_STACKTRACE_H 3#define __ASM_STACKTRACE_H 4 5#include <asm/ptrace.h> 6#include <linux/llist.h> 7 8struct stackframe { 9 /* 10 * FP member should hold R7 when CONFIG_THUMB2_KERNEL is enabled 11 * and R11 otherwise. 12 */ 13 unsigned long fp; 14 unsigned long sp; 15 unsigned long lr; 16 unsigned long pc; 17#ifdef CONFIG_KRETPROBES 18 struct llist_node *kr_cur; 19 struct task_struct *tsk; 20#endif 21}; 22 23static __always_inline 24void arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame) 25{ 26 frame->fp = frame_pointer(regs); 27 frame->sp = regs->ARM_sp; 28 frame->lr = regs->ARM_lr; 29 frame->pc = regs->ARM_pc; 30#ifdef CONFIG_KRETPROBES 31 frame->kr_cur = NULL; 32 frame->tsk = current; 33#endif 34} 35 36extern int unwind_frame(struct stackframe *frame); 37extern void walk_stackframe(struct stackframe *frame, 38 int (*fn)(struct stackframe *, void *), void *data); 39 40#endif /* __ASM_STACKTRACE_H */