PERFORCE change 104812 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Tue Aug 22 23:26:31 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=104812
Change 104812 by gonzo at gonzo_hideout on 2006/08/22 23:26:19
o Atomic swap for libpthread.
Affected files ...
.. //depot/projects/mips2/src/lib/libpthread/arch/mips/include/atomic_ops.h#2 edit
Differences ...
==== //depot/projects/mips2/src/lib/libpthread/arch/mips/include/atomic_ops.h#2 (text+ko) ====
@@ -41,7 +41,18 @@
static inline void
atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
{
- *res = __swp(val, dst);
+ u_int temp;
+
+ __asm __volatile (
+ "1:\n\t"
+ "ll %[temp], %[dst]\n\t"
+ "sw %[temp], %[res]\n\t"
+ "sc %[val], %[dst]\n\t"
+ "beqz %[temp], 1b\n\t"
+ : [temp] "=&r"(temp), [res] "+m"(*res)
+ : [val] "r"(val), [dst] "m"(*dst)
+ : "memory"
+ );
}
#define atomic_swap_ptr(d, v, r) \
More information about the p4-projects
mailing list