Subversion Repositories HelenOS

Rev

Rev 1888 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1888 Rev 1890
Line 49... Line 49...
49
static inline long atomic_add(atomic_t *val, int i)
49
static inline long atomic_add(atomic_t *val, int i)
50
{
50
{
51
    uint64_t a, b;
51
    uint64_t a, b;
52
 
52
 
53
    do {
53
    do {
54
        volatile uintptr_t x = (uint64_t) &val->count;
-
 
55
 
-
 
56
        a = *((uint64_t *) x);
54
        a = val->count;
57
        b = a + i;
55
        b = a + i;
58
        __asm__ volatile ("casx %0, %1, %2\n": "+m" (*((uint64_t *)x)), "+r" (a), "+r" (b));
56
        __asm__ volatile ("casx %0, %2, %1\n" : "+m" (*val), "+r" (b) : "r" (a));
59
    } while (a != b);
57
    } while (a != b);
60
 
58
 
61
    return a;
59
    return a;
62
}
60
}
63
 
61