x86: kprobes remove fix_riprel #ifdef
Move #ifdef around function definiton into the function and unconditionally return on X86_32. Saves an ifdef from the one callsite. [ mingo@elte.hu: minor cleanup. ] Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
9930927f36
commit
31f80e45ea
1 changed files with 5 additions and 4 deletions
|
@ -263,15 +263,16 @@ static int __kprobes is_IF_modifier(kprobe_opcode_t *insn)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_X86_64
|
|
||||||
/*
|
/*
|
||||||
* Adjust the displacement if the instruction uses the %rip-relative
|
* Adjust the displacement if the instruction uses the %rip-relative
|
||||||
* addressing mode.
|
* addressing mode.
|
||||||
* If it does, Return the address of the 32-bit displacement word.
|
* If it does, Return the address of the 32-bit displacement word.
|
||||||
* If not, return null.
|
* If not, return null.
|
||||||
|
* Only applicable to 64-bit x86.
|
||||||
*/
|
*/
|
||||||
static void __kprobes fix_riprel(struct kprobe *p)
|
static void __kprobes fix_riprel(struct kprobe *p)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
u8 *insn = p->ainsn.insn;
|
u8 *insn = p->ainsn.insn;
|
||||||
s64 disp;
|
s64 disp;
|
||||||
int need_modrm;
|
int need_modrm;
|
||||||
|
@ -335,15 +336,15 @@ static void __kprobes fix_riprel(struct kprobe *p)
|
||||||
*(s32 *)insn = (s32) disp;
|
*(s32 *)insn = (s32) disp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void __kprobes arch_copy_kprobe(struct kprobe *p)
|
static void __kprobes arch_copy_kprobe(struct kprobe *p)
|
||||||
{
|
{
|
||||||
memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
|
memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
|
||||||
#ifdef CONFIG_X86_64
|
|
||||||
fix_riprel(p);
|
fix_riprel(p);
|
||||||
#endif
|
|
||||||
if (can_boost(p->addr))
|
if (can_boost(p->addr))
|
||||||
p->ainsn.boostable = 0;
|
p->ainsn.boostable = 0;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue