This change adds a Unikraft macro for an architecture's atomic fetch &
AND operation, similar to the fetch & OR we already have.
It also fixes the order of the fetch & OR operations to be truthful to
the docstring.
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1125
* Perform an atomic OR operation and return the previous value.
*/
#define ukarch_or(src, val) \
- __atomic_or_fetch(src, val, __ATOMIC_SEQ_CST)
+ __atomic_fetch_or(src, val, __ATOMIC_SEQ_CST)
+
+/**
+ * Perform an atomic AND operation and return the previous value.
+ */
+#define ukarch_and(src, val) \
+ __atomic_fetch_and(src, val, __ATOMIC_SEQ_CST)
/**
* Writes *src into *dst, and returns the previous contents of *dst.