[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 02/11] include/uk: import write_once and read_once from freebsd
commit <910f555845468ecbdd14dbce7bcc584812e084dc> Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx> --- include/uk/arch/atomic.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/uk/arch/atomic.h b/include/uk/arch/atomic.h index ce8f6e5..ccd4417 100644 --- a/include/uk/arch/atomic.h +++ b/include/uk/arch/atomic.h @@ -87,4 +87,21 @@ extern "C" { } #endif +#define UK_ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x)) + +#define UK_WRITE_ONCE(x, v) do { \ + barrier(); \ + UK_ACCESS_ONCE(x) = (v); \ + barrier(); \ +} while (0) + +#define UK_READ_ONCE(x) ({ \ + __typeof(x) __var = ({ \ + barrier(); \ + UK_ACCESS_ONCE(x); \ + }); \ + barrier(); \ + __var; \ +}) + #endif /* __UKARCH_ATOMIC_H__ */ -- 2.19.2 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |