Browse code

- playing with NOSMP

Andrei Pelinescu-Onciul authored on 22/02/2002 16:13:08
Showing 1 changed files
... ...
@@ -31,15 +31,26 @@ inline static int tsl(fl_lock_t* lock)
31 31
 	volatile int val;
32 32
 
33 33
 #ifdef __i386
34
-	
34
+
35
+#ifdef NOSMP
36
+	val=0;
37
+	asm volatile(
38
+		"  btsl $0, %1 \n\t"
39
+		" adcl $0, %0 \n\t"
40
+		: "=q" (val), "=m" (*lock) : "0"(val) : "memory"
41
+	);
42
+#else
35 43
 	val=1;
36 44
 	asm volatile( 
37 45
 		" xchg %b0, %1" : "=q" (val), "=m" (*lock) : "0" (val) : "memory"
38 46
 	);
47
+#endif /*NOSMP*/
39 48
 #elif defined __sparc
40 49
 	asm volatile(
41 50
 			"ldstub [%1], %0 \n\t"
51
+#ifndef NOSMP
42 52
 			"membar #StoreStore | #StoreLoad \n\t"
53
+#endif
43 54
 			: "=r"(val) : "r"(lock):"memory"
44 55
 	);
45 56
 #else
... ...
@@ -80,7 +91,9 @@ inline static void release_lock(fl_lock_t* lock)
80 80
 	); 
81 81
 #elif defined __sparc
82 82
 	asm volatile(
83
+#ifndef NOSMP
83 84
 			"membar #LoadStore | #StoreStore \n\t" /*is this really needed?*/
85
+#endif
84 86
 			"stb %%g0, [%0] \n\t"
85 87
 			: /*no output*/
86 88
 			: "r" (lock)