Lines Matching +full:bl +full:- +full:code +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0
21 return -EFAULT; in ftrace_modify_code()
24 return -EINVAL; in ftrace_modify_code()
28 return -EPERM; in ftrace_modify_code()
36 long offset = (long)addr - (long)pc; in reachable_by_bl() local
38 return offset >= -SZ_128M && offset < SZ_128M; in reachable_by_bl()
43 struct plt_entry *plt = mod->arch.ftrace_trampolines; in get_ftrace_plt()
57 * Due to the limited range of 'bl' instruction, modules may be placed too far
65 unsigned long pc = rec->ip + LOONGARCH_INSN_SIZE; in ftrace_find_callable_addr()
71 * ops->direct_call. in ftrace_find_callable_addr()
77 * When the target is within range of the 'bl' instruction, use 'addr' in ftrace_find_callable_addr()
78 * as-is and branch to that directly. in ftrace_find_callable_addr()
85 * dealing with an out-of-range condition, we can assume it in ftrace_find_callable_addr()
90 * retains its validity throughout the remainder of this code. in ftrace_find_callable_addr()
123 pc = rec->ip + LOONGARCH_INSN_SIZE; in ftrace_modify_call()
126 return -EINVAL; in ftrace_modify_call()
129 return -EINVAL; in ftrace_modify_call()
153 * At runtime, we can replace nop with bl to enable ftrace call and replace bl
154 * with nop to disable ftrace call. The bl requires us to save the original RA
160 * +------------+------------------------+------------------------+
162 * | nop | nop | bl ftrace_caller |
175 pc = rec->ip; in ftrace_init_nop()
187 pc = rec->ip + LOONGARCH_INSN_SIZE; in ftrace_make_call()
190 return -EINVAL; in ftrace_make_call()
203 pc = rec->ip + LOONGARCH_INSN_SIZE; in ftrace_make_nop()
206 return -EINVAL; in ftrace_make_nop()
231 if (unlikely(atomic_read(&current->tracing_graph_pause))) in prepare_ftrace_return()
244 struct pt_regs *regs = &arch_ftrace_regs(fregs)->regs; in ftrace_graph_func()
245 unsigned long *parent = (unsigned long *)&regs->regs[1]; in ftrace_graph_func()
249 if (unlikely(atomic_read(&current->tracing_graph_pause))) in ftrace_graph_func()
289 /* Ftrace callback handler for kprobes -- called under preepmt disabled */
322 kcb->kprobe_status = KPROBE_HIT_ACTIVE; in kprobe_ftrace_handler()
323 if (!p->pre_handler || !p->pre_handler(p, regs)) { in kprobe_ftrace_handler()
325 * Emulate singlestep (and also recover regs->csr_era) in kprobe_ftrace_handler()
328 instruction_pointer_set(regs, (unsigned long)p->addr + MCOUNT_INSN_SIZE); in kprobe_ftrace_handler()
329 if (unlikely(p->post_handler)) { in kprobe_ftrace_handler()
330 kcb->kprobe_status = KPROBE_HIT_SSDONE; in kprobe_ftrace_handler()
331 p->post_handler(p, regs, 0); in kprobe_ftrace_handler()
337 * If pre_handler returns !0, it changes regs->csr_era. We have to in kprobe_ftrace_handler()
349 p->ainsn.insn = NULL; in arch_prepare_kprobe_ftrace()