about summary refs log tree commit diff
path: root/sysdeps/aarch64/atomic-machine.h
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2021-06-08 12:48:43 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-08-05 19:45:19 +0100
commitc8f1fc9d94f9c311d382833c3393f12c1acb1991 (patch)
tree9aa7ee0418ee28f9e60079f755ad54559d3bc8b2 /sysdeps/aarch64/atomic-machine.h
parent7880bbd37436b0acd01936b7ba143d1f13634e85 (diff)
downloadglibc-c8f1fc9d94f9c311d382833c3393f12c1acb1991.tar.gz
glibc-c8f1fc9d94f9c311d382833c3393f12c1acb1991.tar.xz
glibc-c8f1fc9d94f9c311d382833c3393f12c1acb1991.zip
cheri: Implement 128-bit atomics
Arm Morello requires 128-bit atomics.
Diffstat (limited to 'sysdeps/aarch64/atomic-machine.h')
-rw-r--r--sysdeps/aarch64/atomic-machine.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/sysdeps/aarch64/atomic-machine.h b/sysdeps/aarch64/atomic-machine.h
index 52b3fb2047..14e9481392 100644
--- a/sysdeps/aarch64/atomic-machine.h
+++ b/sysdeps/aarch64/atomic-machine.h
@@ -54,6 +54,13 @@
 				  model, __ATOMIC_RELAXED);		\
   })
 
+#  define __arch_compare_and_exchange_bool_128_int(mem, newval, oldval, model) \
+  ({									\
+    typeof (*mem) __oldval = (oldval);					\
+    !__atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0,	\
+				  model, __ATOMIC_RELAXED);		\
+  })
+
 # define __arch_compare_and_exchange_val_8_int(mem, newval, oldval, model) \
   ({									\
     typeof (*mem) __oldval = (oldval);					\
@@ -86,6 +93,14 @@
     __oldval;								\
   })
 
+#  define __arch_compare_and_exchange_val_128_int(mem, newval, oldval, model) \
+  ({									\
+    typeof (*mem) __oldval = (oldval);					\
+    __atomic_compare_exchange_n (mem, (void *) &__oldval, newval, 0,	\
+				 model, __ATOMIC_RELAXED);		\
+    __oldval;								\
+  })
+
 
 /* Compare and exchange with "acquire" semantics, ie barrier after.  */
 
@@ -118,6 +133,9 @@
 #  define __arch_exchange_64_int(mem, newval, model)	\
   __atomic_exchange_n (mem, newval, model)
 
+#  define __arch_exchange_128_int(mem, newval, model)	\
+  __atomic_exchange_n (mem, newval, model)
+
 # define atomic_exchange_acq(mem, value)				\
   __atomic_val_bysize (__arch_exchange, int, mem, value, __ATOMIC_ACQUIRE)
 
@@ -139,6 +157,9 @@
 #  define __arch_exchange_and_add_64_int(mem, value, model)	\
   __atomic_fetch_add (mem, value, model)
 
+#  define __arch_exchange_and_add_128_int(mem, value, model)	\
+  __atomic_fetch_add (mem, value, model)
+
 # define atomic_exchange_and_add_acq(mem, value)			\
   __atomic_val_bysize (__arch_exchange_and_add, int, mem, value,	\
 		       __ATOMIC_ACQUIRE)