update x86_64 cmpxchg
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Tue, 22 Sep 2009 20:56:18 +0000 (16:56 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Tue, 22 Sep 2009 20:56:18 +0000 (16:56 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
arch_atomic_x86.h
tests/test_atomic.c

index 97a7cdd019129b8f2c7cf190991e89d5fef52a2a..6b33d453285f2e11535f30a9f9f7621b31a5c184 100644 (file)
@@ -75,7 +75,7 @@ unsigned long _atomic_cmpxchg(volatile void *addr, unsigned long old,
 #if (BITS_PER_LONG == 64)
        case 8:
        {
-               unsigned int result = old;
+               unsigned long result = old;
                __asm__ __volatile__(
                "lock; cmpxchgq %2, %1"
                        : "+a"(result), "+m"(*__hp(addr))
index bf847572815012be866ff9b921c85b97ace1aa0d..3d2b64e434d3ef97eb0feec03a2c49968b96bc2e 100644 (file)
@@ -13,20 +13,20 @@ static struct testvals vals;
 
 #define do_test(ptr)                           \
 do {                                           \
-       __typeof__(*ptr) v;                     \
+       __typeof__(*(ptr)) v;                   \
                                                \
        atomic_add(ptr, 10);                    \
-       assert(*ptr == 10);                     \
-       atomic_add(ptr, -11);                   \
-       assert(*ptr == (__typeof__(*ptr))-1U);  \
-       v = cmpxchg(ptr, -1, 22);               \
-       assert(*ptr == 22);                     \
-       assert(v == (__typeof__(*ptr))-1U);     \
+       assert(*(ptr) == 10);                   \
+       atomic_add(ptr, -11UL);                 \
+       assert(*(ptr) == (__typeof__(*(ptr)))-1UL);     \
+       v = cmpxchg(ptr, -1UL, 22);             \
+       assert(*(ptr) == 22);                   \
+       assert(v == (__typeof__(*(ptr)))-1UL);  \
        v = cmpxchg(ptr, 33, 44);               \
-       assert(*ptr == 22);                     \
+       assert(*(ptr) == 22);                   \
        assert(v == 22);                        \
        v = xchg(ptr, 55);                      \
-       assert(*ptr == 55);                     \
+       assert(*(ptr) == 55);                   \
        assert(v == 22);                        \
 } while (0)
 
This page took 0.034894 seconds and 4 git commands to generate.