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