File dapl-add-aarch64-platform-support.patch of Package dapl
From 142fa8fa58d5e0b92dccc52d7a3bd913456084b4 Mon Sep 17 00:00:00 2001
From: Mark Salter <msalter@redhat.com>
Date: Wed, 13 May 2015 16:40:58 -0700
Subject: [PATCH] dapl: aarch64 support for linux
Add atomic ops to fix builds for aarch64 Linux.
Signed-off-by: Mark Salter <msalter@redhat.com>
Acked-by: Arlin Davis <arlin.r.davis@intel.com>
---
dapl/udapl/linux/dapl_osd.h | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
Index: dapl-2.0.42/dapl/udapl/linux/dapl_osd.h
===================================================================
--- dapl-2.0.42.orig/dapl/udapl/linux/dapl_osd.h
+++ dapl-2.0.42/dapl/udapl/linux/dapl_osd.h
@@ -51,7 +51,8 @@
#if !defined(__i386__) && !defined(__ia64__) \
&& !defined(__x86_64__) && !defined(__PPC__) && !defined(__PPC64__) \
-&& !defined(__s390x__) && !defined(__s390__)
+&& !defined(__s390x__) && !defined(__s390__) \
+&& !defined(__aarch64__)
#error UNDEFINED ARCH
#endif
@@ -213,6 +214,8 @@ dapl_os_atomic_inc (
: "=&r" (tmp), "+m" (v)
: "b" (v)
: "cc");
+#elif defined(__aarch64__)
+ __atomic_fetch_add(v, 1, __ATOMIC_ACQ_REL);
#else /* !__ia64__ */
__asm__ __volatile__ (
"lock;" "incl %0"
@@ -257,6 +260,8 @@ dapl_os_atomic_dec (
: "=&r" (tmp), "+m" (v)
: "b" (v)
: "cc");
+#elif defined(__aarch64__)
+ __atomic_fetch_add(v, -1, __ATOMIC_ACQ_REL);
#else /* !__ia64__ */
__asm__ __volatile__ (
"lock;" "decl %0"
@@ -321,6 +326,10 @@ dapl_os_atomic_assign (
: "=&r" (current_value), "=m" (*v)
: "r" (v), "r" (match_value), "r" (new_value), "m" (*v)
: "cc", "memory");
+#elif defined(__aarch64__)
+ current_value = match_value;
+ __atomic_compare_exchange_n(v, ¤t_value, new_value, 1,
+ __ATOMIC_ACQ_REL, __ATOMIC_RELAXED);
#else
__asm__ __volatile__ (
"lock; cmpxchgl %1, %2"