diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-05-27 19:47:09 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-05-27 19:47:09 +0000 |
commit | fe30c058ab83dfb07358dfaf9d492788897a6b0c (patch) | |
tree | 5f6371ef11d05f88e76dd0bfbd681bd3593eb854 | |
parent | 93bed53fee5b4b27dc2927f35aa011f6456c5a1d (diff) |
Add membar_enter_after_atomic(9) and membar_exit_before_atomic(9) APIs to
allow important optimizations on architectures where atomic instructions
include and implied memory barrier.
ok mikeb@, visa@, mpi@
-rw-r--r-- | sys/sys/atomic.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/sys/atomic.h b/sys/sys/atomic.h index 5c04693b668..d78cf24242c 100644 --- a/sys/sys/atomic.h +++ b/sys/sys/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.4 2017/01/24 22:22:20 dlg Exp $ */ +/* $OpenBSD: atomic.h,v 1.5 2017/05/27 19:47:08 kettenis Exp $ */ /* * Copyright (c) 2014 David Gwynne <dlg@openbsd.org> * @@ -219,4 +219,12 @@ atomic_sub_long_nv(volatile unsigned long *p, unsigned long v) #define membar_sync() __sync_synchronize() #endif +#ifndef membar_enter_after_atomic +#define membar_enter_after_atomic() membar_enter() +#endif + +#ifndef membar_exit_before_atomic +#define membar_exit_before_atomic() membar_exit() +#endif + #endif /* _SYS_ATOMIC_H_ */ |