stacktrace.h 1.1 KB

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