lkml.org 
[lkml]   [2012]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v9 3.2 1/9] uprobes: Install and remove breakpoints.
(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@hitachi.com


\
 
 \ /
  Last update: 2012-01-26 14:47    [W:0.209 / U:1.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site