18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_STACKTRACE_H 38c2ecf20Sopenharmony_ci#define __ASM_STACKTRACE_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/ptrace.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_cistruct stackframe { 88c2ecf20Sopenharmony_ci /* 98c2ecf20Sopenharmony_ci * FP member should hold R7 when CONFIG_THUMB2_KERNEL is enabled 108c2ecf20Sopenharmony_ci * and R11 otherwise. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci unsigned long fp; 138c2ecf20Sopenharmony_ci unsigned long sp; 148c2ecf20Sopenharmony_ci unsigned long lr; 158c2ecf20Sopenharmony_ci unsigned long pc; 168c2ecf20Sopenharmony_ci}; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistatic __always_inline 198c2ecf20Sopenharmony_civoid arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci frame->fp = frame_pointer(regs); 228c2ecf20Sopenharmony_ci frame->sp = regs->ARM_sp; 238c2ecf20Sopenharmony_ci frame->lr = regs->ARM_lr; 248c2ecf20Sopenharmony_ci frame->pc = regs->ARM_pc; 258c2ecf20Sopenharmony_ci} 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciextern int unwind_frame(struct stackframe *frame); 288c2ecf20Sopenharmony_ciextern void walk_stackframe(struct stackframe *frame, 298c2ecf20Sopenharmony_ci int (*fn)(struct stackframe *, void *), void *data); 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#endif /* __ASM_STACKTRACE_H */ 32