[PATCH] x86_64: Update THREAD_SETMEM/THREAD_SETMEM_NC for IMM64
H.J. Lu
hjl.tools@gmail.com
Tue Feb 2 19:12:09 GMT 2021
Since there is only "movq imm32s, mem64" and no "movq imm64, mem64", use
"movq reg64, mem64" to store 64-bit constant in TCB.
---
sysdeps/x86_64/nptl/tls.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h
index 20f0958780..9ec8703e45 100644
--- a/sysdeps/x86_64/nptl/tls.h
+++ b/sysdeps/x86_64/nptl/tls.h
@@ -269,6 +269,11 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
asm volatile ("movl %0,%%fs:%P1" : \
: IMM_MODE (value), \
"i" (offsetof (struct pthread, member))); \
+ else if (__builtin_constant_p (value) \
+ && (int64_t) (int32_t) (uintptr_t) value != (uintptr_t) value) \
+ asm volatile ("movq %0,%%fs:%P1" : \
+ : "r" (value), \
+ "i" (offsetof (struct pthread, member))); \
else /* 8 */ \
{ \
asm volatile ("movq %q0,%%fs:%P1" : \
@@ -294,6 +299,12 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
: IMM_MODE (value), \
"i" (offsetof (struct pthread, member[0])), \
"r" (idx)); \
+ else if (__builtin_constant_p (value) \
+ && (int64_t) (int32_t) (uintptr_t) value != (uintptr_t) value) \
+ asm volatile ("movq %0,%%fs:%P1(,%q2,8)" : \
+ : "r" (value), \
+ "i" (offsetof (struct pthread, member[0])), \
+ "r" (idx)); \
else /* 8 */ \
{ \
asm volatile ("movq %q0,%%fs:%P1(,%q2,8)" : \
--
2.29.2
More information about the Libc-alpha
mailing list