2008-05-22 00:43:50 +00:00
|
|
|
/**
|
|
|
|
* @file backtrace.c
|
|
|
|
*
|
|
|
|
* @remark Copyright 2008 Tensilica Inc.
|
2015-06-25 04:27:16 +00:00
|
|
|
* Copyright (C) 2015 Cadence Design Systems Inc.
|
2008-05-22 00:43:50 +00:00
|
|
|
* @remark Read the file COPYING
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/oprofile.h>
|
|
|
|
#include <asm/ptrace.h>
|
2015-06-25 04:27:16 +00:00
|
|
|
#include <asm/stacktrace.h>
|
2008-05-22 00:43:50 +00:00
|
|
|
|
2015-06-25 04:27:16 +00:00
|
|
|
static int xtensa_backtrace_cb(struct stackframe *frame, void *data)
|
2008-05-22 00:43:50 +00:00
|
|
|
{
|
2015-06-25 04:27:16 +00:00
|
|
|
oprofile_add_trace(frame->pc);
|
|
|
|
return 0;
|
2008-05-22 00:43:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void xtensa_backtrace(struct pt_regs * const regs, unsigned int depth)
|
|
|
|
{
|
|
|
|
if (user_mode(regs))
|
2015-06-25 04:27:16 +00:00
|
|
|
xtensa_backtrace_user(regs, depth, xtensa_backtrace_cb, NULL);
|
2008-05-22 00:43:50 +00:00
|
|
|
else
|
2015-06-25 04:27:16 +00:00
|
|
|
xtensa_backtrace_kernel(regs, depth, xtensa_backtrace_cb,
|
|
|
|
xtensa_backtrace_cb, NULL);
|
2008-05-22 00:43:50 +00:00
|
|
|
}
|