Browse code

- added PowerPC support, patch provided by Dinos Dorkofikis <kdor@intracom.gr>

Andrei Pelinescu-Onciul authored on 16/01/2003 16:46:01
Showing 2 changed files
... ...
@@ -289,6 +289,10 @@ ifeq ($(ARCH), arm)
289 289
 	DEFS+= -DFAST_LOCK
290 290
 endif
291 291
 
292
+ifeq ($(ARCH), ppc)
293
+	DEFS+= -DFAST_LOCK
294
+endif
295
+
292 296
 CFLAGS=
293 297
 # setting CFLAGS
294 298
 ifeq ($(mode), release)
... ...
@@ -89,6 +89,18 @@ inline static int tsl(fl_lock_t* lock)
89 89
 			: "r"(1), "r" (lock) : "memory"
90 90
 	);
91 91
 	
92
+#elif defined __CPU_ppc
93
+	asm volatile(
94
+			"1: lwarx  %0, 0, %2\n\t"
95
+			"   cmpwi  %0, 0\n\t"
96
+			"   bne    0f\n\t"
97
+			"   stwcx. %1, 0, %2\n\t"
98
+			"   bne-   1b\n\t"
99
+			"0:\n\t"
100
+			: "=r" (val)
101
+			: "r"(1), "b" (lock) :
102
+			"memory", "cc"
103
+        );
92 104
 #else
93 105
 #error "unknown arhitecture"
94 106
 #endif
... ...
@@ -142,6 +154,15 @@ inline static void release_lock(fl_lock_t* lock)
142 154
 		: "r"(0), "r"(lock)
143 155
 		: "memory"
144 156
 	);
157
+#elif defined __CPU_ppc
158
+	asm volatile(
159
+			"sync\n\t"
160
+			"stw %0, 0(%1)\n\t"
161
+			: /* no output */
162
+			: "r"(0), "b" (lock)
163
+			: "memory"
164
+        );
165
+	*lock = 0;
145 166
 #else
146 167
 #error "unknown arhitecture"
147 168
 #endif