Changeset 84b14e2 in mainline for uspace/lib/libc/arch/arm32/include


Ignore:
Timestamp:
2009-12-02T23:33:48Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4924675
Parents:
089d746 (diff), 8d04f709 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge simplified futexes (ticket #154) and fix for arm32 kernel atomic
operations (ticket #153).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/arch/arm32/include/atomic.h

    r089d746 r84b14e2  
    3737#define LIBC_arm32_ATOMIC_H_
    3838
     39#include <bool.h>
     40
     41typedef struct atomic {
     42        volatile long count;
     43} atomic_t;
     44
     45static inline void atomic_set(atomic_t *val, long i)
     46{
     47        val->count = i;
     48}
     49
     50static inline long atomic_get(atomic_t *val)
     51{
     52        return val->count;
     53}
     54
     55static inline bool cas(atomic_t *val, long ov, long nv)
     56{
     57        /* FIXME: is not atomic */
     58        if (val->count == ov) {
     59                val->count = nv;
     60                return true;
     61        }
     62        return false;
     63}
     64
    3965/** Atomic addition.
    4066 *
     
    4975        volatile long * mem = &(val->count);
    5076
     77        /* FIXME: is not atomic, is broken */
    5178        asm volatile (
    5279        "1:\n"
Note: See TracChangeset for help on using the changeset viewer.