Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2006 23:26:29 GMT
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 104812 for review
Message-ID:  <200608222326.k7MNQTNe052053@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=104812

Change 104812 by gonzo@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) \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608222326.k7MNQTNe052053>