diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2013-04-15 01:20:48 -0400 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2013-05-09 04:07:10 -0400 |
commit | 3e4196a5cc9cff50900f3dc8acc3d41e5963fd50 (patch) | |
tree | 149403b0517e402fbf29ce9aac65a49d1119234e /arch/xtensa/include | |
parent | 4e96274e2b7a7463de6849c0411d876182ee8889 (diff) |
xtensa: add stacktrace support
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa/include')
-rw-r--r-- | arch/xtensa/include/asm/stacktrace.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/xtensa/include/asm/stacktrace.h b/arch/xtensa/include/asm/stacktrace.h new file mode 100644 index 000000000000..6a05fcb0a20d --- /dev/null +++ b/arch/xtensa/include/asm/stacktrace.h | |||
@@ -0,0 +1,36 @@ | |||
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 | |||
13 | #include <linux/sched.h> | ||
14 | |||
15 | struct stackframe { | ||
16 | unsigned long pc; | ||
17 | unsigned long sp; | ||
18 | }; | ||
19 | |||
20 | static __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 | |||
32 | void walk_stackframe(unsigned long *sp, | ||
33 | int (*fn)(struct stackframe *frame, void *data), | ||
34 | void *data); | ||
35 | |||
36 | #endif /* _XTENSA_STACKTRACE_H */ | ||