Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/common/include/asm linux: Define mb/wmb/rmb...
details: https://anonhg.NetBSD.org/src/rev/9d3687644cf2
branches: trunk
changeset: 1028892:9d3687644cf2
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 12:25:05 2021 +0000
description:
linux: Define mb/wmb/rmb for x86.
These are _not_ SMP barriers; on Linux they specifically mean
mfence/sfence/lfence. Although membar_sync and mb agree, and
membar_consumer and rmb agree, membar_producer and wmb _do not_ agree
on x86 -- Linux's wmb is specifically sfence, which is important only
for unusual memory types, whereas our membar_producer is limited to
ordinary memory.
diffstat:
sys/external/bsd/common/include/asm/barrier.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (21 lines):
diff -r caf2e349f482 -r 9d3687644cf2 sys/external/bsd/common/include/asm/barrier.h
--- a/sys/external/bsd/common/include/asm/barrier.h Sun Dec 19 12:24:57 2021 +0000
+++ b/sys/external/bsd/common/include/asm/barrier.h Sun Dec 19 12:25:05 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: barrier.h,v 1.8 2021/12/19 11:02:54 riastradh Exp $ */
+/* $NetBSD: barrier.h,v 1.9 2021/12/19 12:25:05 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -46,6 +46,11 @@
#define mb() __asm __volatile ("dsb sy" ::: "memory")
#define wmb() __asm __volatile ("dsb st" ::: "memory")
#define rmb() __asm __volatile ("dsb ld" ::: "memory")
+#elif defined(__x86_64__)
+#include <x86/cpufunc.h>
+#define mb() x86_mfence()
+#define wmb() x86_sfence()
+#define rmb() x86_lfence()
#else
#define mb membar_sync
#define wmb membar_producer
Home |
Main Index |
Thread Index |
Old Index