Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 8d04f709 in mainline


Ignore:
Timestamp:
2009-12-02T23:26:20Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
84b14e2
Parents:
e15e0e8
Message:

Add dummy implementation of arm32 cas.

The arm32 uspace atomic functions are still not atomic and
some of them are still broken as before, but at least it
compiles.

File:
1 edited

Legend:

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

    re15e0e8 r8d04f709  
    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.