[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 02/11] include/uk: import write_once and read_once from freebsd



Hello Yuri,

This patch seems fine.

Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>

Thanks & Regards
Sharan

On 12/5/18 6:23 PM, Yuri Volchkov wrote:
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__ */


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.