Re: [PATCH v9 3.2 1/9] uprobes: Install and remove breakpoints.

From: Masami Hiramatsu
Date: Thu Jan 26 2012 - 08:45:48 EST


(2012/01/10 20:48), Srikar Dronamraju wrote:
> +static void handle_riprel_insn(struct mm_struct *mm, struct uprobe *uprobe,
> + struct insn *insn)
> +{
> + u8 *cursor;
> + u8 reg;
> +
> + if (mm->context.ia32_compat)
> + return;
> +
> + uprobe->arch_info.rip_rela_target_address = 0x0;
> + if (!insn_rip_relative(insn))
> + return;
> +
> + /*
> + * Point cursor at the modrm byte. The next 4 bytes are the
> + * displacement. Beyond the displacement, for some instructions,
> + * is the immediate operand.
> + */
> + cursor = uprobe->insn + insn->prefixes.nbytes
> + + insn->rex_prefix.nbytes + insn->opcode.nbytes;

FYI, insn.h already provide a macro for this purpose.
You can write this as below;

cursor = uprobe->insn + insn_offset_modrm(insn);

Thank you,

--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@xxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/