From: John Wolfe Date: Wed, 21 Sep 2022 17:53:28 +0000 (-0700) Subject: Change to common header file not applicable to open-vm-tools. X-Git-Tag: stable-12.2.0~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d13616f84f10e836cb589a1bab62d8ae3331c7d;p=thirdparty%2Fopen-vm-tools.git Change to common header file not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/vm_atomic.h b/open-vm-tools/lib/include/vm_atomic.h index 386714e53..26bd76a69 100644 --- a/open-vm-tools/lib/include/vm_atomic.h +++ b/open-vm-tools/lib/include/vm_atomic.h @@ -3065,6 +3065,40 @@ Atomic_ReadIfEqualWrite16(Atomic_uint16 *var, // IN/OUT } +/* + *----------------------------------------------------------------------------- + * + * Atomic_ReadAnd16 -- + * + * Atomic read (returned), bitwise AND with a value, write. + * + * Results: + * The value of the variable before the operation. + * + * Side effects: + * None + * + *----------------------------------------------------------------------------- + */ + +static INLINE uint16 +Atomic_ReadAnd16(Atomic_uint16 *var, // IN/OUT + uint16 val) // IN +{ + uint16 res; + +#if defined __GNUC__ && defined VM_ARM_64 + res = _VMATOM_X(ROP, 16, TRUE, &var->value, and, val); +#else + do { + res = Atomic_Read16(var); + } while (res != Atomic_ReadIfEqualWrite16(var, res, res & val)); +#endif + + return res; +} + + /* *----------------------------------------------------------------------------- *