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

Adrian Reber adrian at lisas.de
Wed Jun 13 15:12:30 MSK 2018


From: Adrian Reber <areber at 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 at arista.com>
Signed-off-by: Adrian Reber <areber at redhat.com>
---
 test/zdtm/lib/arch/aarch64/include/asm/atomic.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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");
 
-- 
1.8.3.1



More information about the CRIU mailing list