From: "Andi Kleen" <[EMAIL PROTECTED]>

To avoid some code duplication.

Signed-off-by: Andi Kleen <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 25-akpm/arch/x86_64/mm/fault.c      |   12 +++++-------
 25-akpm/include/asm-x86_64/ptrace.h |    5 +++++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff -puN 
arch/x86_64/mm/fault.c~x86_64-use-a-common-function-to-find-code-segment-bases 
arch/x86_64/mm/fault.c
--- 
25/arch/x86_64/mm/fault.c~x86_64-use-a-common-function-to-find-code-segment-bases
   2005-04-12 03:21:21.786824800 -0700
+++ 25-akpm/arch/x86_64/mm/fault.c      2005-04-12 03:21:21.790824192 -0700
@@ -62,21 +62,19 @@ void bust_spinlocks(int yes)
 static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr,
                                unsigned long error_code)
 { 
-       unsigned char *instr = (unsigned char *)(regs->rip);
+       unsigned char *instr;
        int scan_more = 1;
        int prefetch = 0; 
-       unsigned char *max_instr = instr + 15;
+       unsigned char *max_instr;
 
        /* If it was a exec fault ignore */
        if (error_code & (1<<4))
                return 0;
        
-       /* Code segments in LDT could have a non zero base. Don't check
-          when that's possible */
-       if (regs->cs & (1<<2))
-               return 0;
+       instr = (unsigned char *)convert_rip_to_linear(current, regs);
+       max_instr = instr + 15;
 
-       if ((regs->cs & 3) != 0 && regs->rip >= TASK_SIZE)
+       if ((regs->cs & 3) != 0 && instr >= (unsigned char *)TASK_SIZE)
                return 0;
 
        while (scan_more && instr < max_instr) { 
diff -puN 
include/asm-x86_64/ptrace.h~x86_64-use-a-common-function-to-find-code-segment-bases
 include/asm-x86_64/ptrace.h
--- 
25/include/asm-x86_64/ptrace.h~x86_64-use-a-common-function-to-find-code-segment-bases
      2005-04-12 03:21:21.787824648 -0700
+++ 25-akpm/include/asm-x86_64/ptrace.h 2005-04-12 03:21:21.790824192 -0700
@@ -86,6 +86,11 @@ struct pt_regs {
 extern unsigned long profile_pc(struct pt_regs *regs);
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
+struct task_struct;
+
+extern unsigned long
+convert_rip_to_linear(struct task_struct *child, struct pt_regs *regs);
+
 enum {
         EF_CF   = 0x00000001,
         EF_PF   = 0x00000004,
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to