diff options
author | anholt <anholt@FreeBSD.org> | 2003-04-26 06:59:38 +0000 |
---|---|---|
committer | anholt <anholt@FreeBSD.org> | 2003-04-26 06:59:38 +0000 |
commit | e5217dfcdd953643aa474de1c94c694a3f208e7c (patch) | |
tree | c13eb2d849e40be07178d4571eddad9d394fc71e | |
parent | 58e751571843e92c071073742687f8f97cd563fd (diff) | |
download | FreeBSD-src-e5217dfcdd953643aa474de1c94c694a3f208e7c.zip FreeBSD-src-e5217dfcdd953643aa474de1c94c694a3f208e7c.tar.gz |
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.
-rw-r--r-- | sys/dev/drm/drm_os_freebsd.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/sys/dev/drm/drm_os_freebsd.h b/sys/dev/drm/drm_os_freebsd.h index 1148153..2a95221 100644 --- a/sys/dev/drm/drm_os_freebsd.h +++ b/sys/dev/drm/drm_os_freebsd.h @@ -49,7 +49,7 @@ #endif #ifdef __i386__ -#define __REALLY_HAVE_MTRR (__HAVE_MTRR) +#define __REALLY_HAVE_MTRR (__HAVE_MTRR) && (__FreeBSD_version >= 500000) #else #define __REALLY_HAVE_MTRR 0 #endif @@ -249,16 +249,23 @@ typedef u_int8_t u8; #if __FreeBSD_version < 500000 /* The extra atomic functions from 5.0 haven't been merged to 4.x */ 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(); - if (*dst==old) { - *dst = new; - splx(s); - return 1; - } - splx(s); - return 0; + int res = exp; + + __asm __volatile ( + " lock ; " + " cmpxchgl %1,%2 ; " + " setz %%al ; " + " movzbl %%al,%0 ; " + "1: " + "# atomic_cmpset_int" + : "+a" (res) /* 0 (result) */ + : "r" (src), /* 1 */ + "m" (*(dst)) /* 2 */ + : "memory"); + + return (res); } #endif |