Lines Matching refs:p
78 int arch_prepare_kprobe(struct kprobe *p) in arch_prepare_kprobe() argument
84 insn = p->addr[0]; in arch_prepare_kprobe()
92 if (copy_from_kernel_nofault(&prev_insn, p->addr - 1, in arch_prepare_kprobe()
107 p->ainsn.insn = get_insn_slot(); in arch_prepare_kprobe()
108 if (!p->ainsn.insn) { in arch_prepare_kprobe()
127 memcpy(&p->ainsn.insn[0], p->addr + 1, sizeof(kprobe_opcode_t)); in arch_prepare_kprobe()
129 memcpy(&p->ainsn.insn[0], p->addr, sizeof(kprobe_opcode_t)); in arch_prepare_kprobe()
131 p->ainsn.insn[1] = breakpoint2_insn; in arch_prepare_kprobe()
132 p->opcode = *p->addr; in arch_prepare_kprobe()
139 void arch_arm_kprobe(struct kprobe *p) in arch_arm_kprobe() argument
141 *p->addr = breakpoint_insn; in arch_arm_kprobe()
142 flush_insn_slot(p); in arch_arm_kprobe()
146 void arch_disarm_kprobe(struct kprobe *p) in arch_disarm_kprobe() argument
148 *p->addr = p->opcode; in arch_disarm_kprobe()
149 flush_insn_slot(p); in arch_disarm_kprobe()
153 void arch_remove_kprobe(struct kprobe *p) in arch_remove_kprobe() argument
155 if (p->ainsn.insn) { in arch_remove_kprobe()
156 free_insn_slot(p->ainsn.insn, 0); in arch_remove_kprobe()
157 p->ainsn.insn = NULL; in arch_remove_kprobe()
180 static void set_current_kprobe(struct kprobe *p, struct pt_regs *regs, in set_current_kprobe() argument
183 __this_cpu_write(current_kprobe, p); in set_current_kprobe()
201 static int evaluate_branch_instruction(struct kprobe *p, struct pt_regs *regs, in evaluate_branch_instruction() argument
204 union mips_instruction insn = p->opcode; in evaluate_branch_instruction()
212 if (p->ainsn.insn->word == 0) in evaluate_branch_instruction()
235 static void prepare_singlestep(struct kprobe *p, struct pt_regs *regs, in prepare_singlestep() argument
243 if (p->opcode.word == breakpoint_insn.word || in prepare_singlestep()
244 p->opcode.word == breakpoint2_insn.word) in prepare_singlestep()
245 regs->cp0_epc = (unsigned long)p->addr; in prepare_singlestep()
246 else if (insn_has_delayslot(p->opcode)) { in prepare_singlestep()
247 ret = evaluate_branch_instruction(p, regs, kcb); in prepare_singlestep()
251 regs->cp0_epc = (unsigned long)&p->ainsn.insn[0]; in prepare_singlestep()
266 static void resume_execution(struct kprobe *p, in resume_execution() argument
270 if (insn_has_delayslot(p->opcode)) in resume_execution()
281 struct kprobe *p; in kprobe_handler() local
297 p = get_kprobe(addr); in kprobe_handler()
298 if (p) { in kprobe_handler()
300 p->ainsn.insn->word == breakpoint_insn.word) { in kprobe_handler()
313 set_current_kprobe(p, regs, kcb); in kprobe_handler()
314 kprobes_inc_nmissed_count(p); in kprobe_handler()
315 prepare_singlestep(p, regs, kcb); in kprobe_handler()
318 resume_execution(p, regs, kcb); in kprobe_handler()
334 p = get_kprobe(addr); in kprobe_handler()
335 if (!p) { in kprobe_handler()
350 set_current_kprobe(p, regs, kcb); in kprobe_handler()
353 if (p->pre_handler && p->pre_handler(p, regs)) { in kprobe_handler()
360 prepare_singlestep(p, regs, kcb); in kprobe_handler()
363 if (p->post_handler) in kprobe_handler()
364 p->post_handler(p, regs, 0); in kprobe_handler()
365 resume_execution(p, regs, kcb); in kprobe_handler()
495 static int trampoline_probe_handler(struct kprobe *p, in trampoline_probe_handler() argument
508 int arch_trampoline_kprobe(struct kprobe *p) in arch_trampoline_kprobe() argument
510 if (p->addr == (kprobe_opcode_t *)__kretprobe_trampoline) in arch_trampoline_kprobe()