Commit 9c94ed96 authored by Michael Holzheu's avatar Michael Holzheu Committed by Pavel Emelyanov

s390/zdtm: Also support z900 (debian)

Debian is compiled for z900 - therefore we can't use the "laa"
instruction.

Fix this and replace "laa" by the older "cs" (compare and swap) loop.
Signed-off-by: 's avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent a04dc883
...@@ -5,24 +5,26 @@ ...@@ -5,24 +5,26 @@
typedef uint32_t atomic_t; typedef uint32_t atomic_t;
#define __ATOMIC_OP(op_name, op_type, op_string, op_barrier) \ #define __ATOMIC_OP(op_name, op_type, op_string) \
static inline op_type op_name(op_type val, op_type *ptr) \ static inline op_type op_name(op_type val, op_type *ptr) \
{ \ { \
op_type old; \ op_type old, new; \
\ \
asm volatile( \ asm volatile( \
op_string " %[old],%[val],%[ptr]\n" \ "0: lr %[new],%[old]\n" \
op_barrier \ op_string " %[new],%[val]\n" \
: [old] "=d" (old), [ptr] "+Q" (*ptr) \ " cs %[old],%[new],%[ptr]\n" \
: [val] "d" (val) : "cc", "memory"); \ " jl 0b" \
: [old] "=d" (old), [new] "=&d" (new), [ptr] "+Q" (*ptr)\
: [val] "d" (val), "0" (*ptr) : "cc", "memory"); \
return old; \ return old; \
} \ }
#define __ATOMIC_OPS(op_name, op_type, op_string) \ #define __ATOMIC_OPS(op_name, op_type, op_string) \
__ATOMIC_OP(op_name, op_type, op_string, "\n") \ __ATOMIC_OP(op_name, op_type, op_string) \
__ATOMIC_OP(op_name##_barrier, op_type, op_string, "bcr 14,0\n") __ATOMIC_OP(op_name##_barrier, op_type, op_string)
__ATOMIC_OPS(__atomic_add, uint32_t, "laa") __ATOMIC_OPS(__atomic_add, uint32_t, "ar")
#undef __ATOMIC_OPS #undef __ATOMIC_OPS
#undef __ATOMIC_OP #undef __ATOMIC_OP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment