tree 7a0a0711242531e3b8f1b3a8d01af54645c5387f
parent 34edefa00e0bb20def2e777caf619577a43e18a1
author Andi Kleen <[EMAIL PROTECTED]> Tue Apr 12 08:25:30 2005
committer Linus Torvalds <[EMAIL PROTECTED]> Tue Apr 12 08:25:30 2005

[PATCH] x86_64: Use a common function to find code segment bases

To avoid some code duplication.

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

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

Index: arch/x86_64/mm/fault.c
===================================================================
--- 70d93b073a1272cbe84f619cf6ea22dfe8ded579/arch/x86_64/mm/fault.c  
(mode:100644 sha1:81caa0017215df09a35c90a0e53d0f1a39400ddd)
+++ 7a0a0711242531e3b8f1b3a8d01af54645c5387f/arch/x86_64/mm/fault.c  
(mode:100644 sha1:6055f39f15c9c1828abb40b2e63790fc08682493)
@@ -62,21 +62,19 @@
 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) { 
Index: include/asm-x86_64/ptrace.h
===================================================================
--- 70d93b073a1272cbe84f619cf6ea22dfe8ded579/include/asm-x86_64/ptrace.h  
(mode:100644 sha1:a3ac1073dbff76cceae8f3d29c99c7654bbbac84)
+++ 7a0a0711242531e3b8f1b3a8d01af54645c5387f/include/asm-x86_64/ptrace.h  
(mode:100644 sha1:2bfd86204af54a7cf040fcd38505dec2fd1a8e89)
@@ -86,6 +86,11 @@
 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 bk-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