Lines Matching +full:pre +full:- +full:processing

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
18 (unsigned long)current_thread_info() + THREAD_SIZE - (addr))
26 if ((unsigned long)p->addr & 0x01) in arch_prepare_kprobe()
27 return -EINVAL; in arch_prepare_kprobe()
31 p->ainsn.is_short = is_short_instr((unsigned long)p->addr); in arch_prepare_kprobe()
32 p->opcode = *p->addr; in arch_prepare_kprobe()
39 *p->addr = UNIMP_S_INSTRUCTION; in arch_arm_kprobe()
41 flush_icache_range((unsigned long)p->addr, in arch_arm_kprobe()
42 (unsigned long)p->addr + sizeof(kprobe_opcode_t)); in arch_arm_kprobe()
47 *p->addr = p->opcode; in arch_disarm_kprobe()
49 flush_icache_range((unsigned long)p->addr, in arch_disarm_kprobe()
50 (unsigned long)p->addr + sizeof(kprobe_opcode_t)); in arch_disarm_kprobe()
58 if (p->ainsn.t1_addr) { in arch_remove_kprobe()
59 *(p->ainsn.t1_addr) = p->ainsn.t1_opcode; in arch_remove_kprobe()
61 flush_icache_range((unsigned long)p->ainsn.t1_addr, in arch_remove_kprobe()
62 (unsigned long)p->ainsn.t1_addr + in arch_remove_kprobe()
65 p->ainsn.t1_addr = NULL; in arch_remove_kprobe()
68 if (p->ainsn.t2_addr) { in arch_remove_kprobe()
69 *(p->ainsn.t2_addr) = p->ainsn.t2_opcode; in arch_remove_kprobe()
71 flush_icache_range((unsigned long)p->ainsn.t2_addr, in arch_remove_kprobe()
72 (unsigned long)p->ainsn.t2_addr + in arch_remove_kprobe()
75 p->ainsn.t2_addr = NULL; in arch_remove_kprobe()
81 kcb->prev_kprobe.kp = kprobe_running(); in save_previous_kprobe()
82 kcb->prev_kprobe.status = kcb->kprobe_status; in save_previous_kprobe()
87 __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp); in restore_previous_kprobe()
88 kcb->kprobe_status = kcb->prev_kprobe.status; in restore_previous_kprobe()
102 if (p->ainsn.t1_addr) { in resume_execution()
103 *(p->ainsn.t1_addr) = p->ainsn.t1_opcode; in resume_execution()
105 flush_icache_range((unsigned long)p->ainsn.t1_addr, in resume_execution()
106 (unsigned long)p->ainsn.t1_addr + in resume_execution()
109 p->ainsn.t1_addr = NULL; in resume_execution()
112 if (p->ainsn.t2_addr) { in resume_execution()
113 *(p->ainsn.t2_addr) = p->ainsn.t2_opcode; in resume_execution()
115 flush_icache_range((unsigned long)p->ainsn.t2_addr, in resume_execution()
116 (unsigned long)p->ainsn.t2_addr + in resume_execution()
119 p->ainsn.t2_addr = NULL; in resume_execution()
136 *(p->addr) = p->opcode; in setup_singlestep()
138 flush_icache_range((unsigned long)p->addr, in setup_singlestep()
139 (unsigned long)p->addr + sizeof(kprobe_opcode_t)); in setup_singlestep()
146 bta = regs->bta; in setup_singlestep()
148 if (regs->status32 & 0x40) { in setup_singlestep()
153 if (!p->ainsn.is_short) { in setup_singlestep()
155 regs->blink += 2; in setup_singlestep()
163 regs->bta += 2; in setup_singlestep()
170 disasm_next_pc((unsigned long)p->addr, regs, in setup_singlestep()
171 (struct callee_regs *) current->thread.callee_reg, in setup_singlestep()
174 p->ainsn.t1_addr = (kprobe_opcode_t *) next_pc; in setup_singlestep()
175 p->ainsn.t1_opcode = *(p->ainsn.t1_addr); in setup_singlestep()
176 *(p->ainsn.t1_addr) = TRAP_S_2_INSTRUCTION; in setup_singlestep()
178 flush_icache_range((unsigned long)p->ainsn.t1_addr, in setup_singlestep()
179 (unsigned long)p->ainsn.t1_addr + in setup_singlestep()
183 p->ainsn.t2_addr = (kprobe_opcode_t *) tgt_if_br; in setup_singlestep()
184 p->ainsn.t2_opcode = *(p->ainsn.t2_addr); in setup_singlestep()
185 *(p->ainsn.t2_addr) = TRAP_S_2_INSTRUCTION; in setup_singlestep()
187 flush_icache_range((unsigned long)p->ainsn.t2_addr, in setup_singlestep()
188 (unsigned long)p->ainsn.t2_addr + in setup_singlestep()
217 kcb->kprobe_status = KPROBE_REENTER; in arc_kprobe_handler()
222 kcb->kprobe_status = KPROBE_HIT_ACTIVE; in arc_kprobe_handler()
224 /* If we have no pre-handler or it returned 0, we continue with in arc_kprobe_handler()
225 * normal processing. If we have a pre-handler and it returned in arc_kprobe_handler()
226 * non-zero - which means user handler setup registers to exit in arc_kprobe_handler()
229 if (!p->pre_handler || !p->pre_handler(p, regs)) { in arc_kprobe_handler()
231 kcb->kprobe_status = KPROBE_HIT_SS; in arc_kprobe_handler()
264 regs->ret = addr; in arc_post_kprobe_handler()
266 if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) { in arc_post_kprobe_handler()
267 kcb->kprobe_status = KPROBE_HIT_SSDONE; in arc_post_kprobe_handler()
268 cur->post_handler(cur, regs, 0); in arc_post_kprobe_handler()
271 if (kcb->kprobe_status == KPROBE_REENTER) { in arc_post_kprobe_handler()
285 * pre/post handlers in the module.
295 switch (kcb->kprobe_status) { in kprobe_fault_handler()
304 resume_execution(cur, (unsigned long)cur->addr, regs); in kprobe_fault_handler()
306 if (kcb->kprobe_status == KPROBE_REENTER) in kprobe_fault_handler()
317 * We are here because the instructions in the pre/post handler in kprobe_fault_handler()
322 * In case the user-specified fault handler returned zero, in kprobe_fault_handler()
344 unsigned long addr = args->err; in kprobe_exceptions_notify()
349 if (arc_kprobe_handler(addr, args->regs)) in kprobe_exceptions_notify()
354 if (arc_post_kprobe_handler(addr, args->regs)) in kprobe_exceptions_notify()
376 ri->ret_addr = (kprobe_opcode_t *) regs->blink; in arch_prepare_kretprobe()
377 ri->fp = NULL; in arch_prepare_kretprobe()
380 regs->blink = (unsigned long)&__kretprobe_trampoline; in arch_prepare_kretprobe()
386 regs->ret = __kretprobe_trampoline_handler(regs, NULL); in trampoline_probe_handler()
407 if (p->addr == (kprobe_opcode_t *) &__kretprobe_trampoline) in arch_trampoline_kprobe()