summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/include/sys/cdefs.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/include/sys/cdefs.h b/sys/include/sys/cdefs.h
index 56d1f87..bec4431 100644
--- a/sys/include/sys/cdefs.h
+++ b/sys/include/sys/cdefs.h
@@ -38,6 +38,9 @@
#define __used __attr(used)
#define __naked __attr(naked)
+/* Wrapper for inline asm */
+#define __ASMV __asm__ __volatile__
+
/* Pack a structure */
#define __packed __attribute__((__packed__))
@@ -54,6 +57,12 @@
#define __cacheline_aligned __aligned(64)
/*
+ * Memory barrier, ensure compiler doesn't reorder
+ * memory accesses.
+ */
+#define __mem_barrier() __ASMV("" ::: "memory")
+
+/*
* To be used when an empty body is required like:
*
* #ifdef DEBUG
@@ -106,9 +115,6 @@
/* Computes 2^x i.e 2 to the power of 'x' */
#define __POW2(x) (1ULL << x)
-/* Wrapper for inline asm */
-#define __ASMV __asm__ __volatile__
-
/*
* Used to give metadata to
* a specific module. Example