Merge from DRI CVS: Disable MTRRs on FreeBSD-stable to work around hangs with

SMP machines. and use i386 asm for atomic_cmpset_int on -stable.  This is in
preparation for MFCing the DRM.
This commit is contained in:
Eric Anholt 2003-04-26 06:59:38 +00:00
parent 155080d31e
commit d2c47a2151

View File

@ -49,7 +49,7 @@
#endif #endif
#ifdef __i386__ #ifdef __i386__
#define __REALLY_HAVE_MTRR (__HAVE_MTRR) #define __REALLY_HAVE_MTRR (__HAVE_MTRR) && (__FreeBSD_version >= 500000)
#else #else
#define __REALLY_HAVE_MTRR 0 #define __REALLY_HAVE_MTRR 0
#endif #endif
@ -249,16 +249,23 @@ typedef u_int8_t u8;
#if __FreeBSD_version < 500000 #if __FreeBSD_version < 500000
/* The extra atomic functions from 5.0 haven't been merged to 4.x */ /* The extra atomic functions from 5.0 haven't been merged to 4.x */
static __inline int static __inline int
atomic_cmpset_int(volatile int *dst, int old, int new) atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
{ {
int s = splhigh(); int res = exp;
if (*dst==old) {
*dst = new; __asm __volatile (
splx(s); " lock ; "
return 1; " cmpxchgl %1,%2 ; "
} " setz %%al ; "
splx(s); " movzbl %%al,%0 ; "
return 0; "1: "
"# atomic_cmpset_int"
: "+a" (res) /* 0 (result) */
: "r" (src), /* 1 */
"m" (*(dst)) /* 2 */
: "memory");
return (res);
} }
#endif #endif