aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/ptrace.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-06-14 02:16:53 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-06-14 02:16:53 -0400
commiteaaaeef392cb245e415c31d480ed2d5a466fd88f (patch)
tree483761495ceb9cc3a277769f52d0ec8abeed1ac0 /arch/sh/kernel/ptrace.c
parent9973e38575070b70c68bad177fb5056548fea349 (diff)
sh: Add kprobe-based event tracer.
This follows the x86/ppc changes for kprobe-based event tracing on sh. While kprobes is only supported on 32-bit sh, we provide the API for HAVE_REGS_AND_STACK_ACCESS_API for both 32 and 64-bit. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/ptrace.c')
-rw-r--r--arch/sh/kernel/ptrace.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
new file mode 100644
index 000000000000..0a05983633ca
--- /dev/null
+++ b/arch/sh/kernel/ptrace.c
@@ -0,0 +1,33 @@
1#include <linux/ptrace.h>
2
3/**
4 * regs_query_register_offset() - query register offset from its name
5 * @name: the name of a register
6 *
7 * regs_query_register_offset() returns the offset of a register in struct
8 * pt_regs from its name. If the name is invalid, this returns -EINVAL;
9 */
10int regs_query_register_offset(const char *name)
11{
12 const struct pt_regs_offset *roff;
13 for (roff = regoffset_table; roff->name != NULL; roff++)
14 if (!strcmp(roff->name, name))
15 return roff->offset;
16 return -EINVAL;
17}
18
19/**
20 * regs_query_register_name() - query register name from its offset
21 * @offset: the offset of a register in struct pt_regs.
22 *
23 * regs_query_register_name() returns the name of a register from its
24 * offset in struct pt_regs. If the @offset is invalid, this returns NULL;
25 */
26const char *regs_query_register_name(unsigned int offset)
27{
28 const struct pt_regs_offset *roff;
29 for (roff = regoffset_table; roff->name != NULL; roff++)
30 if (roff->offset == offset)
31 return roff->name;
32 return NULL;
33}