Index: sys/sys/atomic_common.h =================================================================== --- sys/sys/atomic_common.h +++ sys/sys/atomic_common.h @@ -39,6 +39,10 @@ #include #include +#define __atomic_load_bool_relaxed(p) (*(volatile _Bool *)(p)) +#define __atomic_store_bool_relaxed(p, v) \ + (*(volatile _Bool *)(p) = (_Bool)(v)) + #define __atomic_load_char_relaxed(p) (*(volatile u_char *)(p)) #define __atomic_load_short_relaxed(p) (*(volatile u_short *)(p)) #define __atomic_load_int_relaxed(p) (*(volatile u_int *)(p)) @@ -70,6 +74,11 @@ */ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ __has_extension(c_generic_selections) +#define atomic_load_bool(p) \ + _Generic(*(p), _Bool: __atomic_load_bool_relaxed(p)) +#define atomic_store_bool(p, v) \ + _Generic(*(p), _Bool: __atomic_store_bool_relaxed(p, v)) + #define __atomic_load_generic(p, t, ut, n) \ _Generic(*(p), \ t: __atomic_load_ ## n ## _relaxed(p), ut: __atomic_load_ ## n ## _relaxed(p)) @@ -77,6 +86,8 @@ _Generic(*(p), \ t: __atomic_store_ ## n ## _relaxed(p, v), ut: __atomic_store_ ## n ## _relaxed(p, v)) #else +#define atomic_load_bool(p) __atomic_load_bool_relaxed(p) +#define atomic_store_bool(p, v) __atomic_store_bool_relaxed(p, v) #define __atomic_load_generic(p, t, ut, n) __atomic_load_ ## n ## _relaxed(p) #define __atomic_store_generic(p, v, t, ut, n) __atomic_store_ ## n ## _relaxed(p, v) #endif