|
Mark Wielaard |
b37f03 |
From bfa89eae00ba7067445bc0532e1f17405c062954 Mon Sep 17 00:00:00 2001
|
|
Mark Wielaard |
b37f03 |
From: Andreas Arnez <arnez@linux.ibm.com>
|
|
Mark Wielaard |
b37f03 |
Date: Thu, 23 May 2019 17:17:43 +0200
|
|
Mark Wielaard |
b37f03 |
Subject: [PATCH] Bug 407764 - s390x: drd fails on z13 due to function wrapping
|
|
Mark Wielaard |
b37f03 |
issue
|
|
Mark Wielaard |
b37f03 |
|
|
Mark Wielaard |
b37f03 |
The s390x-specific inline assembly macros for function wrapping in
|
|
Mark Wielaard |
b37f03 |
include/valgrind.h have a few issues.
|
|
Mark Wielaard |
b37f03 |
|
|
Mark Wielaard |
b37f03 |
When the compiler uses vector registers, such as with "-march=z13", all
|
|
Mark Wielaard |
b37f03 |
vector registers must be declared as clobbered by the callee. Because
|
|
Mark Wielaard |
b37f03 |
this is missing, many drd test failures are seen with "-march=z13".
|
|
Mark Wielaard |
b37f03 |
|
|
Mark Wielaard |
b37f03 |
Also, the inline assemblies write the return value into the target
|
|
Mark Wielaard |
b37f03 |
register before restoring r11. If r11 is used as the target register,
|
|
Mark Wielaard |
b37f03 |
this means that the restore operation corrupts the result. This bug
|
|
Mark Wielaard |
b37f03 |
causes failures with memcheck's "wrap6" test case.
|
|
Mark Wielaard |
b37f03 |
|
|
Mark Wielaard |
b37f03 |
These bugs are fixed. The clobber list is extended by the vector
|
|
Mark Wielaard |
b37f03 |
registers (if appropriate), and the target register is now written at the
|
|
Mark Wielaard |
b37f03 |
end, after restoring r11.
|
|
Mark Wielaard |
b37f03 |
---
|
|
Mark Wielaard |
b37f03 |
include/valgrind.h | 38 +++++++++++++++++++++++---------------
|
|
Mark Wielaard |
b37f03 |
1 file changed, 23 insertions(+), 15 deletions(-)
|
|
Mark Wielaard |
b37f03 |
|
|
Mark Wielaard |
b37f03 |
diff --git a/include/valgrind.h b/include/valgrind.h
|
|
Mark Wielaard |
b37f03 |
index f071bd392..815efa893 100644
|
|
Mark Wielaard |
b37f03 |
--- a/include/valgrind.h
|
|
Mark Wielaard |
b37f03 |
+++ b/include/valgrind.h
|
|
Mark Wielaard |
b37f03 |
@@ -4687,8 +4687,16 @@ typedef
|
|
Mark Wielaard |
b37f03 |
r14 in s390_irgen_noredir (VEX/priv/guest_s390_irgen.c) to give the
|
|
Mark Wielaard |
b37f03 |
function a proper return address. All others are ABI defined call
|
|
Mark Wielaard |
b37f03 |
clobbers. */
|
|
Mark Wielaard |
b37f03 |
-#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
|
|
Mark Wielaard |
b37f03 |
- "f0","f1","f2","f3","f4","f5","f6","f7"
|
|
Mark Wielaard |
b37f03 |
+#if defined(__VX__) || defined(__S390_VX__)
|
|
Mark Wielaard |
b37f03 |
+#define __CALLER_SAVED_REGS "0", "1", "2", "3", "4", "5", "14", \
|
|
Mark Wielaard |
b37f03 |
+ "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", \
|
|
Mark Wielaard |
b37f03 |
+ "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", \
|
|
Mark Wielaard |
b37f03 |
+ "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", \
|
|
Mark Wielaard |
b37f03 |
+ "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
|
|
Mark Wielaard |
b37f03 |
+#else
|
|
Mark Wielaard |
b37f03 |
+#define __CALLER_SAVED_REGS "0", "1", "2", "3", "4", "5", "14", \
|
|
Mark Wielaard |
b37f03 |
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7"
|
|
Mark Wielaard |
b37f03 |
+#endif
|
|
Mark Wielaard |
b37f03 |
|
|
Mark Wielaard |
b37f03 |
/* Nb: Although r11 is modified in the asm snippets below (inside
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for
|
|
Mark Wielaard |
b37f03 |
@@ -4710,9 +4718,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"aghi 15,-160\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" /* target->r1 */ \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,160\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "d" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4734,9 +4742,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"lg 2, 8(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,160\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4759,9 +4767,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"lg 3,16(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,160\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4786,9 +4794,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"lg 4,24(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,160\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4815,9 +4823,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"lg 5,32(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,160\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4846,9 +4854,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"lg 6,40(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,160\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4880,9 +4888,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"mvc 160(8,15), 48(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,168\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4916,9 +4924,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"mvc 168(8,15), 56(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,176\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4954,9 +4962,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"mvc 176(8,15), 64(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,184\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
|
|
Mark Wielaard |
b37f03 |
@@ -4994,9 +5002,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"mvc 184(8,15), 72(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,192\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
|
|
Mark Wielaard |
b37f03 |
@@ -5036,9 +5044,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"mvc 192(8,15), 80(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,200\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
|
|
Mark Wielaard |
b37f03 |
@@ -5080,9 +5088,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"mvc 200(8,15), 88(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,208\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
|
|
Mark Wielaard |
b37f03 |
@@ -5126,9 +5134,9 @@ typedef
|
|
Mark Wielaard |
b37f03 |
"mvc 208(8,15), 96(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
"lg 1, 0(1)\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CALL_NOREDIR_R1 \
|
|
Mark Wielaard |
b37f03 |
- "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
"aghi 15,216\n\t" \
|
|
Mark Wielaard |
b37f03 |
VALGRIND_CFI_EPILOGUE \
|
|
Mark Wielaard |
b37f03 |
+ "lgr %0, 2\n\t" \
|
|
Mark Wielaard |
b37f03 |
: /*out*/ "=d" (_res) \
|
|
Mark Wielaard |
b37f03 |
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
|
|
Mark Wielaard |
b37f03 |
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
|
|
Mark Wielaard |
b37f03 |
--
|
|
Mark Wielaard |
b37f03 |
2.17.0
|
|
Mark Wielaard |
b37f03 |
|