13e4196a5SMax Filippov /* 23e4196a5SMax Filippov * arch/xtensa/include/asm/stacktrace.h 33e4196a5SMax Filippov * 43e4196a5SMax Filippov * This file is subject to the terms and conditions of the GNU General Public 53e4196a5SMax Filippov * License. See the file "COPYING" in the main directory of this archive 63e4196a5SMax Filippov * for more details. 73e4196a5SMax Filippov * 83e4196a5SMax Filippov * Copyright (C) 2001 - 2013 Tensilica Inc. 93e4196a5SMax Filippov */ 103e4196a5SMax Filippov #ifndef _XTENSA_STACKTRACE_H 113e4196a5SMax Filippov #define _XTENSA_STACKTRACE_H 123e4196a5SMax Filippov 133e4196a5SMax Filippov #include <linux/sched.h> 143e4196a5SMax Filippov 153e4196a5SMax Filippov struct stackframe { 163e4196a5SMax Filippov unsigned long pc; 173e4196a5SMax Filippov unsigned long sp; 183e4196a5SMax Filippov }; 193e4196a5SMax Filippov 203e4196a5SMax Filippov static __always_inline unsigned long *stack_pointer(struct task_struct *task) 213e4196a5SMax Filippov { 223e4196a5SMax Filippov unsigned long *sp; 233e4196a5SMax Filippov 243e4196a5SMax Filippov if (!task || task == current) 253e4196a5SMax Filippov __asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp)); 263e4196a5SMax Filippov else 273e4196a5SMax Filippov sp = (unsigned long *)task->thread.sp; 283e4196a5SMax Filippov 293e4196a5SMax Filippov return sp; 303e4196a5SMax Filippov } 313e4196a5SMax Filippov 323e4196a5SMax Filippov void walk_stackframe(unsigned long *sp, 333e4196a5SMax Filippov int (*fn)(struct stackframe *frame, void *data), 343e4196a5SMax Filippov void *data); 353e4196a5SMax Filippov 365fdf377dSMax Filippov void xtensa_backtrace_kernel(struct pt_regs *regs, unsigned int depth, 375fdf377dSMax Filippov int (*kfn)(struct stackframe *frame, void *data), 385fdf377dSMax Filippov int (*ufn)(struct stackframe *frame, void *data), 395fdf377dSMax Filippov void *data); 405fdf377dSMax Filippov void xtensa_backtrace_user(struct pt_regs *regs, unsigned int depth, 415fdf377dSMax Filippov int (*ufn)(struct stackframe *frame, void *data), 425fdf377dSMax Filippov void *data); 435fdf377dSMax Filippov 443e4196a5SMax Filippov #endif /* _XTENSA_STACKTRACE_H */ 45