Lines Matching refs:ip

46 ftrace_call_replace(unsigned long ip, unsigned long addr, int link)  in ftrace_call_replace()  argument
53 create_branch(&op, (u32 *)ip, addr, link ? BRANCH_SET_LINK : 0); in ftrace_call_replace()
59 ftrace_modify_code(unsigned long ip, ppc_inst_t old, ppc_inst_t new) in ftrace_modify_code() argument
72 if (copy_inst_from_kernel_nofault(&replaced, (void *)ip)) in ftrace_modify_code()
77 pr_err("%p: replaced (%08lx) != old (%08lx)", (void *)ip, in ftrace_modify_code()
83 return patch_instruction((u32 *)ip, new); in ftrace_modify_code()
89 static int test_24bit_addr(unsigned long ip, unsigned long addr) in test_24bit_addr() argument
93 return is_offset_in_branch_range(addr - ip); in test_24bit_addr()
106 static unsigned long find_bl_target(unsigned long ip, ppc_inst_t op) in find_bl_target() argument
115 return ip + (long)offset; in find_bl_target()
124 unsigned long ip = rec->ip; in __ftrace_make_nop() local
128 if (copy_inst_from_kernel_nofault(&op, (void *)ip)) { in __ftrace_make_nop()
140 tramp = find_bl_target(ip, op); in __ftrace_make_nop()
142 pr_devel("ip:%lx jumps to %lx", ip, tramp); in __ftrace_make_nop()
159 if (copy_inst_from_kernel_nofault(&op, (void *)(ip - 4))) { in __ftrace_make_nop()
160 pr_err("Fetching instruction at %lx failed.\n", ip - 4); in __ftrace_make_nop()
176 if (copy_inst_from_kernel_nofault(&op, (void *)(ip + 4))) { in __ftrace_make_nop()
208 if (patch_instruction((u32 *)ip, pop)) { in __ftrace_make_nop()
222 static unsigned long find_ftrace_tramp(unsigned long ip) in find_ftrace_tramp() argument
233 else if (is_offset_in_branch_range(ftrace_tramps[i] - ip)) in find_ftrace_tramp()
310 unsigned long tramp, ip = rec->ip; in __ftrace_make_nop_kernel() local
314 if (copy_inst_from_kernel_nofault(&op, (void *)ip)) { in __ftrace_make_nop_kernel()
326 tramp = find_bl_target(ip, op); in __ftrace_make_nop_kernel()
328 pr_devel("ip:%lx jumps to %lx", ip, tramp); in __ftrace_make_nop_kernel()
332 if (!find_ftrace_tramp(ip)) { in __ftrace_make_nop_kernel()
334 (void *)ip); in __ftrace_make_nop_kernel()
339 if (patch_instruction((u32 *)ip, ppc_inst(PPC_RAW_NOP()))) { in __ftrace_make_nop_kernel()
350 unsigned long ip = rec->ip; in ftrace_make_nop() local
358 if (test_24bit_addr(ip, addr)) { in ftrace_make_nop()
360 old = ftrace_call_replace(ip, addr, 1); in ftrace_make_nop()
362 return ftrace_modify_code(ip, old, new); in ftrace_make_nop()
363 } else if (core_kernel_text(ip)) { in ftrace_make_nop()
399 static bool expected_nop_sequence(void *ip, ppc_inst_t op0, ppc_inst_t op1) in expected_nop_sequence() argument
412 void *ip = (void *)rec->ip; in __ftrace_make_call() local
417 if (copy_inst_from_kernel_nofault(op, ip)) in __ftrace_make_call()
421 copy_inst_from_kernel_nofault(op + 1, ip + 4)) in __ftrace_make_call()
424 if (!expected_nop_sequence(ip, op[0], op[1])) { in __ftrace_make_call()
425 pr_err("Unexpected call sequence at %p: %08lx %08lx\n", ip, in __ftrace_make_call()
456 if (patch_branch(ip, tramp, BRANCH_SET_LINK)) { in __ftrace_make_call()
473 void *ip = (void *)rec->ip; in __ftrace_make_call_kernel() local
489 if (copy_inst_from_kernel_nofault(&op, ip)) { in __ftrace_make_call_kernel()
490 pr_err("Unable to read ftrace location %p\n", ip); in __ftrace_make_call_kernel()
496 ip, ppc_inst_as_ulong(op)); in __ftrace_make_call_kernel()
500 tramp = find_ftrace_tramp((unsigned long)ip); in __ftrace_make_call_kernel()
502 pr_err("No ftrace trampolines reachable from %ps\n", ip); in __ftrace_make_call_kernel()
506 if (patch_branch(ip, tramp, BRANCH_SET_LINK)) { in __ftrace_make_call_kernel()
516 unsigned long ip = rec->ip; in ftrace_make_call() local
524 if (test_24bit_addr(ip, addr)) { in ftrace_make_call()
527 new = ftrace_call_replace(ip, addr, 1); in ftrace_make_call()
528 return ftrace_modify_code(ip, old, new); in ftrace_make_call()
529 } else if (core_kernel_text(ip)) { in ftrace_make_call()
556 unsigned long ip = rec->ip; in __ftrace_modify_call() local
567 if (copy_inst_from_kernel_nofault(&op, (void *)ip)) { in __ftrace_modify_call()
579 tramp = find_bl_target(ip, op); in __ftrace_modify_call()
582 pr_devel("ip:%lx jumps to %lx", ip, tramp); in __ftrace_modify_call()
601 if (test_24bit_addr(ip, addr)) { in __ftrace_modify_call()
603 if (patch_branch((u32 *)ip, addr, BRANCH_SET_LINK)) { in __ftrace_modify_call()
630 if (patch_branch((u32 *)ip, tramp, BRANCH_SET_LINK)) { in __ftrace_modify_call()
647 unsigned long ip = rec->ip; in ftrace_modify_call() local
655 if (test_24bit_addr(ip, addr) && test_24bit_addr(ip, old_addr)) { in ftrace_modify_call()
657 old = ftrace_call_replace(ip, old_addr, 1); in ftrace_modify_call()
658 new = ftrace_call_replace(ip, addr, 1); in ftrace_modify_call()
659 return ftrace_modify_code(ip, old, new); in ftrace_modify_call()
660 } else if (core_kernel_text(ip)) { in ftrace_modify_call()
685 unsigned long ip = (unsigned long)(&ftrace_call); in ftrace_update_ftrace_func() local
690 new = ftrace_call_replace(ip, (unsigned long)func, 1); in ftrace_update_ftrace_func()
691 ret = ftrace_modify_code(ip, old, new); in ftrace_update_ftrace_func()
695 ip = (unsigned long)(&ftrace_regs_call); in ftrace_update_ftrace_func()
697 new = ftrace_call_replace(ip, (unsigned long)func, 1); in ftrace_update_ftrace_func()
698 ret = ftrace_modify_code(ip, old, new); in ftrace_update_ftrace_func()
774 unsigned long ip = (unsigned long)(&ftrace_graph_call); in ftrace_modify_ftrace_graph_caller() local
782 old = ftrace_call_replace(ip, enable ? stub : addr, 0); in ftrace_modify_ftrace_graph_caller()
783 new = ftrace_call_replace(ip, enable ? addr : stub, 0); in ftrace_modify_ftrace_graph_caller()
785 return ftrace_modify_code(ip, old, new); in ftrace_modify_ftrace_graph_caller()
803 __prepare_ftrace_return(unsigned long parent, unsigned long ip, unsigned long sp) in __prepare_ftrace_return() argument
814 bit = ftrace_test_recursion_trylock(ip, parent); in __prepare_ftrace_return()
820 if (!function_graph_enter(parent, ip, 0, (unsigned long *)sp)) in __prepare_ftrace_return()
829 void ftrace_graph_func(unsigned long ip, unsigned long parent_ip, in ftrace_graph_func() argument
832 fregs->regs.link = __prepare_ftrace_return(parent_ip, ip, fregs->regs.gpr[1]); in ftrace_graph_func()
835 unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip, in prepare_ftrace_return() argument
838 return __prepare_ftrace_return(parent, ip, sp); in prepare_ftrace_return()