Skip to content

Commit 6924b5b

Browse files
committed
Reduce diff to a83e261254. Merge few more ARM/Sparc fixes from the
d3da8467113.
1 parent 30329f6 commit 6924b5b

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

fastlock.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ inline static int tsl(volatile int* lock)
176176
" sync \n\t"
177177
#endif
178178
".set pop\n\t"
179-
: "=&r" (tmp), "=&r" (val), "=m" (*lock) : "m" (*lock) : "memory"
179+
: "=&r" (tmp), "=&r" (val), "=m" (*lock)
180+
: "m" (*lock)
181+
: "memory"
180182
);
181183
#elif defined __CPU_alpha
182184
long tmp;
@@ -192,7 +194,9 @@ inline static int tsl(volatile int* lock)
192194
" beq %2, 1b \n\t"
193195
" mb \n\t"
194196
"2: \n\t"
195-
:"=&r" (val), "=m"(*lock), "=&r"(tmp) :"m"(*lock) : "memory"
197+
:"=&r" (val), "=m"(*lock), "=&r"(tmp)
198+
:"m"(*lock)
199+
: "memory"
196200
);
197201
#else
198202
#error "unknown architecture"
@@ -280,10 +284,8 @@ inline static void release_lock(fl_lock_t* lock_struct)
280284
#ifndef NOSMP
281285
"membar #LoadStore | #StoreStore \n\t" /*is this really needed?*/
282286
#endif
283-
"stb %%g0, [%0] \n\t"
284-
: /*no output*/
285-
: "r" (lock)
286-
: "memory"
287+
"stb %%g0, [%1] \n\t"
288+
: "=m"(*lock) : "r" (lock) : "memory"
287289
);
288290
#elif defined(__CPU_arm) || defined(__CPU_arm6) || defined(__CPU_arm7)
289291
asm volatile(
@@ -294,10 +296,8 @@ inline static void release_lock(fl_lock_t* lock_struct)
294296
"mcr p15, #0, r1, c7, c10, #5\n\t"
295297
#endif
296298
#endif
297-
" str %0, [%1] \n\r"
298-
: /*no outputs*/
299-
: "r"(0), "r"(lock)
300-
: "memory"
299+
" str %1, [%2] \n\r"
300+
: "=m"(*lock) : "r"(0), "r"(lock) : "memory"
301301
);
302302
#elif defined(__CPU_ppc) || defined(__CPU_ppc64)
303303
asm volatile(
@@ -324,7 +324,9 @@ inline static void release_lock(fl_lock_t* lock_struct)
324324
);
325325
#elif defined __CPU_alpha
326326
asm volatile(
327+
#ifndef NOSMP
327328
" mb \n\t"
329+
#endif
328330
" stl $31, %0 \n\t"
329331
: "=m"(*lock) :/* no input*/ : "memory" /* because of the mb */
330332
);

0 commit comments

Comments
 (0)