X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Fuatomic_arch_s390.h;h=75025b1e7699e9498ee2653737ce1511509f8d87;hp=813d9708a8efff783938a24c3e55987c64042436;hb=3d02c34dba0edc4a3554a3862a2ae96d77b3b4e8;hpb=36bc70a84250927ba68d5096a0a9740aec157f9b diff --git a/urcu/uatomic_arch_s390.h b/urcu/uatomic_arch_s390.h index 813d970..75025b1 100644 --- a/urcu/uatomic_arch_s390.h +++ b/urcu/uatomic_arch_s390.h @@ -8,7 +8,7 @@ * * Copyright (c) 2009 Novell, Inc. * Author: Jan Blunck - * Copyright (c) 2009 Mathieu Desnoyers + * Copyright (c) 2009 Mathieu Desnoyers * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -36,18 +36,6 @@ extern "C" { #endif -#ifndef __SIZEOF_LONG__ -#ifdef __s390x__ -#define __SIZEOF_LONG__ 8 -#else -#define __SIZEOF_LONG__ 4 -#endif -#endif - -#ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#endif - #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) #define COMPILER_HAVE_SHORT_MEM_OPERAND #endif @@ -62,13 +50,13 @@ extern "C" { #ifdef COMPILER_HAVE_SHORT_MEM_OPERAND #define MEMOP_OUT(addr) "=Q" (*(addr)) -#define MEMOP_IN "Q" (*(addr)) +#define MEMOP_IN(addr) "Q" (*(addr)) #define MEMOP_REF(op) #op /* op refer to MEMOP_IN operand */ #else /* !COMPILER_HAVE_SHORT_MEM_OPERAND */ #define MEMOP_OUT(addr) "=m" (*(addr)) -#define MEMOP_IN "a" (addr), "m" (*(addr)) +#define MEMOP_IN(addr) "a" (addr), "m" (*(addr)) #define MEMOP_REF(op) "0(" #op ")" /* op refer to MEMOP_IN operand */ #endif /* !COMPILER_HAVE_SHORT_MEM_OPERAND */ @@ -78,9 +66,6 @@ struct __uatomic_dummy { }; #define __hp(x) ((struct __uatomic_dummy *)(x)) -#define uatomic_set(addr, v) STORE_SHARED(*(addr), (v)) -#define uatomic_read(addr) LOAD_SHARED(*(addr)) - /* xchg */ static inline __attribute__((always_inline)) @@ -166,62 +151,10 @@ unsigned long _uatomic_cmpxchg(void *addr, unsigned long old, (unsigned long)(_new), \ sizeof(*(addr))) -/* uatomic_add_return */ - -static inline __attribute__((always_inline)) -unsigned long _uatomic_add_return(void *addr, unsigned long val, int len) -{ - switch (len) { - case 4: - { - unsigned int old, oldt; - - oldt = uatomic_read((unsigned int *)addr); - do { - old = oldt; - oldt = _uatomic_cmpxchg(addr, old, old + val, 4); - } while (oldt != old); - - return old + val; - } -#if (BITS_PER_LONG == 64) - case 8: - { - unsigned long old, oldt; - - oldt = uatomic_read((unsigned long *)addr); - do { - old = oldt; - oldt = _uatomic_cmpxchg(addr, old, old + val, 8); - } while (oldt != old); - - return old + val; - } -#endif - } - __builtin_trap(); - return 0; -} - -#define uatomic_add_return(addr, v) \ - ((__typeof__(*(addr))) _uatomic_add_return((addr), \ - (unsigned long)(v), \ - sizeof(*(addr)))) - -/* uatomic_sub_return, uatomic_add, uatomic_sub, uatomic_inc, uatomic_dec */ - -#define uatomic_sub_return(addr, v) uatomic_add_return((addr), -(v)) - -#define uatomic_add(addr, v) (void)uatomic_add_return((addr), (v)) -#define uatomic_sub(addr, v) (void)uatomic_sub_return((addr), (v)) - -#define uatomic_inc(addr) uatomic_add((addr), 1) -#define uatomic_dec(addr) uatomic_add((addr), -1) - -#define compat_uatomic_cmpxchg(ptr, old, _new) uatomic_cmpxchg(ptr, old, _new) - #ifdef __cplusplus } #endif +#include + #endif /* _URCU_UATOMIC_ARCH_S390_H */