xref: /illumos-gate/usr/src/compat/bhyve/stdatomic.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
14  */
15 
16 #ifndef _COMPAT_FREEBSD_STDATOMIC_H_
17 #define	_COMPAT_FREEBSD_STDATOMIC_H_
18 
19 #include <machine/atomic.h>
20 
21 /*
22  * For now, this is just enough to support the usage in usr/src/cmd/bhyve/rfb.c
23  * which uses these functions with atomic_bool/bool arguments.
24  */
25 
26 #define	atomic_bool volatile u_int
27 
28 #define	atomic_compare_exchange_strong(p, ovalp, nval) \
29 	atomic_cmpset_int((p), *(ovalp), (nval))
30 
31 #define	atomic_exchange(p, nval)	atomic_swap_int((p), (nval))
32 
33 #endif	/* _COMPAT_FREEBSD_STDATOMIC_H_ */
34