summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/liburing/barrier.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/include/liburing/barrier.h b/src/include/liburing/barrier.h
index 98be9e5..b98193b 100644
--- a/src/include/liburing/barrier.h
+++ b/src/include/liburing/barrier.h
@@ -56,7 +56,20 @@ do { \
barrier(); \
___p1; \
})
-#else /* defined(__x86_64__) || defined(__i386__) */
+
+#elif defined(__aarch64__)
+/* Adapted from arch/arm64/include/asm/barrier.h */
+#define dmb(opt) asm volatile("dmb " #opt : : : "memory")
+#define dsb(opt) asm volatile("dsb " #opt : : : "memory")
+
+#define mb() dsb(sy)
+#define rmb() dsb(ld)
+#define wmb() dsb(st)
+#define smp_mb() dmb(ish)
+#define smp_rmb() dmb(ishld)
+#define smp_wmb() dmb(ishst)
+
+#else /* defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) */
/*
* Add arch appropriate definitions. Be safe and use full barriers for
* archs we don't have support for.