aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/ftrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/kernel/ftrace.c')
-rw-r--r--arch/microblaze/kernel/ftrace.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/arch/microblaze/kernel/ftrace.c b/arch/microblaze/kernel/ftrace.c
index 388b31ca65a1..515feb404555 100644
--- a/arch/microblaze/kernel/ftrace.c
+++ b/arch/microblaze/kernel/ftrace.c
@@ -151,13 +151,10 @@ int ftrace_make_nop(struct module *mod,
151 return ret; 151 return ret;
152} 152}
153 153
154static int ret_addr; /* initialized as 0 by default */
155
156/* I believe that first is called ftrace_make_nop before this function */ 154/* I believe that first is called ftrace_make_nop before this function */
157int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) 155int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
158{ 156{
159 int ret; 157 int ret;
160 ret_addr = addr; /* saving where the barrier jump is */
161 pr_debug("%s: addr:0x%x, rec->ip: 0x%x, imm:0x%x\n", 158 pr_debug("%s: addr:0x%x, rec->ip: 0x%x, imm:0x%x\n",
162 __func__, (unsigned int)addr, (unsigned int)rec->ip, imm); 159 __func__, (unsigned int)addr, (unsigned int)rec->ip, imm);
163 ret = ftrace_modify_code(rec->ip, imm); 160 ret = ftrace_modify_code(rec->ip, imm);
@@ -194,12 +191,9 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
194 ret = ftrace_modify_code(ip, upper); 191 ret = ftrace_modify_code(ip, upper);
195 ret += ftrace_modify_code(ip + 4, lower); 192 ret += ftrace_modify_code(ip + 4, lower);
196 193
197 /* We just need to remove the rtsd r15, 8 by NOP */ 194 /* We just need to replace the rtsd r15, 8 with NOP */
198 BUG_ON(!ret_addr); 195 ret += ftrace_modify_code((unsigned long)&ftrace_caller,
199 if (ret_addr) 196 MICROBLAZE_NOP);
200 ret += ftrace_modify_code(ret_addr, MICROBLAZE_NOP);
201 else
202 ret = 1; /* fault */
203 197
204 /* All changes are done - lets do caches consistent */ 198 /* All changes are done - lets do caches consistent */
205 flush_icache(); 199 flush_icache();