]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make Helgrind test cases build on arm64-linux.
authorJulian Seward <jseward@acm.org>
Tue, 18 Mar 2014 23:02:59 +0000 (23:02 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 18 Mar 2014 23:02:59 +0000 (23:02 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13878

helgrind/tests/annotate_hbefore.c
helgrind/tests/tc07_hbl1.c
helgrind/tests/tc08_hbl2.c
helgrind/tests/tc11_XCHG.c

index 61974bb5b2c5dda57a6c98835d791358f3bcabd1..3368c5646cb25665b9b1109dfa57a8334c1d0954 100644 (file)
@@ -167,6 +167,39 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
    return success;
 }
 
+#elif defined(VGA_arm64)
+
+// arm64
+/* return 1 if success, 0 if failure */
+UWord do_acasW ( UWord* addr, UWord expected, UWord nyu )
+{
+  UWord old, success;
+  UWord block[2] = { (UWord)addr, nyu };
+
+  /* Fetch the old value, and set the reservation */
+  __asm__ __volatile__ (
+     "ldxr  %0, [%1]"    "\n"
+      : /*out*/   "=r"(old)
+      : /*in*/    "r"(addr)
+   );
+
+   /* If the old value isn't as expected, we've had it */
+   if (old != expected) return 0;
+
+   /* otherwise try to stuff the new value in */
+   __asm__ __volatile__(
+      "ldr    x4, [%1, #0]"      "\n\t"
+      "ldr    x5, [%1, #8]"      "\n\t"
+      "stxr   w6, x5, [x4, #0]"  "\n\t"
+      "eor    %0, x6, #1"        "\n\t"
+      : /*out*/ "=r"(success)
+      : /*in*/ "r"(&block[0])
+      : /*trash*/ "x4","x5","x6","memory"
+   );
+   assert(success == 0 || success == 1);
+   return success;
+}
+
 #elif defined(VGA_s390x)
 
 // s390x
index 92c74e018fc893dfff9b3b32f819bd0095533122..be62337db5dbbe94cda7a7f32a4a465213d27bdf 100644 (file)
@@ -13,6 +13,7 @@
 #undef PLAT_ppc32_linux
 #undef PLAT_ppc64_linux
 #undef PLAT_arm_linux
+#undef PLAT_arm64_linux
 #undef PLAT_s390x_linux
 #undef PLAT_mips32_linux
 
 #  define PLAT_ppc32_linux 1
 #elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
 #  define PLAT_ppc64_linux 1
-#elif defined(__linux__) && defined(__arm__)
+#elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
 #  define PLAT_arm_linux 1
+#elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
+#  define PLAT_arm64_linux 1
 #elif defined(__linux__) && defined(__s390x__)
 #  define PLAT_s390x_linux 1
 #elif defined(__linux__) && defined(__mips__)
       : /*out*/ : /*in*/ "r"(&(_lval))       \
       : /*trash*/ "r8", "r9", "cc", "memory" \
   );
+#elif defined(PLAT_arm64_linux)
+#  define INC(_lval,_lqual) \
+  __asm__ __volatile__( \
+      "1:\n"                                 \
+      "        ldxr  w8, [%0, #0]\n"         \
+      "        add   w8, w8, #1\n"           \
+      "        stxr  w9, w8, [%0, #0]\n"     \
+      "        cmp   w9, #0\n"               \
+      "        bne   1b\n"                   \
+      : /*out*/ : /*in*/ "r"(&(_lval))       \
+      : /*trash*/ "x8", "x9", "cc", "memory" \
+  );
 #elif defined(PLAT_s390x_linux)
 #  define INC(_lval,_lqual) \
    __asm__ __volatile__( \
index 54a1f683d7f588bea183b2702e009b53f27e3e16..2b720a8f6f287472216bab4ca6fc687e5c3c6d40 100644 (file)
@@ -29,6 +29,7 @@
 #undef PLAT_ppc32_linux
 #undef PLAT_ppc64_linux
 #undef PLAT_arm_linux
+#undef PLAT_arm64_linux
 #undef PLAT_s390x_linux
 #undef PLAT_mips32_linux
 #undef PLAT_mips64_linux
 #  define PLAT_ppc32_linux 1
 #elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
 #  define PLAT_ppc64_linux 1
-#elif defined(__linux__) && defined(__arm__)
+#elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
 #  define PLAT_arm_linux 1
+#elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
+#  define PLAT_arm64_linux 1
 #elif defined(__linux__) && defined(__s390x__)
 #  define PLAT_s390x_linux 1
 #elif defined(__linux__) && defined(__mips__)
       : /*out*/ : /*in*/ "r"(&(_lval))       \
       : /*trash*/ "r8", "r9", "cc", "memory" \
   );
+#elif defined(PLAT_arm64_linux)
+#  define INC(_lval,_lqual) \
+  __asm__ __volatile__( \
+      "1:\n"                                 \
+      "        ldxr  w8, [%0, #0]\n"         \
+      "        add   w8, w8, #1\n"           \
+      "        stxr  w9, w8, [%0, #0]\n"     \
+      "        cmp   w9, #0\n"               \
+      "        bne   1b\n"                   \
+      : /*out*/ : /*in*/ "r"(&(_lval))       \
+      : /*trash*/ "x8", "x9", "cc", "memory" \
+  );
 #elif defined(PLAT_s390x_linux)
 #  define INC(_lval,_lqual) \
    __asm__ __volatile__( \
index fadc774fbaa1514a3edd0e394bc29df7904b58a0..23edf9e08542d54135f961b03510c8f662031ea6 100644 (file)
 #  define PLAT_ppc32_linux 1
 #elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
 #  define PLAT_ppc64_linux 1
-#elif defined(__linux__) && defined(__arm__)
+#elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
 #  define PLAT_arm_linux 1
+#elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
+#  define PLAT_arm64_linux 1
 #elif defined(__linux__) && defined(__s390x__)
 #  define PLAT_s390x_linux 1
 #elif defined(__linux__) && defined(__mips__)
@@ -91,7 +93,7 @@
       XCHG_M_R(_addr,_lval)
 
 #elif defined(PLAT_ppc32_linux) || defined(PLAT_ppc64_linux) \
-      || defined(PLAT_arm_linux)
+      || defined(PLAT_arm_linux) || defined(PLAT_arm64_linux)
 #  if defined(HAVE_BUILTIN_ATOMIC)
 #    define XCHG_M_R(_addr,_lval)                                           \
         do {                                                                \