199c168fcSKefeng Wang /* SPDX-License-Identifier: GPL-2.0 */ 299c168fcSKefeng Wang 399c168fcSKefeng Wang #ifndef _ASM_RISCV_STACKTRACE_H 499c168fcSKefeng Wang #define _ASM_RISCV_STACKTRACE_H 599c168fcSKefeng Wang 699c168fcSKefeng Wang #include <linux/sched.h> 799c168fcSKefeng Wang #include <asm/ptrace.h> 899c168fcSKefeng Wang 999c168fcSKefeng Wang struct stackframe { 1099c168fcSKefeng Wang unsigned long fp; 1199c168fcSKefeng Wang unsigned long ra; 1299c168fcSKefeng Wang }; 1399c168fcSKefeng Wang 1499c168fcSKefeng Wang extern void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, 159dd97064SKefeng Wang bool (*fn)(void *, unsigned long), void *arg); 16091b9450SKefeng Wang extern void dump_backtrace(struct pt_regs *regs, struct task_struct *task, 17091b9450SKefeng Wang const char *loglvl); 1899c168fcSKefeng Wang on_thread_stack(void)19f0bddf50SGuo Renstatic inline bool on_thread_stack(void) 20f0bddf50SGuo Ren { 21f0bddf50SGuo Ren return !(((unsigned long)(current->stack) ^ current_stack_pointer) & ~(THREAD_SIZE - 1)); 22f0bddf50SGuo Ren } 23f0bddf50SGuo Ren 24*2cf96378SBen Dooks 25*2cf96378SBen Dooks #ifdef CONFIG_VMAP_STACK 26*2cf96378SBen Dooks DECLARE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack); 27*2cf96378SBen Dooks #endif /* CONFIG_VMAP_STACK */ 28*2cf96378SBen Dooks 2999c168fcSKefeng Wang #endif /* _ASM_RISCV_STACKTRACE_H */ 30