Lines Matching refs:auprobe
289 static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool x86_64) in uprobe_init_insn() argument
293 insn_init(insn, auprobe->insn, sizeof(auprobe->insn), x86_64); in uprobe_init_insn()
347 static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn) in riprel_analyze() argument
362 cursor = auprobe->insn + insn_offset_rex_prefix(insn); in riprel_analyze()
381 cursor = auprobe->insn + insn_offset_vex_prefix(insn) + 1; in riprel_analyze()
445 auprobe->defparam.fixups |= UPROBE_FIX_RIP_SI; in riprel_analyze()
448 auprobe->defparam.fixups |= UPROBE_FIX_RIP_DI; in riprel_analyze()
452 auprobe->defparam.fixups |= UPROBE_FIX_RIP_BX; in riprel_analyze()
459 cursor = auprobe->insn + insn_offset_modrm(insn); in riprel_analyze()
469 scratch_reg(struct arch_uprobe *auprobe, struct pt_regs *regs) in scratch_reg() argument
471 if (auprobe->defparam.fixups & UPROBE_FIX_RIP_SI) in scratch_reg()
473 if (auprobe->defparam.fixups & UPROBE_FIX_RIP_DI) in scratch_reg()
482 static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in riprel_pre_xol() argument
484 if (auprobe->defparam.fixups & UPROBE_FIX_RIP_MASK) { in riprel_pre_xol()
486 unsigned long *sr = scratch_reg(auprobe, regs); in riprel_pre_xol()
489 *sr = utask->vaddr + auprobe->defparam.ilen; in riprel_pre_xol()
493 static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in riprel_post_xol() argument
495 if (auprobe->defparam.fixups & UPROBE_FIX_RIP_MASK) { in riprel_post_xol()
497 unsigned long *sr = scratch_reg(auprobe, regs); in riprel_post_xol()
506 static void riprel_analyze(struct arch_uprobe *auprobe, struct insn *insn) in riprel_analyze() argument
509 static void riprel_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in riprel_pre_xol() argument
512 static void riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in riprel_post_xol() argument
529 static int default_pre_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in default_pre_xol_op() argument
531 riprel_pre_xol(auprobe, regs); in default_pre_xol_op()
563 static int default_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in default_post_xol_op() argument
567 riprel_post_xol(auprobe, regs); in default_post_xol_op()
568 if (auprobe->defparam.fixups & UPROBE_FIX_IP) { in default_post_xol_op()
571 } else if (auprobe->defparam.fixups & UPROBE_FIX_CALL) { in default_post_xol_op()
573 if (emulate_push_stack(regs, utask->vaddr + auprobe->defparam.ilen)) in default_post_xol_op()
577 if (auprobe->defparam.fixups & UPROBE_FIX_SETF) in default_post_xol_op()
583 static void default_abort_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in default_abort_op() argument
585 riprel_post_xol(auprobe, regs); in default_abort_op()
594 static bool branch_is_call(struct arch_uprobe *auprobe) in branch_is_call() argument
596 return auprobe->branch.opc1 == 0xe8; in branch_is_call()
628 static bool check_jmp_cond(struct arch_uprobe *auprobe, struct pt_regs *regs) in check_jmp_cond() argument
632 switch (auprobe->branch.opc1) { in check_jmp_cond()
647 static bool branch_emulate_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in branch_emulate_op() argument
649 unsigned long new_ip = regs->ip += auprobe->branch.ilen; in branch_emulate_op()
650 unsigned long offs = (long)auprobe->branch.offs; in branch_emulate_op()
652 if (branch_is_call(auprobe)) { in branch_emulate_op()
664 } else if (!check_jmp_cond(auprobe, regs)) { in branch_emulate_op()
672 static bool push_emulate_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in push_emulate_op() argument
674 unsigned long *src_ptr = (void *)regs + auprobe->push.reg_offset; in push_emulate_op()
678 regs->ip += auprobe->push.ilen; in push_emulate_op()
682 static int branch_post_xol_op(struct arch_uprobe *auprobe, struct pt_regs *regs) in branch_post_xol_op() argument
684 BUG_ON(!branch_is_call(auprobe)); in branch_post_xol_op()
695 static void branch_clear_offset(struct arch_uprobe *auprobe, struct insn *insn) in branch_clear_offset() argument
711 memset(auprobe->insn + insn_offset_immediate(insn), in branch_clear_offset()
725 static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) in branch_setup_xol_ops() argument
737 branch_clear_offset(auprobe, insn); in branch_setup_xol_ops()
763 auprobe->branch.opc1 = opc1; in branch_setup_xol_ops()
764 auprobe->branch.ilen = insn->length; in branch_setup_xol_ops()
765 auprobe->branch.offs = insn->immediate.value; in branch_setup_xol_ops()
767 auprobe->ops = &branch_xol_ops; in branch_setup_xol_ops()
772 static int push_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) in push_setup_xol_ops() argument
846 auprobe->push.reg_offset = reg_offset; in push_setup_xol_ops()
847 auprobe->push.ilen = insn->length; in push_setup_xol_ops()
848 auprobe->ops = &push_xol_ops; in push_setup_xol_ops()
859 int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long addr) in arch_uprobe_analyze_insn() argument
865 ret = uprobe_init_insn(auprobe, &insn, is_64bit_mm(mm)); in arch_uprobe_analyze_insn()
869 ret = branch_setup_xol_ops(auprobe, &insn); in arch_uprobe_analyze_insn()
873 ret = push_setup_xol_ops(auprobe, &insn); in arch_uprobe_analyze_insn()
883 auprobe->defparam.fixups |= UPROBE_FIX_SETF; in arch_uprobe_analyze_insn()
906 riprel_analyze(auprobe, &insn); in arch_uprobe_analyze_insn()
909 auprobe->defparam.ilen = insn.length; in arch_uprobe_analyze_insn()
910 auprobe->defparam.fixups |= fix_ip_or_call; in arch_uprobe_analyze_insn()
912 auprobe->ops = &default_xol_ops; in arch_uprobe_analyze_insn()
921 int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in arch_uprobe_pre_xol() argument
925 if (auprobe->ops->pre_xol) { in arch_uprobe_pre_xol()
926 int err = auprobe->ops->pre_xol(auprobe, regs); in arch_uprobe_pre_xol()
968 int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in arch_uprobe_post_xol() argument
977 if (auprobe->ops->post_xol) { in arch_uprobe_post_xol()
978 err = auprobe->ops->post_xol(auprobe, regs); in arch_uprobe_post_xol()
1039 void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) in arch_uprobe_abort_xol() argument
1043 if (auprobe->ops->abort) in arch_uprobe_abort_xol()
1044 auprobe->ops->abort(auprobe, regs); in arch_uprobe_abort_xol()
1053 static bool __skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) in __skip_sstep() argument
1055 if (auprobe->ops->emulate) in __skip_sstep()
1056 return auprobe->ops->emulate(auprobe, regs); in __skip_sstep()
1060 bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) in arch_uprobe_skip_sstep() argument
1062 bool ret = __skip_sstep(auprobe, regs); in arch_uprobe_skip_sstep()