Commit | Line | Data |
---|---|---|
e6ffe17e | 1 | /** |
2 | * @file backtrace.c | |
3 | * | |
4 | * @remark Copyright 2008 Tensilica Inc. | |
5fdf377d | 5 | * Copyright (C) 2015 Cadence Design Systems Inc. |
e6ffe17e | 6 | * @remark Read the file COPYING |
7 | * | |
8 | */ | |
9 | ||
10 | #include <linux/oprofile.h> | |
e6ffe17e | 11 | #include <asm/ptrace.h> |
5fdf377d | 12 | #include <asm/stacktrace.h> |
e6ffe17e | 13 | |
5fdf377d | 14 | static int xtensa_backtrace_cb(struct stackframe *frame, void *data) |
e6ffe17e | 15 | { |
5fdf377d MF |
16 | oprofile_add_trace(frame->pc); |
17 | return 0; | |
e6ffe17e | 18 | } |
19 | ||
20 | void xtensa_backtrace(struct pt_regs * const regs, unsigned int depth) | |
21 | { | |
22 | if (user_mode(regs)) | |
5fdf377d | 23 | xtensa_backtrace_user(regs, depth, xtensa_backtrace_cb, NULL); |
e6ffe17e | 24 | else |
5fdf377d MF |
25 | xtensa_backtrace_kernel(regs, depth, xtensa_backtrace_cb, |
26 | xtensa_backtrace_cb, NULL); | |
e6ffe17e | 27 | } |