diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-12-07 22:02:28 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-12-22 04:44:02 -0500 |
commit | b5cfeac990cc164a3d3422aab88ac5b138fa822d (patch) | |
tree | b87cfa078ee4bfe56c207266cbd4fd8ba1e8df3f /arch | |
parent | 4bc3e7192cf9a47d9864c4e8259859be55a480b3 (diff) |
sh: Provide ftrace_make_call()/ftrace_make_nop().
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/kernel/ftrace.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c index 6c193d56c2e7..4c3247477aa3 100644 --- a/arch/sh/kernel/ftrace.c +++ b/arch/sh/kernel/ftrace.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2008 Matt Fleming <mjf@gentoo.org> | 2 | * Copyright (C) 2008 Matt Fleming <mjf@gentoo.org> |
3 | * Copyright (C) 2008 Paul Mundt <lethal@linux-sh.org> | ||
3 | * | 4 | * |
4 | * Code for replacing ftrace calls with jumps. | 5 | * Code for replacing ftrace calls with jumps. |
5 | * | 6 | * |
@@ -100,6 +101,29 @@ int ftrace_update_ftrace_func(ftrace_func_t func) | |||
100 | return ftrace_modify_code(ip + MCOUNT_INSN_OFFSET, old, new); | 101 | return ftrace_modify_code(ip + MCOUNT_INSN_OFFSET, old, new); |
101 | } | 102 | } |
102 | 103 | ||
104 | int ftrace_make_nop(struct module *mod, | ||
105 | struct dyn_ftrace *rec, unsigned long addr) | ||
106 | { | ||
107 | unsigned char *new, *old; | ||
108 | unsigned long ip = rec->ip; | ||
109 | |||
110 | old = ftrace_call_replace(ip, addr); | ||
111 | new = ftrace_nop_replace(); | ||
112 | |||
113 | return ftrace_modify_code(rec->ip, old, new); | ||
114 | } | ||
115 | |||
116 | int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | ||
117 | { | ||
118 | unsigned char *new, *old; | ||
119 | unsigned long ip = rec->ip; | ||
120 | |||
121 | old = ftrace_nop_replace(); | ||
122 | new = ftrace_call_replace(ip, addr); | ||
123 | |||
124 | return ftrace_modify_code(rec->ip, old, new); | ||
125 | } | ||
126 | |||
103 | int __init ftrace_dyn_arch_init(void *data) | 127 | int __init ftrace_dyn_arch_init(void *data) |
104 | { | 128 | { |
105 | /* The return code is retured via data */ | 129 | /* The return code is retured via data */ |