diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-01-30 07:32:16 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:16 -0500 |
commit | 31f80e45ea26008939790b4363a4fdcff240e0d6 (patch) | |
tree | 672186c369053d06157f19b71292dc8de099543f /arch/x86/kernel/kprobes.c | |
parent | 9930927f36ac3e39ffa674dc23ef06f13c39cef7 (diff) |
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>
Diffstat (limited to 'arch/x86/kernel/kprobes.c')
-rw-r--r-- | arch/x86/kernel/kprobes.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index b1804e40235d..80bcb7635465 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c | |||
@@ -263,15 +263,16 @@ static int __kprobes is_IF_modifier(kprobe_opcode_t *insn) | |||
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | #ifdef CONFIG_X86_64 | ||
267 | /* | 266 | /* |
268 | * Adjust the displacement if the instruction uses the %rip-relative | 267 | * Adjust the displacement if the instruction uses the %rip-relative |
269 | * addressing mode. | 268 | * addressing mode. |
270 | * If it does, Return the address of the 32-bit displacement word. | 269 | * If it does, Return the address of the 32-bit displacement word. |
271 | * If not, return null. | 270 | * If not, return null. |
271 | * Only applicable to 64-bit x86. | ||
272 | */ | 272 | */ |
273 | static void __kprobes fix_riprel(struct kprobe *p) | 273 | static void __kprobes fix_riprel(struct kprobe *p) |
274 | { | 274 | { |
275 | #ifdef CONFIG_X86_64 | ||
275 | u8 *insn = p->ainsn.insn; | 276 | u8 *insn = p->ainsn.insn; |
276 | s64 disp; | 277 | s64 disp; |
277 | int need_modrm; | 278 | int need_modrm; |
@@ -335,15 +336,15 @@ static void __kprobes fix_riprel(struct kprobe *p) | |||
335 | *(s32 *)insn = (s32) disp; | 336 | *(s32 *)insn = (s32) disp; |
336 | } | 337 | } |
337 | } | 338 | } |
338 | } | ||
339 | #endif | 339 | #endif |
340 | } | ||
340 | 341 | ||
341 | static void __kprobes arch_copy_kprobe(struct kprobe *p) | 342 | static void __kprobes arch_copy_kprobe(struct kprobe *p) |
342 | { | 343 | { |
343 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 344 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
344 | #ifdef CONFIG_X86_64 | 345 | |
345 | fix_riprel(p); | 346 | fix_riprel(p); |
346 | #endif | 347 | |
347 | if (can_boost(p->addr)) | 348 | if (can_boost(p->addr)) |
348 | p->ainsn.boostable = 0; | 349 | p->ainsn.boostable = 0; |
349 | else | 350 | else |