patch-2.4.0-test1 linux/include/asm-i386/spinlock.h

Next file: linux/include/asm-i386/user.h
Previous file: linux/include/asm-i386/siginfo.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre9/linux/include/asm-i386/spinlock.h linux/include/asm-i386/spinlock.h
@@ -64,16 +64,13 @@
 #define spin_unlock_string \
 	"movb $1,%0"
 
-/*
- * Won't work on i386-SMP. Does anybody care?
- */
 static inline int spin_trylock(spinlock_t *lock)
 {
 	char oldval;
 	__asm__ __volatile__(
-		"lock ; cmpxchg %b2,%1"
-		:"=a" (oldval), "=m" (__dummy_lock(lock))
-		:"q" (0), "0" (1));
+		"xchgb %b0,%1"
+		:"=q" (oldval), "=m" (__dummy_lock(lock))
+		:"0" (0));
 	return oldval > 0;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)