summaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2005-04-17 00:24:59 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-17 00:24:59 +0200
commitf1290ec93e5da4a748ca4758a00b580283e06596 (patch)
tree16cc70b78452643771161a15092228a8d3bab7ad /arch/x86_64
parent[PATCH] x86_64: Handle programs that set TF in user space using popf while si... (diff)
downloadlinux-f1290ec93e5da4a748ca4758a00b580283e06596.tar.xz
linux-f1290ec93e5da4a748ca4758a00b580283e06596.zip
[PATCH] x86_64: Use a common function to find code segment bases
To avoid some code duplication. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/mm/fault.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index d4676ca09144..e03309216764 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -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) {