summaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/ftrace.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-12-08 12:02:28 +0900
committerPaul Mundt <lethal@linux-sh.org>2008-12-22 18:44:02 +0900
commitb5cfeac990cc164a3d3422aab88ac5b138fa822d (patch)
treeb87cfa078ee4bfe56c207266cbd4fd8ba1e8df3f /arch/sh/kernel/ftrace.c
parent4bc3e7192cf9a47d9864c4e8259859be55a480b3 (diff)
sh: Provide ftrace_make_call()/ftrace_make_nop().
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/ftrace.c')
-rw-r--r--arch/sh/kernel/ftrace.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c
index 6c193d56c2e..4c3247477aa 100644
--- a/arch/sh/kernel/ftrace.c
+++ b/arch/sh/kernel/ftrace.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 Matt Fleming <mjf@gentoo.org>
+ * Copyright (C) 2008 Paul Mundt <lethal@linux-sh.org>
*
* Code for replacing ftrace calls with jumps.
*
@@ -100,6 +101,29 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
return ftrace_modify_code(ip + MCOUNT_INSN_OFFSET, old, new);
}
+int ftrace_make_nop(struct module *mod,
+ struct dyn_ftrace *rec, unsigned long addr)
+{
+ unsigned char *new, *old;
+ unsigned long ip = rec->ip;
+
+ old = ftrace_call_replace(ip, addr);
+ new = ftrace_nop_replace();
+
+ return ftrace_modify_code(rec->ip, old, new);
+}
+
+int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
+{
+ unsigned char *new, *old;
+ unsigned long ip = rec->ip;
+
+ old = ftrace_nop_replace();
+ new = ftrace_call_replace(ip, addr);
+
+ return ftrace_modify_code(rec->ip, old, new);
+}
+
int __init ftrace_dyn_arch_init(void *data)
{
/* The return code is retured via data */