-hw_atomic_add(
- uint32_t *dest,
- uint32_t delt)
-{
- uint32_t oldValue;
- uint32_t newValue;
-
- do {
- oldValue = *dest;
- newValue = (oldValue + delt);
- } while (!OSCompareAndSwap((UInt32)oldValue,
- (UInt32)newValue, (UInt32 *)dest));
-
- return newValue;
-}
-
-uint32_t
-hw_atomic_sub(
- uint32_t *dest,
- uint32_t delt)
-{
- uint32_t oldValue;
- uint32_t newValue;
-
- do {
- oldValue = *dest;
- newValue = (oldValue - delt);
- } while (!OSCompareAndSwap((UInt32)oldValue,
- (UInt32)newValue, (UInt32 *)dest));
-
- return newValue;
-}
-
-uint32_t
-hw_atomic_or(
- uint32_t *dest,
- uint32_t mask)
-{
- uint32_t oldValue;
- uint32_t newValue;
-
- do {
- oldValue = *dest;
- newValue = (oldValue | mask);
- } while (!OSCompareAndSwap((UInt32)oldValue,
- (UInt32)newValue, (UInt32 *)dest));
-
- return newValue;
-}
-
-uint32_t
-hw_atomic_and(
- uint32_t *dest,
- uint32_t mask)
-{
- uint32_t oldValue;
- uint32_t newValue;
-
- do {
- oldValue = *dest;
- newValue = (oldValue & mask);
- } while (!OSCompareAndSwap((UInt32)oldValue,
- (UInt32)newValue, (UInt32 *)dest));
-
- return newValue;
-}
-
-uint32_t
-hw_compare_and_store(
- uint32_t oldval,
- uint32_t newval,
- uint32_t *dest)