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

1 // SPDX-License-Identifier: GPL-2.0-only
15 p->ainsn.insn[0] = *p->addr; in arch_prepare_ss_slot()
16 p->ainsn.insn[1] = KPROBE_SSTEPBP_INSN; in arch_prepare_ss_slot()
17 p->ainsn.restore = (unsigned long)p->addr + LOONGARCH_INSN_SIZE; in arch_prepare_ss_slot()
23 p->ainsn.restore = 0; in arch_prepare_simulate()
31 if ((unsigned long)p->addr & 0x3) in arch_prepare_kprobe()
32 return -EILSEQ; in arch_prepare_kprobe()
35 p->opcode = *p->addr; in arch_prepare_kprobe()
36 insn.word = p->opcode; in arch_prepare_kprobe()
40 return -EINVAL; in arch_prepare_kprobe()
43 p->ainsn.insn = NULL; in arch_prepare_kprobe()
45 p->ainsn.insn = get_insn_slot(); in arch_prepare_kprobe()
46 if (!p->ainsn.insn) in arch_prepare_kprobe()
47 return -ENOMEM; in arch_prepare_kprobe()
51 if (p->ainsn.insn) in arch_prepare_kprobe()
63 *p->addr = KPROBE_BP_INSN; in arch_arm_kprobe()
71 *p->addr = p->opcode; in arch_disarm_kprobe()
78 if (p->ainsn.insn) { in arch_remove_kprobe()
79 free_insn_slot(p->ainsn.insn, 0); in arch_remove_kprobe()
80 p->ainsn.insn = NULL; in arch_remove_kprobe()
87 kcb->prev_kprobe.kp = kprobe_running(); in save_previous_kprobe()
88 kcb->prev_kprobe.status = kcb->kprobe_status; in save_previous_kprobe()
94 __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp); in restore_previous_kprobe()
95 kcb->kprobe_status = kcb->prev_kprobe.status; in restore_previous_kprobe()
106 * Interrupts need to be disabled before single-step mode is set,
107 * and not reenabled until after single-step mode ends.
110 * of out-of-line single-step, that result in wrongly single stepping
116 kcb->saved_status = regs->csr_prmd; in save_local_irqflag()
117 regs->csr_prmd &= ~CSR_PRMD_PIE; in save_local_irqflag()
124 regs->csr_prmd = kcb->saved_status; in restore_local_irqflag()
131 /* return addr restore if non-branching insn */ in post_kprobe_handler()
132 if (cur->ainsn.restore != 0) in post_kprobe_handler()
133 instruction_pointer_set(regs, cur->ainsn.restore); in post_kprobe_handler()
136 if (kcb->kprobe_status == KPROBE_REENTER) { in post_kprobe_handler()
143 * update the kcb status even if the cur->post_handler is in post_kprobe_handler()
146 kcb->kprobe_status = KPROBE_HIT_SSDONE; in post_kprobe_handler()
147 if (cur->post_handler) in post_kprobe_handler()
148 cur->post_handler(cur, regs, 0); in post_kprobe_handler()
163 kcb->kprobe_status = KPROBE_REENTER; in setup_singlestep()
165 kcb->kprobe_status = KPROBE_HIT_SS; in setup_singlestep()
168 if (p->ainsn.insn) { in setup_singlestep()
172 regs->csr_era = (unsigned long)p->ainsn.insn; in setup_singlestep()
175 insn.word = p->opcode; in setup_singlestep()
177 /* now go for post processing */ in setup_singlestep()
186 switch (kcb->kprobe_status) { in reenter_kprobe()
211 kprobe_opcode_t *addr = (kprobe_opcode_t *)regs->csr_era; in kprobe_breakpoint_handler()
215 * duration of kprobe processing. in kprobe_breakpoint_handler()
229 kcb->kprobe_status = KPROBE_HIT_ACTIVE; in kprobe_breakpoint_handler()
232 * If we have no pre-handler or it returned 0, we in kprobe_breakpoint_handler()
233 * continue with normal processing. If we have a in kprobe_breakpoint_handler()
234 * pre-handler and it returned non-zero, it will in kprobe_breakpoint_handler()
241 if (!p->pre_handler || !p->pre_handler(p, regs)) { in kprobe_breakpoint_handler()
260 regs->csr_era = (unsigned long)addr; in kprobe_breakpoint_handler()
276 if (cur && (kcb->kprobe_status & (KPROBE_HIT_SS | KPROBE_REENTER)) && in kprobe_singlestep_handler()
277 ((unsigned long)&cur->ainsn.insn[1] == addr)) { in kprobe_singlestep_handler()
293 switch (kcb->kprobe_status) { in kprobe_fault_handler()
303 regs->csr_era = (unsigned long)cur->addr; in kprobe_fault_handler()
306 if (kcb->kprobe_status == KPROBE_REENTER) { in kprobe_fault_handler()