tree 16cc70b78452643771161a15092228a8d3bab7ad
parent e502cdd63de666832b3b65017bb607c22d2868de
author Andi Kleen <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:24:59 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:24:59 -0700

[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]>

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

Index: arch/x86_64/mm/fault.c
===================================================================
--- 3cc9360617b4b0d2e58f8af37afc97e457f8c048/arch/x86_64/mm/fault.c  
(mode:100644 sha1:d4676ca091449bd87c075956057716f57decd406)
+++ 16cc70b78452643771161a15092228a8d3bab7ad/arch/x86_64/mm/fault.c  
(mode:100644 sha1:e0330921676413d100b6a1f2cf2c6f579133e3d8)
@@ -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
===================================================================
--- 3cc9360617b4b0d2e58f8af37afc97e457f8c048/include/asm-x86_64/ptrace.h  
(mode:100644 sha1:c7865cfedc1fd7b44943ef30a423a27eb1b6f515)
+++ 16cc70b78452643771161a15092228a8d3bab7ad/include/asm-x86_64/ptrace.h  
(mode:100644 sha1:5bbc8d3141c86a1cbed6482854631b46a53caa73)
@@ -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