AArch64: Add atomic functions
This patch adds atomic functions for AArch64. The functions
will be revisited later for potential optimizations using
assembly or otherwise.
This patch also introduces new 64-bit atomic functions for
LP64 platforms.
Change-Id: Id2127dd01cea65025f939e955d73d27e95d8687e
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
diff --git a/include/cutils/atomic.h b/include/cutils/atomic.h
index ae42eb8..1787e34 100644
--- a/include/cutils/atomic.h
+++ b/include/cutils/atomic.h
@@ -80,6 +80,11 @@
int32_t android_atomic_acquire_load(volatile const int32_t* addr);
int32_t android_atomic_release_load(volatile const int32_t* addr);
+#if defined (__LP64__)
+int64_t android_atomic_acquire_load64(volatile const int64_t* addr);
+int64_t android_atomic_release_load64(volatile const int64_t* addr);
+#endif
+
/*
* Perform an atomic store with "acquire" or "release" ordering.
*
@@ -89,6 +94,11 @@
void android_atomic_acquire_store(int32_t value, volatile int32_t* addr);
void android_atomic_release_store(int32_t value, volatile int32_t* addr);
+#if defined (__LP64__)
+void android_atomic_acquire_store64(int64_t value, volatile int64_t* addr);
+void android_atomic_release_store64(int64_t value, volatile int64_t* addr);
+#endif
+
/*
* Compare-and-set operation with "acquire" or "release" ordering.
*
@@ -106,6 +116,13 @@
int android_atomic_release_cas(int32_t oldvalue, int32_t newvalue,
volatile int32_t* addr);
+#if defined (__LP64__)
+int64_t android_atomic_acquire_cas64(int64_t old_value, int64_t new_value,
+ volatile int64_t *ptr);
+int64_t android_atomic_release_cas64(int64_t old_value, int64_t new_value,
+ volatile int64_t *ptr);
+#endif
+
/*
* Aliases for code using an older version of this header. These are now
* deprecated and should not be used. The definitions will be removed