diff options
Diffstat (limited to 'arch/microblaze/kernel/ftrace.c')
-rw-r--r-- | arch/microblaze/kernel/ftrace.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/microblaze/kernel/ftrace.c b/arch/microblaze/kernel/ftrace.c index 0952a8b52c35..388b31ca65a1 100644 --- a/arch/microblaze/kernel/ftrace.c +++ b/arch/microblaze/kernel/ftrace.c | |||
@@ -206,4 +206,32 @@ int ftrace_update_ftrace_func(ftrace_func_t func) | |||
206 | return ret; | 206 | return ret; |
207 | } | 207 | } |
208 | 208 | ||
209 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
210 | unsigned int old_jump; /* saving place for jump instruction */ | ||
211 | |||
212 | int ftrace_enable_ftrace_graph_caller(void) | ||
213 | { | ||
214 | unsigned int ret; | ||
215 | unsigned long ip = (unsigned long)(&ftrace_call_graph); | ||
216 | |||
217 | old_jump = *(unsigned int *)ip; /* save jump over instruction */ | ||
218 | ret = ftrace_modify_code(ip, MICROBLAZE_NOP); | ||
219 | flush_icache(); | ||
220 | |||
221 | pr_debug("%s: Replace instruction: 0x%x\n", __func__, old_jump); | ||
222 | return ret; | ||
223 | } | ||
224 | |||
225 | int ftrace_disable_ftrace_graph_caller(void) | ||
226 | { | ||
227 | unsigned int ret; | ||
228 | unsigned long ip = (unsigned long)(&ftrace_call_graph); | ||
229 | |||
230 | ret = ftrace_modify_code(ip, old_jump); | ||
231 | flush_icache(); | ||
232 | |||
233 | pr_debug("%s\n", __func__); | ||
234 | return ret; | ||
235 | } | ||
236 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | ||
209 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 237 | #endif /* CONFIG_DYNAMIC_FTRACE */ |