Index: trunk/include/iprt/asm.h
===================================================================
--- trunk/include/iprt/asm.h	(revision 87171)
+++ trunk/include/iprt/asm.h	(revision 87172)
@@ -303,14 +303,15 @@
     uint32_t uOld;
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicXchgU8_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxrb    %w0, [%3]\n\t"
                          "stlxrb    %w1, %w2, [%3]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicXchgU8_%=\n\t"
 #  else
                          "ldrexb    %0, [%3]\n\t"      /* ARMv6+ */
                          "strexb    %1, %2, [%3]\n\t"
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicXchgU8_%=\n\t"
 #  endif
                          : "=&r" (uOld),
@@ -399,14 +400,15 @@
     uint32_t uOld;
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicXchgU16_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxrh    %w0, [%3]\n\t"
                          "stlxrh    %w1, %w2, [%3]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicXchgU16_%=\n\t"
 #  else
                          "ldrexh    %0, [%3]\n\t"      /* ARMv6+ */
                          "strexh    %1, %2, [%3]\n\t"
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicXchgU16_%=\n\t"
 #  endif
                          : "=&r" (uOld),
@@ -484,14 +486,15 @@
     uint32_t uOld;
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicXchgU32_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %w0, [%3]\n\t"
                          "stlxr     %w1, %w2, [%3]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicXchgU32_%=\n\t"
 #  else
                          "ldrex     %0, [%3]\n\t"      /* ARMv6+ */
                          "strex     %1, %2, [%3]\n\t"
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicXchgU32_%=\n\t"
 #  endif
                          : "=&r" (uOld),
@@ -603,14 +606,15 @@
 # elif defined(RT_ARCH_ARM32) || defined(RT_ARCH_ARM64)
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicXchgU64_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %0, [%3]\n\t"
                          "stlxr     %w1, %2, [%3]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicXchgU64_%=\n\t"
 #  else
                          "ldrexd    %H0, [%3]\n\t"      /* ARMv6+ */
                          "strexd    %1, %H2, [%3]\n\t"
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicXchgU64_%=\n\t"
 #  endif
                          : "=&r" (u64),
@@ -858,5 +862,6 @@
     uint32_t u32Spill;
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicCmpXchgU8_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxrb    %w0, [%5]\n\t"
@@ -864,5 +869,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "stlxrb    %w1, %w4, [%5]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicCmpXchgU8_%=\n\t"
                          "mov       %w2, #1\n\t"
 #  else
@@ -872,5 +877,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicCmpXchgU8_%=\n\t"
                          "mov       %2, #1\n\t"
 #  endif
@@ -990,5 +995,6 @@
     uint32_t u32Spill;
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicCmpXchgU32_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %w0, [%5]\n\t"
@@ -996,5 +1002,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "stlxr     %w1, %w4, [%5]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicCmpXchgU32_%=\n\t"
                          "mov       %w2, #1\n\t"
 #  else
@@ -1004,5 +1010,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicCmpXchgU32_%=\n\t"
                          "mov       %2, #1\n\t"
 #  endif
@@ -1146,5 +1152,6 @@
     uint64_t u64Spill;
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicCmpXchgU64_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %0, [%5]\n\t"
@@ -1152,5 +1159,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "stlxr     %w1, %4, [%5]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicCmpXchgU64_%=\n\t"
                          "mov       %w2, #1\n\t"
 #  else
@@ -1161,5 +1168,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicCmpXchgU64_%=\n\t"
                          "mov       %2, #1\n\t"
 #  endif
@@ -1374,5 +1381,6 @@
     uint32_t u32ActualOld;
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicCmpXchgExU32_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %w0, [%5]\n\t"
@@ -1380,5 +1388,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "stlxr     %w1, %w4, [%5]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicCmpXchgExU32_%=\n\t"
                          "mov       %w2, #1\n\t"
 #  else
@@ -1388,5 +1396,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicCmpXchgExU32_%=\n\t"
                          "mov       %2, #1\n\t"
 #  endif
@@ -1535,5 +1543,6 @@
     uint64_t u64ActualOld;
     uint32_t rcSpill;
-    __asm__ __volatile__(".Ltry_again%=:\n\t"
+    __asm__ __volatile__(".Ltry_again_ASMAtomicCmpXchgExU64_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %0, [%5]\n\t"
@@ -1541,5 +1550,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "stlxr     %w1, %4, [%5]\n\t"
-                         "cbnz      %w1, .Ltry_again%=\n\t"
+                         "cbnz      %w1, .Ltry_again_ASMAtomicCmpXchgExU64_%=\n\t"
                          "mov       %w2, #1\n\t"
 #  else
@@ -1550,5 +1559,5 @@
                          "bne       1f\n\t"   /* stop here if not equal */
                          "cmp       %1, #0\n\t"
-                         "bne       .Ltry_again%=\n\t"
+                         "bne       .Ltry_again_ASMAtomicCmpXchgExU64_%=\n\t"
                          "mov       %2, #1\n\t"
 #  endif
@@ -1875,5 +1884,5 @@
 #elif defined(RT_ARCH_ARM64) || defined(RT_ARCH_ARM32)
     /* Note! Only armv7 and later. */
-    __asm__ __volatile__ ("dsb sy\n\t" ::: "memory"); /** @todo dmb? */
+    __asm__ __volatile__ ("dmb sy\n\t" ::: "memory");
 #elif ARCH_BITS == 16
     uint16_t volatile u16;
@@ -2194,5 +2203,5 @@
 # elif defined(RT_ARCH_ARM32)
     Assert(!((uintptr_t)pu64 & 7));
-    __asm__ __volatile__("dsb sy\n\t" /** @todo dmb? */
+    __asm__ __volatile__("dmb sy\n\t"
                          "ldrexd    %0, %H0, [%1]\n\t"
                          : "=&r" (u64)
@@ -3140,4 +3149,5 @@
     uint32_t u32Spill;
     __asm__ __volatile__(".Ltry_again_add_u32_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %w0, [%4]\n\t"
@@ -3215,4 +3225,5 @@
     uint64_t u64Spill;
     __asm__ __volatile__(".Ltry_again_add_u64_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %0, [%4]\n\t"
@@ -3505,4 +3516,5 @@
     uint32_t rcSpill;
     __asm__ __volatile__(".Ltry_again_inc_u32_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %w0, [%2]\n\t"
@@ -3575,4 +3587,5 @@
     uint32_t rcSpill;
     __asm__ __volatile__(".Ltry_again_inc_u64_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %0, [%2]\n\t"
@@ -3701,4 +3714,5 @@
     uint32_t rcSpill;
     __asm__ __volatile__(".Ltry_again_dec_u32_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %w0, [%2]\n\t"
@@ -3771,4 +3785,5 @@
     uint32_t rcSpill;
     __asm__ __volatile__(".Ltry_again_dec_u64_%=:\n\t"
+                         "dmb       sy\n\t"
 #  if defined(RT_ARCH_ARM64)
                          "ldaxr     %0, [%2]\n\t"
