summaryrefslogtreecommitdiffhomepage
path: root/vdso/barrier.h
diff options
context:
space:
mode:
authorHaibo Xu <haibo.xu@arm.com>2019-04-18 16:20:45 -0700
committerShentubot <shentubot@google.com>2019-04-18 16:22:08 -0700
commitf4d434c18002c96511decf8ff1ebdbede46ca6a1 (patch)
treecc781d877ef0ea64ce33c46d6a30b76eefa4753a /vdso/barrier.h
parentc931c8e0829914718a729e20d7db0c2bf4e73f0b (diff)
Enable vDSO support on arm64.
Signed-off-by: Haibo Xu <haibo.xu@arm.com> Change-Id: I20103cd6d193431ab7e8120005da1f567b9bc2eb PiperOrigin-RevId: 244280119
Diffstat (limited to 'vdso/barrier.h')
-rw-r--r--vdso/barrier.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/vdso/barrier.h b/vdso/barrier.h
index 7866af414..5b6c763f6 100644
--- a/vdso/barrier.h
+++ b/vdso/barrier.h
@@ -21,11 +21,25 @@ namespace vdso {
inline void barrier(void) { __asm__ __volatile__("" ::: "memory"); }
#if __x86_64__
+
inline void memory_barrier(void) {
__asm__ __volatile__("mfence" ::: "memory");
}
inline void read_barrier(void) { barrier(); }
inline void write_barrier(void) { barrier(); }
+
+#elif __aarch64__
+
+inline void memory_barrier(void) {
+ __asm__ __volatile__("dmb ish" ::: "memory");
+}
+inline void read_barrier(void) {
+ __asm__ __volatile__("dmb ishld" ::: "memory");
+}
+inline void write_barrier(void) {
+ __asm__ __volatile__("dmb ishst" ::: "memory");
+}
+
#else
#error "unsupported architecture"
#endif