stacktrace.h 774 B

1234567891011121314151617181920212223242526272829
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_RISCV_STACKTRACE_H
  3. #define _ASM_RISCV_STACKTRACE_H
  4. #include <linux/sched.h>
  5. #include <asm/ptrace.h>
  6. struct stackframe {
  7. unsigned long fp;
  8. unsigned long ra;
  9. };
  10. extern void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
  11. bool (*fn)(void *, unsigned long), void *arg);
  12. extern void dump_backtrace(struct pt_regs *regs, struct task_struct *task,
  13. const char *loglvl);
  14. static inline bool on_thread_stack(void)
  15. {
  16. return !(((unsigned long)(current->stack) ^ current_stack_pointer) & ~(THREAD_SIZE - 1));
  17. }
  18. #ifdef CONFIG_VMAP_STACK
  19. DECLARE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], overflow_stack);
  20. #endif /* CONFIG_VMAP_STACK */
  21. #endif /* _ASM_RISCV_STACKTRACE_H */