diff options
Diffstat (limited to 'kern/bitmap.h')
-rw-r--r-- | kern/bitmap.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/kern/bitmap.h b/kern/bitmap.h index a604d17c..c206944a 100644 --- a/kern/bitmap.h +++ b/kern/bitmap.h @@ -78,7 +78,7 @@ bitmap_set_atomic(unsigned long *bm, int bit) bitmap_lookup(bm, bit); } - atomic_or_acq_rel(bm, bitmap_mask(bit)); + atomic_or(bm, bitmap_mask(bit), ATOMIC_RELEASE); } static inline void @@ -98,7 +98,7 @@ bitmap_clear_atomic(unsigned long *bm, int bit) bitmap_lookup(bm, bit); } - atomic_and_acq_rel(bm, ~bitmap_mask(bit)); + atomic_and(bm, ~bitmap_mask(bit), ATOMIC_RELEASE); } static inline int @@ -111,6 +111,16 @@ bitmap_test(const unsigned long *bm, int bit) return ((*bm & bitmap_mask(bit)) != 0); } +static inline int +bitmap_test_atomic(const unsigned long *bm, int bit) +{ + if (bit >= LONG_BIT) { + bitmap_lookup(bm, bit); + } + + return ((atomic_load(bm, ATOMIC_ACQUIRE) & bitmap_mask(bit)) != 0); +} + static inline void bitmap_and(unsigned long *a, const unsigned long *b, int nr_bits) { |