* [PATCH] x86: Use helper in kprobes{32|64}.c
@ 2007-12-15 0:55 Harvey Harrison
2007-12-15 7:36 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Harvey Harrison @ 2007-12-15 0:55 UTC (permalink / raw)
To: Ingo Molnar; +Cc: H. Peter Anvin, LKML, Thomas Gleixner
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
arch/x86/kernel/kprobes_32.c | 18 +++++++++++-------
arch/x86/kernel/kprobes_64.c | 14 ++++++++++++--
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
index 2a8acd6..878b0c4 100644
--- a/arch/x86/kernel/kprobes_32.c
+++ b/arch/x86/kernel/kprobes_32.c
@@ -239,13 +239,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
if (!p->ainsn.insn)
return -ENOMEM;
- memcpy(p->ainsn.insn, p->addr, (MAX_INSN_SIZE + 1) * sizeof(kprobe_opcode_t));
- p->opcode = *p->addr;
- if (can_boost(p->addr)) {
- p->ainsn.boostable = 0;
- } else {
- p->ainsn.boostable = -1;
- }
+ arch_copy_kprobe(p);
return 0;
}
@@ -303,6 +297,15 @@ static s32 __kprobes *is_riprel(u8 *insn)
static void __kprobes arch_copy_kprobe(struct kprobe *p)
{
+#ifdef CONFIG_X86_32
+ memcpy(p->ainsn.insn, p->addr, (MAX_INSN_SIZE + 1) * sizeof(kprobe_opcode_t));
+ p->opcode = *p->addr;
+ if (can_boost(p->addr)) {
+ p->ainsn.boostable = 0;
+ } else {
+ p->ainsn.boostable = -1;
+ }
+#else
s32 *ripdisp;
memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE);
ripdisp = is_riprel(p->ainsn.insn);
@@ -325,6 +328,7 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
*ripdisp = disp;
}
p->opcode = *p->addr;
+#endif
}
void __kprobes arch_arm_kprobe(struct kprobe *p)
diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index 5f02e75..b437f7a 100644
--- a/arch/x86/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
@@ -245,9 +245,9 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
{
/* insn: must be on special executable page on x86_32|64. */
p->ainsn.insn = get_insn_slot();
- if (!p->ainsn.insn) {
+ if (!p->ainsn.insn)
return -ENOMEM;
- }
+
arch_copy_kprobe(p);
return 0;
}
@@ -306,6 +306,15 @@ static s32 __kprobes *is_riprel(u8 *insn)
static void __kprobes arch_copy_kprobe(struct kprobe *p)
{
+#ifdef CONFIG_X86_32
+ memcpy(p->ainsn.insn, p->addr, (MAX_INSN_SIZE + 1) * sizeof(kprobe_opcode_t));
+ p->opcode = *p->addr;
+ if (can_boost(p->addr)) {
+ p->ainsn.boostable = 0;
+ } else {
+ p->ainsn.boostable = -1;
+ }
+#else
s32 *ripdisp;
memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE);
ripdisp = is_riprel(p->ainsn.insn);
@@ -328,6 +337,7 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
*ripdisp = disp;
}
p->opcode = *p->addr;
+#endif
}
void __kprobes arch_arm_kprobe(struct kprobe *p)
--
1.5.4.rc0.1083.gf568
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: Use helper in kprobes{32|64}.c
2007-12-15 0:55 [PATCH] x86: Use helper in kprobes{32|64}.c Harvey Harrison
@ 2007-12-15 7:36 ` Ingo Molnar
2007-12-15 7:40 ` Harvey Harrison
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2007-12-15 7:36 UTC (permalink / raw)
To: Harvey Harrison; +Cc: H. Peter Anvin, LKML, Thomas Gleixner
* Harvey Harrison <harvey.harrison@gmail.com> wrote:
> x86: Use helper in kprobes{32|64}.c
thanks, i've applied your kprobes pre-unification patches to x86.git.
While we are at it, it might be nice to reduce the numbers of checkpatch
warnings:
$ scripts/checkpatch.pl --file arch/x86/kernel/kprobes*.c | grep total
total: 10 errors, 9 warnings, 959 lines checked
total: 10 errors, 8 warnings, 923 lines checked
to 0/0 ? :-) (but that can happen after the unification too)
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: Use helper in kprobes{32|64}.c
2007-12-15 7:36 ` Ingo Molnar
@ 2007-12-15 7:40 ` Harvey Harrison
0 siblings, 0 replies; 3+ messages in thread
From: Harvey Harrison @ 2007-12-15 7:40 UTC (permalink / raw)
To: Ingo Molnar; +Cc: H. Peter Anvin, LKML, Thomas Gleixner
On Sat, 2007-12-15 at 08:36 +0100, Ingo Molnar wrote:
> * Harvey Harrison <harvey.harrison@gmail.com> wrote:
>
> > x86: Use helper in kprobes{32|64}.c
>
> thanks, i've applied your kprobes pre-unification patches to x86.git.
>
> While we are at it, it might be nice to reduce the numbers of checkpatch
> warnings:
>
> $ scripts/checkpatch.pl --file arch/x86/kernel/kprobes*.c | grep total
> total: 10 errors, 9 warnings, 959 lines checked
> total: 10 errors, 8 warnings, 923 lines checked
>
> to 0/0 ? :-) (but that can happen after the unification too)
>
That was my plan...you'll notice I already cut ~200 from each file
though, so the lion's share is done. I'll have the final few in the
series shortly.
Harvey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-12-15 7:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-15 0:55 [PATCH] x86: Use helper in kprobes{32|64}.c Harvey Harrison
2007-12-15 7:36 ` Ingo Molnar
2007-12-15 7:40 ` Harvey Harrison
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox