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