Subversion Repositories HelenOS

Rev

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

Rev 2082 Rev 3578
Line 49... Line 49...
49
    asm volatile ("fetchadd8.rel %0 = %1, %2\n" : "=r" (v), "+m" (val->count) : "i" (imm));
49
    asm volatile ("fetchadd8.rel %0 = %1, %2\n" : "=r" (v), "+m" (val->count) : "i" (imm));
50
 
50
 
51
    return v;
51
    return v;
52
}
52
}
53
 
53
 
-
 
54
 
-
 
55
static inline uint64_t test_and_set(atomic_t *val) {
-
 
56
    uint64_t v;
-
 
57
       
-
 
58
    asm volatile (
-
 
59
        "movl %0=0x01;;\n"
-
 
60
        "xchg8 %0=%1,%0;;\n"
-
 
61
        : "=r" (v),"+m" (val->count)
-
 
62
    );
-
 
63
   
-
 
64
    return v;
-
 
65
}
-
 
66
 
-
 
67
 
54
static inline void atomic_inc(atomic_t *val) { atomic_add(val, 1); }
68
static inline void atomic_inc(atomic_t *val) { atomic_add(val, 1); }
55
static inline void atomic_dec(atomic_t *val) { atomic_add(val, -1); }
69
static inline void atomic_dec(atomic_t *val) { atomic_add(val, -1); }
56
 
70
 
57
static inline long atomic_preinc(atomic_t *val) { return atomic_add(val, 1) + 1; }
71
static inline long atomic_preinc(atomic_t *val) { return atomic_add(val, 1) + 1; }
58
static inline long atomic_predec(atomic_t *val) { return atomic_add(val, -1) - 1; }
72
static inline long atomic_predec(atomic_t *val) { return atomic_add(val, -1) - 1; }