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

1 // SPDX-License-Identifier: GPL-2.0
5 * PA-RISC kprobes implementation
22 if ((unsigned long)p->addr & 3UL) in arch_prepare_kprobe()
23 return -EINVAL; in arch_prepare_kprobe()
25 p->ainsn.insn = get_insn_slot(); in arch_prepare_kprobe()
26 if (!p->ainsn.insn) in arch_prepare_kprobe()
27 return -ENOMEM; in arch_prepare_kprobe()
33 p->opcode = *p->addr; in arch_prepare_kprobe()
34 p->ainsn.insn[0] = p->opcode; in arch_prepare_kprobe()
35 p->ainsn.insn[1] = PARISC_KPROBES_BREAK_INSN2; in arch_prepare_kprobe()
43 if (!p->ainsn.insn) in arch_remove_kprobe()
46 free_insn_slot(p->ainsn.insn, 0); in arch_remove_kprobe()
47 p->ainsn.insn = NULL; in arch_remove_kprobe()
52 patch_text(p->addr, PARISC_KPROBES_BREAK_INSN); in arch_arm_kprobe()
57 patch_text(p->addr, p->opcode); in arch_disarm_kprobe()
62 kcb->prev_kprobe.kp = kprobe_running(); in save_previous_kprobe()
63 kcb->prev_kprobe.status = kcb->kprobe_status; in save_previous_kprobe()
68 __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp); in restore_previous_kprobe()
69 kcb->kprobe_status = kcb->prev_kprobe.status; in restore_previous_kprobe()
80 kcb->iaoq[0] = regs->iaoq[0]; in setup_singlestep()
81 kcb->iaoq[1] = regs->iaoq[1]; in setup_singlestep()
82 instruction_pointer_set(regs, (unsigned long)p->ainsn.insn); in setup_singlestep()
93 p = get_kprobe((unsigned long *)regs->iaoq[0]); in parisc_kprobe_break_handler()
112 kcb->kprobe_status = KPROBE_REENTER; in parisc_kprobe_break_handler()
117 kcb->kprobe_status = KPROBE_HIT_ACTIVE; in parisc_kprobe_break_handler()
119 /* If we have no pre-handler or it returned 0, we continue with in parisc_kprobe_break_handler()
120 * normal processing. If we have a pre-handler and it returned in parisc_kprobe_break_handler()
121 * non-zero - which means user handler setup registers to exit in parisc_kprobe_break_handler()
125 if (!p->pre_handler || !p->pre_handler(p, regs)) { in parisc_kprobe_break_handler()
127 kcb->kprobe_status = KPROBE_HIT_SS; in parisc_kprobe_break_handler()
143 if (regs->iaoq[0] != (unsigned long)p->ainsn.insn+4) in parisc_kprobe_ss_handler()
147 if (kcb->kprobe_status == KPROBE_REENTER) { in parisc_kprobe_ss_handler()
158 if (p->post_handler) in parisc_kprobe_ss_handler()
159 p->post_handler(p, regs, 0); in parisc_kprobe_ss_handler()
161 switch (regs->iir >> 26) { in parisc_kprobe_ss_handler()
166 /* for absolute branches, regs->iaoq[1] has already the right in parisc_kprobe_ss_handler()
169 regs->iaoq[0] = kcb->iaoq[1]; in parisc_kprobe_ss_handler()
172 regs->iaoq[0] = kcb->iaoq[1]; in parisc_kprobe_ss_handler()
173 regs->iaoq[1] = regs->iaoq[0] + 4; in parisc_kprobe_ss_handler()
176 kcb->kprobe_status = KPROBE_HIT_SSDONE; in parisc_kprobe_ss_handler()
205 regs->gr[2] = (unsigned long)correct_ret_addr; in arch_kretprobe_fixup_return()
211 ri->ret_addr = (kprobe_opcode_t *)regs->gr[2]; in arch_prepare_kretprobe()
212 ri->fp = NULL; in arch_prepare_kretprobe()
215 regs->gr[2] = (unsigned long)trampoline_p.addr; in arch_prepare_kretprobe()
220 return p->addr == trampoline_p.addr; in arch_trampoline_kprobe()