Paul Mundt | 830fafe | 2009-11-05 16:20:09 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Performance event callchain support - SuperH architecture code |
| 3 | * |
| 4 | * Copyright (C) 2009 Paul Mundt |
| 5 | * |
| 6 | * This file is subject to the terms and conditions of the GNU General Public |
| 7 | * License. See the file "COPYING" in the main directory of this archive |
| 8 | * for more details. |
| 9 | */ |
| 10 | #include <linux/kernel.h> |
| 11 | #include <linux/sched.h> |
| 12 | #include <linux/perf_event.h> |
| 13 | #include <linux/percpu.h> |
| 14 | #include <asm/unwinder.h> |
| 15 | #include <asm/ptrace.h> |
| 16 | |
Paul Mundt | 830fafe | 2009-11-05 16:20:09 +0900 | [diff] [blame] | 17 | static int callchain_stack(void *data, char *name) |
| 18 | { |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | static void callchain_address(void *data, unsigned long addr, int reliable) |
| 23 | { |
| 24 | struct perf_callchain_entry *entry = data; |
| 25 | |
| 26 | if (reliable) |
Frederic Weisbecker | 70791ce | 2010-06-29 19:34:05 +0200 | [diff] [blame] | 27 | perf_callchain_store(entry, addr); |
Paul Mundt | 830fafe | 2009-11-05 16:20:09 +0900 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | static const struct stacktrace_ops callchain_ops = { |
Paul Mundt | 830fafe | 2009-11-05 16:20:09 +0900 | [diff] [blame] | 31 | .stack = callchain_stack, |
| 32 | .address = callchain_address, |
| 33 | }; |
| 34 | |
Frederic Weisbecker | 56962b4 | 2010-06-30 23:03:51 +0200 | [diff] [blame] | 35 | void |
| 36 | perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs) |
Paul Mundt | 830fafe | 2009-11-05 16:20:09 +0900 | [diff] [blame] | 37 | { |
Frederic Weisbecker | 70791ce | 2010-06-29 19:34:05 +0200 | [diff] [blame] | 38 | perf_callchain_store(entry, regs->pc); |
Paul Mundt | 830fafe | 2009-11-05 16:20:09 +0900 | [diff] [blame] | 39 | |
| 40 | unwind_stack(NULL, regs, NULL, &callchain_ops, entry); |
| 41 | } |