summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2016-04-30 13:18:46 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2016-04-30 18:36:22 +0200
commit250c6572bdf0dde579cd4f62ae5c0964bc445b58 (patch)
treeb00e46ac85111819fded505d053049848b316efb
parent61cbbfb9198ec7723cb1db2ed2f7ca7a72f92f00 (diff)
header: add barrier_data()
barrier_data() was added in Linux commit 7829fb09 "lib: make memzero_explicit more robust against dead store elimination". This is needed by memzero_explicit added in the next patch. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/compiler.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/backport/backport-include/linux/compiler.h b/backport/backport-include/linux/compiler.h
index 613b857a..0b2358c6 100644
--- a/backport/backport-include/linux/compiler.h
+++ b/backport/backport-include/linux/compiler.h
@@ -25,4 +25,12 @@
# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
#endif
+#ifndef barrier_data
+#ifdef __GNUC__
+#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
+#else /* __GNUC__ */
+# define barrier_data(ptr) barrier()
+#endif /* __GNUC__ */
+#endif
+
#endif /* __BACKPORT_LINUX_COMPILER_H */