Lines Matching refs:auprobe

277 static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool x86_64)  in uprobe_init_insn()  argument
283 ret = insn_decode(insn, auprobe->insn, sizeof(auprobe->insn), m); in uprobe_init_insn()
335 static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn) in riprel_analyze() argument
350 cursor = auprobe->insn + insn_offset_rex_prefix(insn); in riprel_analyze()
369 cursor = auprobe->insn + insn_offset_vex_prefix(insn) + 1; in riprel_analyze()
433 auprobe->defparam.fixups |= UPROBE_FIX_RIP_SI; in riprel_analyze()
436 auprobe->defparam.fixups |= UPROBE_FIX_RIP_DI; in riprel_analyze()
440 auprobe->defparam.fixups |= UPROBE_FIX_RIP_BX; in riprel_analyze()
447 cursor = auprobe->insn + insn_offset_modrm(insn); in riprel_analyze()
457 scratch_reg(struct arch_uprobe *auprobe, struct pt_regs *regs) in scratch_reg() argument
459 if (auprobe->defparam.fixups & UPROBE_FIX_RIP_SI) in scratch_reg()
461 if (auprobe->defparam.fixups & UPROBE_FIX_RIP_DI) in scratch_reg()
470 static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in riprel_pre_xol() argument
472 if (auprobe->defparam.fixups & UPROBE_FIX_RIP_MASK) { in riprel_pre_xol()
474 unsigned long *sr = scratch_reg(auprobe, regs); in riprel_pre_xol()
477 *sr = utask->vaddr + auprobe->defparam.ilen; in riprel_pre_xol()
481 static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in riprel_post_xol() argument
483 if (auprobe->defparam.fixups & UPROBE_FIX_RIP_MASK) { in riprel_post_xol()
485 unsigned long *sr = scratch_reg(auprobe, regs); in riprel_post_xol()
494 static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn) in riprel_analyze() argument
497 static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in riprel_pre_xol() argument
500 static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in riprel_post_xol() argument
520 static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in default_pre_xol_op() argument
522 riprel_pre_xol(auprobe, regs); in default_pre_xol_op()
554 static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in default_post_xol_op() argument
558 riprel_post_xol(auprobe, regs); in default_post_xol_op()
559 if (auprobe->defparam.fixups & UPROBE_FIX_IP) { in default_post_xol_op()
562 } else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) { in default_post_xol_op()
564 if (emulate_push_stack(regs, utask->vaddr + auprobe->defparam.ilen)) in default_post_xol_op()
568 if (auprobe->defparam.fixups & UPROBE_FIX_SETF) in default_post_xol_op()
574 static void default_abort_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in default_abort_op() argument
576 riprel_post_xol(auprobe, regs); in default_abort_op()
585 static bool branch_is_call(struct arch_uprobe *auprobe) in branch_is_call() argument
587 return auprobe->branch.opc1 == 0xe8; in branch_is_call()
619 static bool check_jmp_cond(struct arch_uprobe *auprobe, struct pt_regs *regs) in check_jmp_cond() argument
623 switch (auprobe->branch.opc1) { in check_jmp_cond()
638 static bool branch_emulate_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in branch_emulate_op() argument
640 unsigned long new_ip = regs->ip += auprobe->branch.ilen; in branch_emulate_op()
641 unsigned long offs = (long)auprobe->branch.offs; in branch_emulate_op()
643 if (branch_is_call(auprobe)) { in branch_emulate_op()
655 } else if (!check_jmp_cond(auprobe, regs)) { in branch_emulate_op()
663 static bool push_emulate_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in push_emulate_op() argument
665 unsigned long *src_ptr = (void *)regs + auprobe->push.reg_offset; in push_emulate_op()
669 regs->ip += auprobe->push.ilen; in push_emulate_op()
673 static int branch_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in branch_post_xol_op() argument
675 BUG_ON(!branch_is_call(auprobe)); in branch_post_xol_op()
686 static void branch_clear_offset(struct arch_uprobe *auprobe, struct insn *insn) in branch_clear_offset() argument
702 memset(auprobe->insn + insn_offset_immediate(insn), in branch_clear_offset()
716 static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) in branch_setup_xol_ops() argument
730 branch_clear_offset(auprobe, insn); in branch_setup_xol_ops()
758 auprobe->branch.opc1 = opc1; in branch_setup_xol_ops()
759 auprobe->branch.ilen = insn->length; in branch_setup_xol_ops()
760 auprobe->branch.offs = insn->immediate.value; in branch_setup_xol_ops()
762 auprobe->ops = &branch_xol_ops; in branch_setup_xol_ops()
767 static int push_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) in push_setup_xol_ops() argument
841 auprobe->push.reg_offset = reg_offset; in push_setup_xol_ops()
842 auprobe->push.ilen = insn->length; in push_setup_xol_ops()
843 auprobe->ops = &push_xol_ops; in push_setup_xol_ops()
854 int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long addr) in arch_uprobe_analyze_insn() argument
860 ret = uprobe_init_insn(auprobe, &insn, is_64bit_mm(mm)); in arch_uprobe_analyze_insn()
864 ret = branch_setup_xol_ops(auprobe, &insn); in arch_uprobe_analyze_insn()
868 ret = push_setup_xol_ops(auprobe, &insn); in arch_uprobe_analyze_insn()
878 auprobe->defparam.fixups |= UPROBE_FIX_SETF; in arch_uprobe_analyze_insn()
901 riprel_analyze(auprobe, &insn); in arch_uprobe_analyze_insn()
904 auprobe->defparam.ilen = insn.length; in arch_uprobe_analyze_insn()
905 auprobe->defparam.fixups |= fix_ip_or_call; in arch_uprobe_analyze_insn()
907 auprobe->ops = &default_xol_ops; in arch_uprobe_analyze_insn()
916 int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in arch_uprobe_pre_xol() argument
920 if (auprobe->ops->pre_xol) { in arch_uprobe_pre_xol()
921 int err = auprobe->ops->pre_xol(auprobe, regs); in arch_uprobe_pre_xol()
963 int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in arch_uprobe_post_xol() argument
972 if (auprobe->ops->post_xol) { in arch_uprobe_post_xol()
973 err = auprobe->ops->post_xol(auprobe, regs); in arch_uprobe_post_xol()
1036 void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in arch_uprobe_abort_xol() argument
1040 if (auprobe->ops->abort) in arch_uprobe_abort_xol()
1041 auprobe->ops->abort(auprobe, regs); in arch_uprobe_abort_xol()
1050 static bool __skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) in __skip_sstep() argument
1052 if (auprobe->ops->emulate) in __skip_sstep()
1053 return auprobe->ops->emulate(auprobe, regs); in __skip_sstep()
1057 bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) in arch_uprobe_skip_sstep() argument
1059 bool ret = __skip_sstep(auprobe, regs); in arch_uprobe_skip_sstep()