diff --git a/sys/sys/_atomic_subword.h b/sys/sys/_atomic_subword.h --- a/sys/sys/_atomic_subword.h +++ b/sys/sys/_atomic_subword.h @@ -205,4 +205,31 @@ #undef _ATOMIC_BYTE_SHIFT #undef _ATOMIC_HWORD_SHIFT +static __inline void +atomic_set_short(volatile u_short *p, u_short bit) +{ + u_short v; + + v = atomic_load_short(p); + for (;;) { + if (atomic_fcmpset_short(p, &v, v | bit)) + break; + } +} + +static __inline void +atomic_clear_short(volatile u_short *p, u_short bit) +{ + u_short v; + + v = atomic_load_short(p); + for (;;) { + if (atomic_fcmpset_short(p, &v, v & ~bit)) + break; + } +} + +#define atomic_set_16 atomic_set_short +#define atomic_clear_16 atomic_clear_short + #endif /* _SYS__ATOMIC_SUBWORD_H_ */