Subversion Repositories HelenOS

Rev

Rev 2131 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2131 Rev 2307
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
 
54
        a = val->count;
56
        a = *((uint64_t *) x);
55
        b = a + i;
57
        b = a + i;
56
        asm volatile ("casx %0, %2, %1\n" : "+m" (*val), "+r" (b) : "r" (a));
58
        asm volatile ("casx %0, %2, %1\n" : "+m" (*((uint64_t *)x)), "+r" (b) : "r" (a));
57
    } while (a != b);
59
    } while (a != b);
58
 
60
 
59
    return a;
61
    return a;
60
}
62
}
61
 
63