^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * arch/xtensa/include/asm/stacktrace.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Copyright (C) 2001 - 2013 Tensilica Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef _XTENSA_STACKTRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define _XTENSA_STACKTRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct stackframe {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) unsigned long pc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned long sp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static __always_inline unsigned long *stack_pointer(struct task_struct *task)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned long *sp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) if (!task || task == current)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) __asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) sp = (unsigned long *)task->thread.sp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) return sp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) void walk_stackframe(unsigned long *sp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) int (*fn)(struct stackframe *frame, void *data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void xtensa_backtrace_kernel(struct pt_regs *regs, unsigned int depth,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) int (*kfn)(struct stackframe *frame, void *data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) int (*ufn)(struct stackframe *frame, void *data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void xtensa_backtrace_user(struct pt_regs *regs, unsigned int depth,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) int (*ufn)(struct stackframe *frame, void *data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #endif /* _XTENSA_STACKTRACE_H */