17 #include <asm/cacheflush.h>
23 0x02, 0x40, 0x31, 0x10, 0x80, 0x05,
24 0xb0, 0x02, 0x00, 0x00, 0x42, 0x40,
25 0x05, 0x00, 0xc4, 0x00,
26 0x11, 0x48, 0x01, 0x02, 0x00, 0x21,
27 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
28 0x08, 0x00, 0x00, 0x50
42 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
43 0x30, 0x00, 0x00, 0x60, 0x00, 0x00,
44 0x00, 0x00, 0x04, 0x00,
45 0x05, 0x00, 0x00, 0x00, 0x01, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47 0x00, 0x00, 0x04, 0x00
50 static unsigned char *ftrace_nop_replace(
void)
52 return ftrace_nop_code;
61 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
62 0x30, 0x00, 0x00, 0x60, 0x00, 0x00,
63 0x00, 0x00, 0x04, 0x00,
64 0x05, 0x00, 0x00, 0x00, 0x01, 0x00,
65 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00,
66 0xf8, 0xff, 0xff, 0xc8
81 static unsigned char *ftrace_call_replace(
unsigned long ip,
unsigned long addr)
84 unsigned long offset = addr - (ip + 0x10);
88 code->
imm20 = offset >> 4;
89 code->
i = offset >> 63;
90 return ftrace_call_code;
94 ftrace_modify_code(
unsigned long ip,
unsigned char *old_code,
95 unsigned char *new_code,
int do_check)
129 static int ftrace_make_nop_check(
struct dyn_ftrace *rec,
unsigned long addr)
132 unsigned long ip = rec->ip;
136 if (rec->
flags & FTRACE_FL_CONVERTED) {
139 call_insn = (
void *)ftrace_call_code;
140 tmp_call = (
void *)replaced;
144 call_insn->
i = tmp_call->
i;
145 if (
memcmp(replaced, ftrace_call_code, MCOUNT_INSN_SIZE) != 0)
151 call_insn = (
void *)ftrace_orig_code;
152 tmp_call = (
void *)replaced;
155 if (
memcmp(replaced, ftrace_orig_code, MCOUNT_INSN_SIZE) != 0)
162 struct dyn_ftrace *rec,
unsigned long addr)
167 ret = ftrace_make_nop_check(rec, addr);
170 new = ftrace_nop_replace();
171 return ftrace_modify_code(rec->ip,
NULL,
new, 0);
176 unsigned long ip = rec->ip;
177 unsigned char *old, *
new;
179 old= ftrace_nop_replace();
180 new = ftrace_call_replace(ip, addr);
181 return ftrace_modify_code(ip, old,
new, 1);
188 unsigned long addr = ((
struct fnptr *)ftrace_call)->ip;
190 if (func == ftrace_stub)
192 ip = ((
struct fnptr *)func)->ip;
203 *(
unsigned long *)data = 0;