Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/include/atomic.h

    rd99c1d2 r33c4f72  
    3939#include <arch/barrier.h>
    4040#include <preemption.h>
     41#include <verify.h>
    4142
    42 static inline void atomic_inc(atomic_t *val) {
     43ATOMIC 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{
    4348        /* On real hardware the increment has to be done
    4449           as an atomic action. */
     
    4752}
    4853
    49 static inline void atomic_dec(atomic_t *val) {
     54ATOMIC 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{
    5059        /* On real hardware the decrement has to be done
    5160           as an atomic action. */
    5261       
    53         val->count++;
     62        val->count--;
    5463}
    5564
    56 static inline atomic_count_t atomic_postinc(atomic_t *val)
     65ATOMIC 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)
    5769{
    5870        /* On real hardware both the storing of the previous
     
    6678}
    6779
    68 static inline atomic_count_t atomic_postdec(atomic_t *val)
     80ATOMIC 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)
    6984{
    7085        /* On real hardware both the storing of the previous
     
    8196#define atomic_predec(val)  (atomic_postdec(val) - 1)
    8297
    83 static inline atomic_count_t test_and_set(atomic_t *val)
     98ATOMIC static inline atomic_count_t test_and_set(atomic_t *val)
     99    WRITES(&val->count)
     100    REQUIRES_EXTENT_MUTABLE(val)
    84101{
     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       
    85106        atomic_count_t prev = val->count;
    86107        val->count = 1;
     
    89110
    90111static inline void atomic_lock_arch(atomic_t *val)
     112    WRITES(&val->count)
     113    REQUIRES_EXTENT_MUTABLE(val)
    91114{
    92115        do {
Note: See TracChangeset for help on using the changeset viewer.