]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/powerpc/kernel/ftrace.c
Merge tag 'befs-v4.10-rc1' of git://github.com/luisbg/linux-befs
[mirror_ubuntu-zesty-kernel.git] / arch / powerpc / kernel / ftrace.c
CommitLineData
4e491d14
SR
1/*
2 * Code for replacing ftrace calls with jumps.
3 *
4 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
5 *
6 * Thanks goes out to P.A. Semi, Inc for supplying me with a PPC64 box.
7 *
6794c782
SR
8 * Added function graph tracer code, taken from x86 that was written
9 * by Frederic Weisbecker, and ported to PPC by Steven Rostedt.
10 *
4e491d14
SR
11 */
12
072c4c01
ME
13#define pr_fmt(fmt) "ftrace-powerpc: " fmt
14
4e491d14
SR
15#include <linux/spinlock.h>
16#include <linux/hardirq.h>
e4486fe3 17#include <linux/uaccess.h>
f48cb8b4 18#include <linux/module.h>
4e491d14
SR
19#include <linux/ftrace.h>
20#include <linux/percpu.h>
21#include <linux/init.h>
22#include <linux/list.h>
23
24#include <asm/cacheflush.h>
f48cb8b4 25#include <asm/code-patching.h>
395a59d0 26#include <asm/ftrace.h>
02424d89 27#include <asm/syscall.h>
4e491d14 28
4e491d14 29
6794c782 30#ifdef CONFIG_DYNAMIC_FTRACE
b54dcfe1 31static unsigned int
46542888 32ftrace_call_replace(unsigned long ip, unsigned long addr, int link)
4e491d14 33{
b54dcfe1 34 unsigned int op;
4e491d14 35
4a9e3f8e 36 addr = ppc_function_entry((void *)addr);
4e491d14 37
46542888 38 /* if (link) set op to 'bl' else 'b' */
bb9b9035 39 op = create_branch((unsigned int *)ip, addr, link ? 1 : 0);
4e491d14 40
b54dcfe1 41 return op;
4e491d14
SR
42}
43
8fd6e5a8 44static int
b54dcfe1 45ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new)
4e491d14 46{
b54dcfe1 47 unsigned int replaced;
4e491d14 48
4e491d14 49 /*
c02e0349
L
50 * Note:
51 * We are paranoid about modifying text, as if a bug was to happen, it
52 * could cause us to read or write to someplace that could cause harm.
53 * Carefully read and modify the code with probe_kernel_*(), and make
54 * sure what we read is what we expected it to be before modifying it.
4e491d14 55 */
e4486fe3
SR
56
57 /* read the text we want to modify */
b54dcfe1 58 if (probe_kernel_read(&replaced, (void *)ip, MCOUNT_INSN_SIZE))
e4486fe3
SR
59 return -EFAULT;
60
61 /* Make sure it is what we expect it to be */
15308664
TD
62 if (replaced != old) {
63 pr_err("%p: replaced (%#x) != old (%#x)",
64 (void *)ip, replaced, old);
e4486fe3 65 return -EINVAL;
15308664 66 }
e4486fe3
SR
67
68 /* replace the text with the new text */
65b8c722 69 if (patch_instruction((unsigned int *)ip, new))
e4486fe3
SR
70 return -EPERM;
71
e4486fe3 72 return 0;
4e491d14
SR
73}
74
f48cb8b4
SR
75/*
76 * Helper functions that are the same for both PPC64 and PPC32.
77 */
8fd6e5a8
SR
78static int test_24bit_addr(unsigned long ip, unsigned long addr)
79{
a95fc585 80 addr = ppc_function_entry((void *)addr);
8fd6e5a8 81
0029ff87
SR
82 /* use the create_branch to verify that this offset can be branched */
83 return create_branch((unsigned int *)ip, addr, 0);
8fd6e5a8
SR
84}
85
17be5b3d
SR
86#ifdef CONFIG_MODULES
87
f48cb8b4
SR
88static int is_bl_op(unsigned int op)
89{
90 return (op & 0xfc000003) == 0x48000001;
91}
92
f48cb8b4
SR
93static unsigned long find_bl_target(unsigned long ip, unsigned int op)
94{
95 static int offset;
96
97 offset = (op & 0x03fffffc);
98 /* make it signed */
99 if (offset & 0x02000000)
100 offset |= 0xfe000000;
101
102 return ip + (long)offset;
103}
104
f48cb8b4
SR
105#ifdef CONFIG_PPC64
106static int
107__ftrace_make_nop(struct module *mod,
108 struct dyn_ftrace *rec, unsigned long addr)
109{
f17c4e01 110 unsigned long entry, ptr, tramp;
f48cb8b4 111 unsigned long ip = rec->ip;
15308664 112 unsigned int op, pop;
f48cb8b4
SR
113
114 /* read where this goes */
15308664
TD
115 if (probe_kernel_read(&op, (void *)ip, sizeof(int))) {
116 pr_err("Fetching opcode failed.\n");
f48cb8b4 117 return -EFAULT;
15308664 118 }
f48cb8b4
SR
119
120 /* Make sure that that this is still a 24bit jump */
d9af12b7 121 if (!is_bl_op(op)) {
072c4c01 122 pr_err("Not expected bl: opcode is %x\n", op);
f48cb8b4
SR
123 return -EINVAL;
124 }
125
126 /* lets find where the pointer goes */
f17c4e01 127 tramp = find_bl_target(ip, op);
f48cb8b4 128
f17c4e01 129 pr_devel("ip:%lx jumps to %lx", ip, tramp);
f48cb8b4 130
62c9da6a 131 if (module_trampoline_target(mod, tramp, &ptr)) {
072c4c01 132 pr_err("Failed to get trampoline target\n");
f48cb8b4
SR
133 return -EFAULT;
134 }
135
62c9da6a 136 pr_devel("trampoline target %lx", ptr);
f48cb8b4 137
d84e0d69 138 entry = ppc_global_function_entry((void *)addr);
f48cb8b4 139 /* This should match what was called */
d84e0d69 140 if (ptr != entry) {
072c4c01 141 pr_err("addr %lx does not match expected %lx\n", ptr, entry);
f48cb8b4
SR
142 return -EINVAL;
143 }
144
9d636109
ME
145#ifdef CC_USING_MPROFILE_KERNEL
146 /* When using -mkernel_profile there is no load to jump over */
147 pop = PPC_INST_NOP;
148
149 if (probe_kernel_read(&op, (void *)(ip - 4), 4)) {
150 pr_err("Fetching instruction at %lx failed.\n", ip - 4);
151 return -EFAULT;
152 }
153
154 /* We expect either a mflr r0, or a std r0, LRSAVE(r1) */
155 if (op != PPC_INST_MFLR && op != PPC_INST_STD_LR) {
156 pr_err("Unexpected instruction %08x around bl _mcount\n", op);
157 return -EINVAL;
158 }
159#else
f48cb8b4 160 /*
62c9da6a
AB
161 * Our original call site looks like:
162 *
163 * bl <tramp>
164 * ld r2,XX(r1)
165 *
166 * Milton Miller pointed out that we can not simply nop the branch.
167 * If a task was preempted when calling a trace function, the nops
168 * will remove the way to restore the TOC in r2 and the r2 TOC will
169 * get corrupted.
170 *
171 * Use a b +8 to jump over the load.
f48cb8b4 172 */
f48cb8b4 173
15308664
TD
174 pop = PPC_INST_BRANCH | 8; /* b +8 */
175
176 /*
177 * Check what is in the next instruction. We can see ld r2,40(r1), but
178 * on first pass after boot we will see mflr r0.
179 */
180 if (probe_kernel_read(&op, (void *)(ip+4), MCOUNT_INSN_SIZE)) {
181 pr_err("Fetching op failed.\n");
182 return -EFAULT;
183 }
184
185 if (op != PPC_INST_LD_TOC) {
9d636109
ME
186 pr_err("Expected %08x found %08x\n", PPC_INST_LD_TOC, op);
187 return -EINVAL;
15308664 188 }
9d636109 189#endif /* CC_USING_MPROFILE_KERNEL */
15308664
TD
190
191 if (patch_instruction((unsigned int *)ip, pop)) {
192 pr_err("Patching NOP failed.\n");
f48cb8b4 193 return -EPERM;
15308664 194 }
f48cb8b4
SR
195
196 return 0;
197}
198
199#else /* !PPC64 */
200static int
201__ftrace_make_nop(struct module *mod,
202 struct dyn_ftrace *rec, unsigned long addr)
203{
d9af12b7
SR
204 unsigned int op;
205 unsigned int jmp[4];
7cc45e64
SR
206 unsigned long ip = rec->ip;
207 unsigned long tramp;
7cc45e64 208
d9af12b7 209 if (probe_kernel_read(&op, (void *)ip, MCOUNT_INSN_SIZE))
7cc45e64
SR
210 return -EFAULT;
211
212 /* Make sure that that this is still a 24bit jump */
d9af12b7 213 if (!is_bl_op(op)) {
072c4c01 214 pr_err("Not expected bl: opcode is %x\n", op);
7cc45e64
SR
215 return -EINVAL;
216 }
217
218 /* lets find where the pointer goes */
d9af12b7 219 tramp = find_bl_target(ip, op);
7cc45e64
SR
220
221 /*
222 * On PPC32 the trampoline looks like:
fd5a4298 223 * 0x3d, 0x80, 0x00, 0x00 lis r12,sym@ha
224 * 0x39, 0x8c, 0x00, 0x00 addi r12,r12,sym@l
225 * 0x7d, 0x89, 0x03, 0xa6 mtctr r12
d9af12b7 226 * 0x4e, 0x80, 0x04, 0x20 bctr
7cc45e64
SR
227 */
228
021376a3 229 pr_devel("ip:%lx jumps to %lx", ip, tramp);
7cc45e64
SR
230
231 /* Find where the trampoline jumps to */
d9af12b7 232 if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) {
072c4c01 233 pr_err("Failed to read %lx\n", tramp);
7cc45e64
SR
234 return -EFAULT;
235 }
236
021376a3 237 pr_devel(" %08x %08x ", jmp[0], jmp[1]);
d9af12b7
SR
238
239 /* verify that this is what we expect it to be */
fd5a4298 240 if (((jmp[0] & 0xffff0000) != 0x3d800000) ||
241 ((jmp[1] & 0xffff0000) != 0x398c0000) ||
242 (jmp[2] != 0x7d8903a6) ||
d9af12b7 243 (jmp[3] != 0x4e800420)) {
072c4c01 244 pr_err("Not a trampoline\n");
d9af12b7
SR
245 return -EINVAL;
246 }
7cc45e64 247
d9af12b7
SR
248 tramp = (jmp[1] & 0xffff) |
249 ((jmp[0] & 0xffff) << 16);
7cc45e64
SR
250 if (tramp & 0x8000)
251 tramp -= 0x10000;
252
021376a3 253 pr_devel(" %lx ", tramp);
7cc45e64
SR
254
255 if (tramp != addr) {
072c4c01 256 pr_err("Trampoline location %08lx does not match addr\n",
7cc45e64
SR
257 tramp);
258 return -EINVAL;
259 }
260
16c57b36 261 op = PPC_INST_NOP;
7cc45e64 262
65b8c722 263 if (patch_instruction((unsigned int *)ip, op))
7cc45e64
SR
264 return -EPERM;
265
f48cb8b4
SR
266 return 0;
267}
268#endif /* PPC64 */
17be5b3d 269#endif /* CONFIG_MODULES */
f48cb8b4 270
8fd6e5a8
SR
271int ftrace_make_nop(struct module *mod,
272 struct dyn_ftrace *rec, unsigned long addr)
273{
f48cb8b4 274 unsigned long ip = rec->ip;
b54dcfe1 275 unsigned int old, new;
8fd6e5a8
SR
276
277 /*
278 * If the calling address is more that 24 bits away,
279 * then we had to use a trampoline to make the call.
280 * Otherwise just update the call site.
281 */
f48cb8b4 282 if (test_24bit_addr(ip, addr)) {
8fd6e5a8 283 /* within range */
46542888 284 old = ftrace_call_replace(ip, addr, 1);
92e02a51 285 new = PPC_INST_NOP;
f48cb8b4
SR
286 return ftrace_modify_code(ip, old, new);
287 }
288
17be5b3d 289#ifdef CONFIG_MODULES
f48cb8b4
SR
290 /*
291 * Out of range jumps are called from modules.
292 * We should either already have a pointer to the module
293 * or it has been passed in.
294 */
295 if (!rec->arch.mod) {
296 if (!mod) {
072c4c01 297 pr_err("No module loaded addr=%lx\n", addr);
f48cb8b4
SR
298 return -EFAULT;
299 }
300 rec->arch.mod = mod;
301 } else if (mod) {
302 if (mod != rec->arch.mod) {
072c4c01 303 pr_err("Record mod %p not equal to passed in mod %p\n",
f48cb8b4
SR
304 rec->arch.mod, mod);
305 return -EINVAL;
306 }
307 /* nothing to do if mod == rec->arch.mod */
308 } else
309 mod = rec->arch.mod;
f48cb8b4
SR
310
311 return __ftrace_make_nop(mod, rec, addr);
17be5b3d
SR
312#else
313 /* We should not get here without modules */
314 return -EINVAL;
315#endif /* CONFIG_MODULES */
f48cb8b4
SR
316}
317
17be5b3d 318#ifdef CONFIG_MODULES
f48cb8b4 319#ifdef CONFIG_PPC64
15308664
TD
320/*
321 * Examine the existing instructions for __ftrace_make_call.
322 * They should effectively be a NOP, and follow formal constraints,
323 * depending on the ABI. Return false if they don't.
324 */
325#ifndef CC_USING_MPROFILE_KERNEL
f48cb8b4 326static int
15308664 327expected_nop_sequence(void *ip, unsigned int op0, unsigned int op1)
f48cb8b4 328{
f48cb8b4 329 /*
24a1bdc3
AB
330 * We expect to see:
331 *
332 * b +8
333 * ld r2,XX(r1)
334 *
335 * The load offset is different depending on the ABI. For simplicity
336 * just mask it out when doing the compare.
f48cb8b4 337 */
15308664
TD
338 if ((op0 != 0x48000008) || ((op1 & 0xffff0000) != 0xe8410000))
339 return 0;
340 return 1;
341}
342#else
343static int
344expected_nop_sequence(void *ip, unsigned int op0, unsigned int op1)
345{
346 /* look for patched "NOP" on ppc64 with -mprofile-kernel */
347 if (op0 != PPC_INST_NOP)
348 return 0;
349 return 1;
350}
351#endif
352
353static int
354__ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
355{
356 unsigned int op[2];
357 void *ip = (void *)rec->ip;
358
359 /* read where this goes */
360 if (probe_kernel_read(op, ip, sizeof(op)))
361 return -EFAULT;
362
363 if (!expected_nop_sequence(ip, op[0], op[1])) {
364 pr_err("Unexpected call sequence at %p: %x %x\n",
365 ip, op[0], op[1]);
f48cb8b4
SR
366 return -EINVAL;
367 }
368
369 /* If we never set up a trampoline to ftrace_caller, then bail */
370 if (!rec->arch.mod->arch.tramp) {
072c4c01 371 pr_err("No ftrace trampoline\n");
f48cb8b4
SR
372 return -EINVAL;
373 }
374
24a1bdc3 375 /* Ensure branch is within 24 bits */
b7b348c6 376 if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
072c4c01 377 pr_err("Branch out of range\n");
f48cb8b4 378 return -EINVAL;
8fd6e5a8
SR
379 }
380
24a1bdc3 381 if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) {
072c4c01 382 pr_err("REL24 out of range!\n");
24a1bdc3
AB
383 return -EINVAL;
384 }
ec682cef 385
8fd6e5a8
SR
386 return 0;
387}
15308664
TD
388
389#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
390int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
391 unsigned long addr)
392{
393 return ftrace_make_call(rec, addr);
394}
395#endif
396
397#else /* !CONFIG_PPC64: */
f48cb8b4
SR
398static int
399__ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
400{
d9af12b7 401 unsigned int op;
7cc45e64 402 unsigned long ip = rec->ip;
7cc45e64
SR
403
404 /* read where this goes */
d9af12b7 405 if (probe_kernel_read(&op, (void *)ip, MCOUNT_INSN_SIZE))
7cc45e64
SR
406 return -EFAULT;
407
408 /* It should be pointing to a nop */
16c57b36 409 if (op != PPC_INST_NOP) {
072c4c01 410 pr_err("Expected NOP but have %x\n", op);
7cc45e64
SR
411 return -EINVAL;
412 }
413
414 /* If we never set up a trampoline to ftrace_caller, then bail */
415 if (!rec->arch.mod->arch.tramp) {
072c4c01 416 pr_err("No ftrace trampoline\n");
7cc45e64
SR
417 return -EINVAL;
418 }
419
0029ff87
SR
420 /* create the branch to the trampoline */
421 op = create_branch((unsigned int *)ip,
422 rec->arch.mod->arch.tramp, BRANCH_SET_LINK);
423 if (!op) {
072c4c01 424 pr_err("REL24 out of range!\n");
7cc45e64
SR
425 return -EINVAL;
426 }
427
021376a3 428 pr_devel("write to %lx\n", rec->ip);
7cc45e64 429
65b8c722 430 if (patch_instruction((unsigned int *)ip, op))
7cc45e64
SR
431 return -EPERM;
432
f48cb8b4
SR
433 return 0;
434}
435#endif /* CONFIG_PPC64 */
17be5b3d 436#endif /* CONFIG_MODULES */
8fd6e5a8
SR
437
438int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
439{
f48cb8b4 440 unsigned long ip = rec->ip;
b54dcfe1 441 unsigned int old, new;
8fd6e5a8
SR
442
443 /*
444 * If the calling address is more that 24 bits away,
445 * then we had to use a trampoline to make the call.
446 * Otherwise just update the call site.
447 */
f48cb8b4 448 if (test_24bit_addr(ip, addr)) {
8fd6e5a8 449 /* within range */
92e02a51 450 old = PPC_INST_NOP;
46542888 451 new = ftrace_call_replace(ip, addr, 1);
f48cb8b4 452 return ftrace_modify_code(ip, old, new);
8fd6e5a8
SR
453 }
454
17be5b3d 455#ifdef CONFIG_MODULES
f48cb8b4
SR
456 /*
457 * Out of range jumps are called from modules.
458 * Being that we are converting from nop, it had better
459 * already have a module defined.
460 */
461 if (!rec->arch.mod) {
072c4c01 462 pr_err("No module loaded\n");
f48cb8b4
SR
463 return -EINVAL;
464 }
f48cb8b4
SR
465
466 return __ftrace_make_call(rec, addr);
17be5b3d
SR
467#else
468 /* We should not get here without modules */
469 return -EINVAL;
470#endif /* CONFIG_MODULES */
8fd6e5a8
SR
471}
472
15adc048 473int ftrace_update_ftrace_func(ftrace_func_t func)
4e491d14
SR
474{
475 unsigned long ip = (unsigned long)(&ftrace_call);
b54dcfe1 476 unsigned int old, new;
4e491d14
SR
477 int ret;
478
b54dcfe1 479 old = *(unsigned int *)&ftrace_call;
46542888 480 new = ftrace_call_replace(ip, (unsigned long)func, 1);
4e491d14
SR
481 ret = ftrace_modify_code(ip, old, new);
482
483 return ret;
484}
485
ee456bb3
SR
486static int __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
487{
488 unsigned long ftrace_addr = (unsigned long)FTRACE_ADDR;
489 int ret;
490
491 ret = ftrace_update_record(rec, enable);
492
493 switch (ret) {
494 case FTRACE_UPDATE_IGNORE:
495 return 0;
496 case FTRACE_UPDATE_MAKE_CALL:
497 return ftrace_make_call(rec, ftrace_addr);
498 case FTRACE_UPDATE_MAKE_NOP:
499 return ftrace_make_nop(NULL, rec, ftrace_addr);
500 }
501
502 return 0;
503}
504
505void ftrace_replace_code(int enable)
506{
507 struct ftrace_rec_iter *iter;
508 struct dyn_ftrace *rec;
509 int ret;
510
511 for (iter = ftrace_rec_iter_start(); iter;
512 iter = ftrace_rec_iter_next(iter)) {
513 rec = ftrace_rec_iter_record(iter);
514 ret = __ftrace_replace_code(rec, enable);
515 if (ret) {
4fd3279b 516 ftrace_bug(ret, rec);
ee456bb3
SR
517 return;
518 }
519 }
520}
521
c96f8385
TD
522/*
523 * Use the default ftrace_modify_all_code, but without
524 * stop_machine().
525 */
ee456bb3
SR
526void arch_ftrace_update_code(int command)
527{
c96f8385 528 ftrace_modify_all_code(command);
ee456bb3
SR
529}
530
3a36cb11 531int __init ftrace_dyn_arch_init(void)
4e491d14 532{
4e491d14
SR
533 return 0;
534}
6794c782
SR
535#endif /* CONFIG_DYNAMIC_FTRACE */
536
537#ifdef CONFIG_FUNCTION_GRAPH_TRACER
538
46542888
SR
539#ifdef CONFIG_DYNAMIC_FTRACE
540extern void ftrace_graph_call(void);
541extern void ftrace_graph_stub(void);
542
543int ftrace_enable_ftrace_graph_caller(void)
544{
545 unsigned long ip = (unsigned long)(&ftrace_graph_call);
546 unsigned long addr = (unsigned long)(&ftrace_graph_caller);
547 unsigned long stub = (unsigned long)(&ftrace_graph_stub);
b54dcfe1 548 unsigned int old, new;
46542888 549
b54dcfe1 550 old = ftrace_call_replace(ip, stub, 0);
46542888
SR
551 new = ftrace_call_replace(ip, addr, 0);
552
553 return ftrace_modify_code(ip, old, new);
554}
555
556int ftrace_disable_ftrace_graph_caller(void)
557{
558 unsigned long ip = (unsigned long)(&ftrace_graph_call);
559 unsigned long addr = (unsigned long)(&ftrace_graph_caller);
560 unsigned long stub = (unsigned long)(&ftrace_graph_stub);
b54dcfe1 561 unsigned int old, new;
46542888 562
b54dcfe1 563 old = ftrace_call_replace(ip, addr, 0);
46542888
SR
564 new = ftrace_call_replace(ip, stub, 0);
565
566 return ftrace_modify_code(ip, old, new);
567}
568#endif /* CONFIG_DYNAMIC_FTRACE */
569
6794c782
SR
570/*
571 * Hook the return address and push it in the stack of return addrs
b3c18725 572 * in current thread info. Return the address we want to divert to.
6794c782 573 */
b3c18725 574unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip)
6794c782 575{
6794c782 576 struct ftrace_graph_ent trace;
7d56c65a 577 unsigned long return_hooker;
6794c782 578
96d4f43e 579 if (unlikely(ftrace_graph_is_dead()))
b3c18725 580 goto out;
96d4f43e 581
6794c782 582 if (unlikely(atomic_read(&current->tracing_graph_pause)))
b3c18725 583 goto out;
6794c782 584
7d56c65a 585 return_hooker = ppc_function_entry(return_to_handler);
6794c782 586
b3c18725 587 trace.func = ip;
bac821a6 588 trace.depth = current->curr_ret_stack + 1;
6794c782
SR
589
590 /* Only trace if the calling function expects to */
b3c18725
AB
591 if (!ftrace_graph_entry(&trace))
592 goto out;
593
9a7c348b
JP
594 if (ftrace_push_return_trace(parent, ip, &trace.depth, 0,
595 NULL) == -EBUSY)
b3c18725 596 goto out;
bac821a6 597
b3c18725
AB
598 parent = return_hooker;
599out:
600 return parent;
6794c782
SR
601}
602#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
02424d89
IM
603
604#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64)
605unsigned long __init arch_syscall_addr(int nr)
606{
607 return sys_call_table[nr*2];
608}
609#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_PPC64 */
7132e2d6 610
f55d9665 611#ifdef PPC64_ELF_ABI_v1
7132e2d6
TJB
612char *arch_ftrace_match_adjust(char *str, const char *search)
613{
614 if (str[0] == '.' && search[0] != '.')
615 return str + 1;
616 else
617 return str;
618}
f55d9665 619#endif /* PPC64_ELF_ABI_v1 */