Linux 4.8-rc8
[linux/fpc-iii.git] / arch / xtensa / oprofile / backtrace.c
blob8f952034e161b03ab806555ac36b06f8f4c74f76
1 /**
2 * @file backtrace.c
4 * @remark Copyright 2008 Tensilica Inc.
5 * Copyright (C) 2015 Cadence Design Systems Inc.
6 * @remark Read the file COPYING
8 */
10 #include <linux/oprofile.h>
11 #include <asm/ptrace.h>
12 #include <asm/stacktrace.h>
14 static int xtensa_backtrace_cb(struct stackframe *frame, void *data)
16 oprofile_add_trace(frame->pc);
17 return 0;
20 void xtensa_backtrace(struct pt_regs * const regs, unsigned int depth)
22 if (user_mode(regs))
23 xtensa_backtrace_user(regs, depth, xtensa_backtrace_cb, NULL);
24 else
25 xtensa_backtrace_kernel(regs, depth, xtensa_backtrace_cb,
26 xtensa_backtrace_cb, NULL);