# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/06/14 16:05:28-03:00 marcelo@logos.cnet 
#     Alexander Nyberg/Andi/Sergey: Fix x86 "clear_cpu()" macro.
#   
#   Linus's 2.6 changelog:
#                                                                                         
#   Fix x86 "clear_cpu()" macro.
#                                                                                         
#   We need to clear all exceptions before synchronizing
#   with the FPU, since we aren't ready to handle a FP
#   exception here and we're getting rid of all FP state.
#                                                                                         
#   Special thanks to Alexander Nyberg for reports and
#   testing. Alternate patches by Sergey Vlasov and Andi
#   Kleen, who both worked on this.
#                                                                                         
#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
# 
# include/asm-i386/i387.h
#   2004/06/14 16:04:08-03:00 marcelo@logos.cnet +1 -1
#   Alexander Nyberg/Andi/Sergey: Fix x86 "clear_cpu()" macro.
# 
diff -Nru a/include/asm-i386/i387.h b/include/asm-i386/i387.h
--- a/include/asm-i386/i387.h	2004-06-25 01:34:56 -07:00
+++ b/include/asm-i386/i387.h	2004-06-25 01:34:56 -07:00
@@ -34,7 +34,7 @@
 
 #define clear_fpu( tsk ) do { \
 	if ( tsk->flags & PF_USEDFPU ) { \
-		asm volatile("fwait"); \
+		asm volatile("fnclex ; fwait"); \
 		tsk->flags &= ~PF_USEDFPU; \
 		stts(); \
 	} \
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/06/14 21:21:45-03:00 ak@suse.de 
#   [PATCH] Fix FPU delayed exceptions on x86-64 too
#   
#   This fixes the recent FPU delayed exception kernel hang on x86-64 too.
# 
# include/asm-x86_64/i387.h
#   2004/06/14 14:05:40-03:00 ak@suse.de +1 -1
#   Fix FPU delayed exceptions on x86-64 too
# 
diff -Nru a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
--- a/include/asm-x86_64/i387.h	2004-06-25 01:35:13 -07:00
+++ b/include/asm-x86_64/i387.h	2004-06-25 01:35:13 -07:00
@@ -34,7 +34,7 @@
 
 #define clear_fpu( tsk ) do { \
 	if ( tsk->flags & PF_USEDFPU ) { \
-		asm volatile("fwait"); \
+		asm volatile("fnclex ; fwait"); \
 		tsk->flags &= ~PF_USEDFPU; \
 		stts(); \
 	} \
