The implementation of the clflush() inline function has been wrong
ever since it was introduced by oga@ 4 years ago.  Probably the cause
of small artifacts like the wigly cursor on machines like the x60.
But really disastrous for the modern kms graphics stack^H^H^H^H^Hpile
of poo that we have these days.  This diff seems to fix the icon
corruption I'm seeing in gnome and makes chromium a lot more stable on
the t400 with Intel GM45 Video.

ok?


Index: amd64/include/cpufunc.h
===================================================================
RCS file: /home/cvs/src/sys/arch/amd64/include/cpufunc.h,v
retrieving revision 1.9
diff -u -p -r1.9 cpufunc.h
--- amd64/include/cpufunc.h     5 Oct 2013 16:58:30 -0000       1.9
+++ amd64/include/cpufunc.h     6 Dec 2013 22:28:58 -0000
@@ -267,7 +267,7 @@ wbinvd(void)
 static __inline void
 clflush(u_int64_t addr)
 {
-       __asm __volatile("clflush %0" : "+m" (addr));
+       __asm __volatile("clflush %0" : "+m" (*(volatile char *)addr));
 }
 
 static __inline void
Index: i386/include/cpufunc.h
===================================================================
RCS file: /home/cvs/src/sys/arch/i386/include/cpufunc.h,v
retrieving revision 1.20
diff -u -p -r1.20 cpufunc.h
--- i386/include/cpufunc.h      9 Oct 2013 01:48:41 -0000       1.20
+++ i386/include/cpufunc.h      6 Dec 2013 22:28:32 -0000
@@ -224,7 +224,7 @@ wbinvd(void)
 static __inline void
 clflush(u_int32_t addr)
 {
-       __asm __volatile("clflush %0" : "+m" (addr));
+       __asm __volatile("clflush %0" : "+m" (*(volatile char *)addr));
 }
 
 static __inline void

Reply via email to