]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common header file not applicable to open-vm-tools.
authorJohn Wolfe <jwolfe@vmware.com>
Wed, 21 Sep 2022 17:53:28 +0000 (10:53 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Wed, 21 Sep 2022 17:53:28 +0000 (10:53 -0700)
open-vm-tools/lib/include/vm_atomic.h

index 386714e53397d43e7b58536503c3b48db89f054e..26bd76a6985b78d00b62f92c6aa067125d2c5f23 100644 (file)
@@ -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;
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  *