Module Name: src
Committed By: riastradh
Date: Sun Dec 19 01:24:36 UTC 2021
Modified Files:
src/sys/external/bsd/common/include/linux: compiler.h
Log Message:
Define smp_store_mb, smp_store_release.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/common/include/linux/compiler.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/common/include/linux/compiler.h
diff -u src/sys/external/bsd/common/include/linux/compiler.h:1.2 src/sys/external/bsd/common/include/linux/compiler.h:1.3
--- src/sys/external/bsd/common/include/linux/compiler.h:1.2 Sun Dec 19 00:48:23 2021
+++ src/sys/external/bsd/common/include/linux/compiler.h Sun Dec 19 01:24:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: compiler.h,v 1.2 2021/12/19 00:48:23 riastradh Exp $ */
+/* $NetBSD: compiler.h,v 1.3 2021/12/19 01:24:36 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,6 +34,8 @@
#include <sys/atomic.h>
+#include <asm/barrier.h>
+
#define READ_ONCE(X) ({ \
typeof(X) __read_once_tmp = (X); \
membar_datadep_consumer(); \
@@ -46,4 +48,15 @@
__write_once_tmp; \
})
+#define smp_store_mb(X, V) do { \
+ WRITE_ONCE(X, V); \
+ smp_mb(); \
+} while (0)
+
+#define smp_store_release(X, V) do { \
+ typeof(X) __smp_store_release_tmp = (V); \
+ membar_exit(); \
+ (X) = __write_once_tmp; \
+} while (0)
+
#endif /* _LINUX_COMPILER_H_ */