Skip to content

Commit b5cfeac

Browse files
committed
sh: Provide ftrace_make_call()/ftrace_make_nop().
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent 4bc3e71 commit b5cfeac

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎arch/sh/kernel/ftrace.c‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (C) 2008 Matt Fleming <mjf@gentoo.org>
3+
* Copyright (C) 2008 Paul Mundt <lethal@linux-sh.org>
34
*
45
* Code for replacing ftrace calls with jumps.
56
*
@@ -100,6 +101,29 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
100101
return ftrace_modify_code(ip + MCOUNT_INSN_OFFSET, old, new);
101102
}
102103

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+
103127
int __init ftrace_dyn_arch_init(void *data)
104128
{
105129
/* The return code is retured via data */

0 commit comments

Comments
 (0)