blob: fe06e8ed162b754ce2c6cceec4ddb9682030f088 [file] [log] [blame]
Max Filippov3e4196a2013-04-15 09:20:48 +04001/*
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
13#include <linux/sched.h>
14
15struct stackframe {
16 unsigned long pc;
17 unsigned long sp;
18};
19
20static __always_inline unsigned long *stack_pointer(struct task_struct *task)
21{
22 unsigned long *sp;
23
24 if (!task || task == current)
25 __asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp));
26 else
27 sp = (unsigned long *)task->thread.sp;
28
29 return sp;
30}
31
32void walk_stackframe(unsigned long *sp,
33 int (*fn)(struct stackframe *frame, void *data),
34 void *data);
35
Max Filippov5fdf3772015-06-25 07:27:16 +030036void xtensa_backtrace_kernel(struct pt_regs *regs, unsigned int depth,
37 int (*kfn)(struct stackframe *frame, void *data),
38 int (*ufn)(struct stackframe *frame, void *data),
39 void *data);
40void xtensa_backtrace_user(struct pt_regs *regs, unsigned int depth,
41 int (*ufn)(struct stackframe *frame, void *data),
42 void *data);
43
Max Filippov3e4196a2013-04-15 09:20:48 +040044#endif /* _XTENSA_STACKTRACE_H */