s390 uatomic arch fix
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 7 Dec 2009 03:26:23 +0000 (22:26 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 7 Dec 2009 03:26:23 +0000 (22:26 -0500)
    In file included from urcu-static.h:40,
                     from urcu.c:35:
    ./urcu/uatomic_arch.h: In function ‘_uatomic_exchange’:
    ./urcu/uatomic_arch.h:88: warning: dereferencing ‘void *’ pointer
    ./urcu/uatomic_arch.h:89: warning: dereferencing ‘void *’ pointer
    ./urcu/uatomic_arch.h:89: error: expected ‘:’ or ‘)’ before ‘(’ token
    ./urcu/uatomic_arch.h: In function ‘_uatomic_cmpxchg’:
    ./urcu/uatomic_arch.h:131: warning: dereferencing ‘void *’ pointer
    ./urcu/uatomic_arch.h:132: warning: dereferencing ‘void *’ pointer
    ./urcu/uatomic_arch.h:132: error: expected ‘:’ or ‘)’ before ‘(’ token

Use same hidden pointer technique used for x86.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu/uatomic_arch_s390.h

index c4ca056fe078b5e3a57bcae3db93e3bee6bc3d44..ab7e9427613cc4f2926e3f4f0cfa98b5007152ef 100644 (file)
 
 #endif /* !COMPILER_HAVE_SHORT_MEM_OPERAND */
 
+struct __uatomic_dummy {
+       unsigned long v[10];
+};
+#define __hp(x)        ((struct __uatomic_dummy *)(x))
+
 #define uatomic_set(addr, v)   STORE_SHARED(*(addr), (v))
 #define uatomic_read(addr)     LOAD_SHARED(*(addr))
 
@@ -85,8 +90,8 @@ unsigned long _uatomic_exchange(volatile void *addr, unsigned long val, int len)
                __asm__ __volatile__(
                        "0:     cs %0,%2," MEMOP_REF(%3) "\n"
                        "       brc 4,0b\n"
-                       : "=&r" (old_val), MEMOP_OUT (addr)
-                       : "r" (val), MEMOP_IN (addr)
+                       : "=&r" (old_val), MEMOP_OUT (__hp(addr))
+                       : "r" (val), MEMOP_IN (__hp(addr))
                        : "memory", "cc");
                return old_val;
        }
@@ -98,8 +103,8 @@ unsigned long _uatomic_exchange(volatile void *addr, unsigned long val, int len)
                __asm__ __volatile__(
                        "0:     csg %0,%2," MEMOP_REF(%3) "\n"
                        "       brc 4,0b\n"
-                       : "=&r" (old_val), MEMOP_OUT (addr)
-                       : "r" (val), MEMOP_IN (addr)
+                       : "=&r" (old_val), MEMOP_OUT (__hp(addr))
+                       : "r" (val), MEMOP_IN (__hp(addr))
                        : "memory", "cc");
                return old_val;
        }
@@ -128,8 +133,8 @@ unsigned long _uatomic_cmpxchg(void *addr, unsigned long old,
 
                __asm__ __volatile__(
                        "       cs %0,%2," MEMOP_REF(%3) "\n"
-                       : "+r" (old_val), MEMOP_OUT (addr)
-                       : "r" (_new), MEMOP_IN (addr)
+                       : "+r" (old_val), MEMOP_OUT (__hp(addr))
+                       : "r" (_new), MEMOP_IN (__hp(addr))
                        : "memory", "cc");
                return old_val;
        }
@@ -138,8 +143,8 @@ unsigned long _uatomic_cmpxchg(void *addr, unsigned long old,
        {
                __asm__ __volatile__(
                        "       csg %0,%2," MEMOP_REF(%3) "\n"
-                       : "+r" (old), MEMOP_OUT (addr)
-                       : "r" (_new), MEMOP_IN (addr)
+                       : "+r" (old), MEMOP_OUT (__hp(addr))
+                       : "r" (_new), MEMOP_IN (__hp(addr))
                        : "memory", "cc");
                return old;
        }
This page took 0.029496 seconds and 4 git commands to generate.