git: d75884df7812 - main - ck: Correct asm output operand widths in amd64 pointer intrinsics
Mark Johnston
markj at FreeBSD.org
Wed Aug 11 01:31:14 UTC 2021
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=d75884df7812d7331d4ba0a37c7d391f080a9988
commit d75884df7812d7331d4ba0a37c7d391f080a9988
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-08-10 21:23:49 +0000
Commit: Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-08-11 01:27:54 +0000
ck: Correct asm output operand widths in amd64 pointer intrinsics
This does not appear to change generated code with the default
toolchain. However, KMSAN makes use of output operand specifications to
instrument inline asm, and with incorrect specifications we get false
positives in code that uses the CK_(S)LIST macros.
This was submitted upstream:
https://github.com/concurrencykit/ck/pull/175
The commit applies the same change locally to make KMSAN usable until
something equivalent is merged upstream.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
---
sys/contrib/ck/include/gcc/x86_64/ck_pr.h | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/sys/contrib/ck/include/gcc/x86_64/ck_pr.h b/sys/contrib/ck/include/gcc/x86_64/ck_pr.h
index fb2804e8d8e5..3b80d1dc1d54 100644
--- a/sys/contrib/ck/include/gcc/x86_64/ck_pr.h
+++ b/sys/contrib/ck/include/gcc/x86_64/ck_pr.h
@@ -149,7 +149,7 @@ ck_pr_rfo(const void *m)
return v; \
}
-CK_PR_FAS(ptr, void, void *, char, "xchgq")
+CK_PR_FAS(ptr, void, void *, uint64_t, "xchgq")
#define CK_PR_FAS_S(S, T, I) CK_PR_FAS(S, T, T, T, I)
@@ -182,7 +182,7 @@ CK_PR_FAS_S(8, uint8_t, "xchgb")
return (r); \
}
-CK_PR_LOAD(ptr, void, void *, char, "movq")
+CK_PR_LOAD(ptr, void, void *, uint64_t, "movq")
#define CK_PR_LOAD_S(S, T, I) CK_PR_LOAD(S, T, T, T, I)
@@ -264,7 +264,7 @@ CK_PR_LOAD_2(8, 16, uint8_t)
return; \
}
-CK_PR_STORE_IMM(ptr, void, const void *, char, "movq", CK_CC_IMM_U32)
+CK_PR_STORE_IMM(ptr, void, const void *, uint64_t, "movq", CK_CC_IMM_U32)
#ifndef CK_PR_DISABLE_DOUBLE
CK_PR_STORE(double, double, double, double, "movq")
#endif
@@ -298,7 +298,7 @@ CK_PR_STORE_S(8, uint8_t, "movb", CK_CC_IMM_U32)
return (d); \
}
-CK_PR_FAA(ptr, void, uintptr_t, char, "xaddq")
+CK_PR_FAA(ptr, void, uintptr_t, uint64_t, "xaddq")
#define CK_PR_FAA_S(S, T, I) CK_PR_FAA(S, T, T, T, I)
@@ -347,7 +347,7 @@ CK_PR_FAA_S(8, uint8_t, "xaddb")
#define CK_PR_UNARY_S(K, S, T, I) CK_PR_UNARY(K, S, T, T, I)
#define CK_PR_GENERATE(K) \
- CK_PR_UNARY(K, ptr, void, char, #K "q") \
+ CK_PR_UNARY(K, ptr, void, uint64_t, #K "q") \
CK_PR_UNARY_S(K, char, char, #K "b") \
CK_PR_UNARY_S(K, int, int, #K "l") \
CK_PR_UNARY_S(K, uint, unsigned int, #K "l") \
@@ -388,7 +388,7 @@ CK_PR_GENERATE(not)
#define CK_PR_BINARY_S(K, S, T, I, O) CK_PR_BINARY(K, S, T, T, T, I, O)
#define CK_PR_GENERATE(K) \
- CK_PR_BINARY(K, ptr, void, uintptr_t, char, #K "q", CK_CC_IMM_U32) \
+ CK_PR_BINARY(K, ptr, void, uintptr_t, uint64_t, #K "q", CK_CC_IMM_U32) \
CK_PR_BINARY_S(K, char, char, #K "b", CK_CC_IMM_S32) \
CK_PR_BINARY_S(K, int, int, #K "l", CK_CC_IMM_S32) \
CK_PR_BINARY_S(K, uint, unsigned int, #K "l", CK_CC_IMM_U32) \
@@ -424,7 +424,7 @@ CK_PR_GENERATE(xor)
return z; \
}
-CK_PR_CAS(ptr, void, void *, char, "cmpxchgq")
+CK_PR_CAS(ptr, void, void *, uint64_t, "cmpxchgq")
#define CK_PR_CAS_S(S, T, I) CK_PR_CAS(S, T, T, T, I)
@@ -462,7 +462,7 @@ CK_PR_CAS_S(8, uint8_t, "cmpxchgb")
return z; \
}
-CK_PR_CAS_O(ptr, void, void *, char, "q", "rax")
+CK_PR_CAS_O(ptr, void, void *, uint64_t, "q", "rax")
#define CK_PR_CAS_O_S(S, T, I, R) \
CK_PR_CAS_O(S, T, T, T, I, R)
@@ -587,12 +587,12 @@ CK_PR_CAS_V(8, 16, uint8_t)
#define CK_PR_BT_S(K, S, T, I) CK_PR_BT(K, S, T, T, T, I)
-#define CK_PR_GENERATE(K) \
- CK_PR_BT(K, ptr, void, uint64_t, char, #K "q %2, %0") \
- CK_PR_BT_S(K, uint, unsigned int, #K "l %2, %0") \
- CK_PR_BT_S(K, int, int, #K "l %2, %0") \
- CK_PR_BT_S(K, 64, uint64_t, #K "q %2, %0") \
- CK_PR_BT_S(K, 32, uint32_t, #K "l %2, %0") \
+#define CK_PR_GENERATE(K) \
+ CK_PR_BT(K, ptr, void, uint64_t, uint64_t, #K "q %2, %0") \
+ CK_PR_BT_S(K, uint, unsigned int, #K "l %2, %0") \
+ CK_PR_BT_S(K, int, int, #K "l %2, %0") \
+ CK_PR_BT_S(K, 64, uint64_t, #K "q %2, %0") \
+ CK_PR_BT_S(K, 32, uint32_t, #K "l %2, %0") \
CK_PR_BT_S(K, 16, uint16_t, #K "w %w2, %0")
CK_PR_GENERATE(btc)
More information about the dev-commits-src-all
mailing list