Changes in kernel/arch/abs32le/include/atomic.h [33c4f72:d99c1d2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/abs32le/include/atomic.h
r33c4f72 rd99c1d2 39 39 #include <arch/barrier.h> 40 40 #include <preemption.h> 41 #include <verify.h>42 41 43 ATOMIC static inline void atomic_inc(atomic_t *val) 44 WRITES(&val->count) 45 REQUIRES_EXTENT_MUTABLE(val) 46 REQUIRES(val->count < ATOMIC_COUNT_MAX) 47 { 42 static inline void atomic_inc(atomic_t *val) { 48 43 /* On real hardware the increment has to be done 49 44 as an atomic action. */ … … 52 47 } 53 48 54 ATOMIC static inline void atomic_dec(atomic_t *val) 55 WRITES(&val->count) 56 REQUIRES_EXTENT_MUTABLE(val) 57 REQUIRES(val->count > ATOMIC_COUNT_MIN) 58 { 49 static inline void atomic_dec(atomic_t *val) { 59 50 /* On real hardware the decrement has to be done 60 51 as an atomic action. */ 61 52 62 val->count --;53 val->count++; 63 54 } 64 55 65 ATOMIC static inline atomic_count_t atomic_postinc(atomic_t *val) 66 WRITES(&val->count) 67 REQUIRES_EXTENT_MUTABLE(val) 68 REQUIRES(val->count < ATOMIC_COUNT_MAX) 56 static inline atomic_count_t atomic_postinc(atomic_t *val) 69 57 { 70 58 /* On real hardware both the storing of the previous … … 78 66 } 79 67 80 ATOMIC static inline atomic_count_t atomic_postdec(atomic_t *val) 81 WRITES(&val->count) 82 REQUIRES_EXTENT_MUTABLE(val) 83 REQUIRES(val->count > ATOMIC_COUNT_MIN) 68 static inline atomic_count_t atomic_postdec(atomic_t *val) 84 69 { 85 70 /* On real hardware both the storing of the previous … … 96 81 #define atomic_predec(val) (atomic_postdec(val) - 1) 97 82 98 ATOMIC static inline atomic_count_t test_and_set(atomic_t *val) 99 WRITES(&val->count) 100 REQUIRES_EXTENT_MUTABLE(val) 83 static inline atomic_count_t test_and_set(atomic_t *val) 101 84 { 102 /* On real hardware the retrieving of the original103 value and storing 1 have to be done as a single104 atomic action. */105 106 85 atomic_count_t prev = val->count; 107 86 val->count = 1; … … 110 89 111 90 static inline void atomic_lock_arch(atomic_t *val) 112 WRITES(&val->count)113 REQUIRES_EXTENT_MUTABLE(val)114 91 { 115 92 do {
Note:
See TracChangeset
for help on using the changeset viewer.