[2/2] zdtm: fix atomic_{sub, add}_return assembler for aarch64

Submitted by Adrian Reber on June 13, 2018, 12:12 p.m.

Details

Message ID 1528891950-25141-2-git-send-email-adrian@lisas.de
State Accepted
Series "Series without cover letter"
Headers show

Commit Message

Adrian Reber June 13, 2018, 12:12 p.m.
From: Adrian Reber <areber@redhat.com>

Running the test suite on aarch64 showed two tests failing (static/fd
and transition/maps0007). Debugging showed that the
atomic_{sub,add}_return() functions did not return the value but the
lower 32bit of the address of that value.

Simply dereferencing the input solves the two mentioned test cases.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
---
 test/zdtm/lib/arch/aarch64/include/asm/atomic.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/test/zdtm/lib/arch/aarch64/include/asm/atomic.h b/test/zdtm/lib/arch/aarch64/include/asm/atomic.h
index ccf08e7..ddf4ad9 100644
--- a/test/zdtm/lib/arch/aarch64/include/asm/atomic.h
+++ b/test/zdtm/lib/arch/aarch64/include/asm/atomic.h
@@ -33,7 +33,7 @@  static inline int atomic_add_return(int i, atomic_t *v)
 "	add	%w0, %w0, %w3\n"
 "	stlxr	%w1, %w0, %2\n"
 "	cbnz	%w1, 1b"
-	: "=&r" (result), "=&r" (tmp), "+Q" (v)
+	: "=&r" (result), "=&r" (tmp), "+Q" (*v)
 	: "Ir" (i)
 	: "cc", "memory");
 
@@ -51,7 +51,7 @@  static inline int atomic_sub_return(int i, atomic_t *v)
 "	sub	%w0, %w0, %w3\n"
 "	stlxr	%w1, %w0, %2\n"
 "	cbnz	%w1, 1b"
-	: "=&r" (result), "=&r" (tmp), "+Q" (v)
+	: "=&r" (result), "=&r" (tmp), "+Q" (*v)
 	: "Ir" (i)
 	: "cc", "memory");