]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2713. [bug] powerpc: atomic operations missing asm("ics") /
authorMark Andrews <marka@isc.org>
Wed, 14 Oct 2009 04:04:48 +0000 (04:04 +0000)
committerMark Andrews <marka@isc.org>
Wed, 14 Oct 2009 04:04:48 +0000 (04:04 +0000)
                        __isync() calls.

CHANGES
lib/isc/powerpc/include/isc/atomic.h

diff --git a/CHANGES b/CHANGES
index be9d53e865ddc7ea31eac008c85abd49d45c584d..9e78f90f53fca74c3db417d03ca4bf0fda324068 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2713.  [bug]           powerpc: atomic operations missing asm("ics") /
+                       __isync() calls.
+
 2705.  [bug]           Reconcile the XML stats version number with a later
                         BIND9 release, by adding a "name" attribute to
                         "cache" elements and increasing the version number
index 765cb6d72a8ccbcee04ff090e42de2e0be1a9d80..7fa034e4137754ef064a50666ee26ee4546e1541 100644 (file)
@@ -14,7 +14,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: atomic.h,v 1.6 2007/06/18 23:47:47 tbox Exp $ */
+/* $Id: atomic.h,v 1.6.128.1 2009/10/14 04:04:48 marka Exp $ */
 
 #ifndef ISC_ATOMIC_H
 #define ISC_ATOMIC_H 1
 
 #include <sys/atomic_op.h>
 
-#define isc_atomic_xadd(p, v) fetch_and_add(p, v)
 #define isc_atomic_store(p, v) _clear_lock(p, v)
 
+#ifdef __GNUC__
+static inline isc_int32_t
+#else
+static isc_int32_t
+#endif
+isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) {
+       int ret;
+
+#ifdef __GNUC__
+        asm("ics");
+#else
+         __isync();
+#endif
+
+       ret = fetch_and_add((atomic_p)p, (int)val);
+
+#ifdef __GNUC__
+        asm("ics");
+#else
+         __isync();
+#endif
+
+        return (ret);
+}
+
 #ifdef __GNUC__
 static inline int
 #else
@@ -63,7 +87,14 @@ isc_atomic_cmpxchg(atomic_p p, int old, int new) {
          __isync();
 #endif
         if (compare_and_swap(p, &orig, new))
-               return (old);
+               orig = old;
+
+#ifdef __GNUC__
+        asm("ics");
+#else
+         __isync();
+#endif
+
         return (orig);
 }