Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=40102d4a41312ad4134c0b802ad074445ce8b17b
Commit:     40102d4a41312ad4134c0b802ad074445ce8b17b
Parent:     ddc66df876fd33d3956f3c3acc1ae334b16eedee
Author:     Harvey Harrison <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 30 13:32:02 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 13:32:02 2008 +0100

    x86: add reenter_kprobe helper
    
    [ [EMAIL PROTECTED]: updated it to latest x86.git ]
    
    Factor common X86_32, X86_64 kprobe reenter logic from deeply
    indented section to helper function.
    
    Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
    Cc: Ananth N Mavinakayanahalli <[EMAIL PROTECTED]>
    Cc: Jim Keniston <[EMAIL PROTECTED]>
---
 arch/x86/kernel/kprobes.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index f0f2b98..7dd9186 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -427,6 +427,20 @@ void __kprobes arch_prepare_kretprobe(struct 
kretprobe_instance *ri,
        /* Replace the return addr with trampoline addr */
        *sara = (unsigned long) &kretprobe_trampoline;
 }
+/*
+ * We have reentered the kprobe_handler(), since another probe was hit while
+ * within the handler. We save the original kprobes variables and just single
+ * step on the instruction of the new probe without calling any user handlers.
+ */
+static void __kprobes reenter_kprobe(struct kprobe *p, struct pt_regs *regs,
+                                    struct kprobe_ctlblk *kcb)
+{
+       save_previous_kprobe(kcb);
+       set_current_kprobe(p, regs, kcb);
+       kprobes_inc_nmissed_count(p);
+       prepare_singlestep(p, regs);
+       kcb->kprobe_status = KPROBE_REENTER;
+}
 
 /*
  * Interrupts are disabled on entry as trap3 is an interrupt gate and they
@@ -471,17 +485,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
                                goto no_kprobe;
 #endif
                        }
-                       /* We have reentered the kprobe_handler(), since
-                        * another probe was hit while within the handler.
-                        * We here save the original kprobes variables and
-                        * just single step on the instruction of the new probe
-                        * without calling any user handlers.
-                        */
-                       save_previous_kprobe(kcb);
-                       set_current_kprobe(p, regs, kcb);
-                       kprobes_inc_nmissed_count(p);
-                       prepare_singlestep(p, regs);
-                       kcb->kprobe_status = KPROBE_REENTER;
+                       reenter_kprobe(p, regs, kcb);
                        return 1;
                } else {
                        if (*addr != BREAKPOINT_INSTRUCTION) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to