#
# http://lkml.org/lkml/2008/3/27/226
#
# Subject: x86: fix prefetch workaround
# From: Ingo Molnar <mingo@elte.hu>
# Date: Thu Mar 27 15:58:28 CET 2008
#
# some early Athlon XP's and Opterons generate bogus faults on prefetch
# instructions. The workaround for this regressed over .24 - reinstate it.
# 
# Signed-off-by: Ingo Molnar <mingo@elte.hu>
# Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
#
# arch/x86/mm/fault.c |    3 ++-
# 1 file changed, 2 insertions(+), 1 deletion(-)
#
# Index: linux-x86.q/arch/x86/mm/fault.c
--- linux-x86.q.orig/arch/x86/mm/fault.c
+++ linux-x86.q/arch/x86/mm/fault.c
@@ -92,7 +92,8 @@ static int is_prefetch(struct pt_regs *r
 	unsigned char *max_instr;
 
 #ifdef CONFIG_X86_32
-	if (!(__supported_pte_mask & _PAGE_NX))
+	/* Catch an obscure case of prefetch inside an NX page: */
+	if ((__supported_pte_mask & _PAGE_NX) && (error_code & 16))
 		return 0;
 #endif

