Replace the C atomic_cmpset_int compatibility function for -stable with the
real i386 atomic_cmpset_int from -current. FreeBSD-stable won't ever have DRM support for non-i386.main
parent
acb5d6b273
commit
e60eb69bc0
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue