+2018-06-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR libitm/85988
+ * config/linux/x86/tls.h (SEG_READ): Use the offset of
+ __private_tm as base.
+ (SEG_WRITE): Likewise.
+ (SEG_ENCODE_WRITE): Correct the offset of pointer_guard for x32.
+ (gtm_thr): Replace SEG_READ(10) with SEG_READ(0).
+ (set_gtm_thr): Replace SEG_WRITE(10) with SEG_WRITE(0).
+ (abi_disp): Replace SEG_DECODE_READ(11) with SEG_DECODE_READ(1).
+ (set_abi_disp): Replace SEG_ENCODE_WRITE(11) with
+
2018-05-17 Jason Merrill <jason@redhat.com>
* beginend.cc (save): Disable -Werror=deprecated-copy.
#ifdef __x86_64__
#ifdef __LP64__
-# define SEG_READ(OFS) "movq\t%%fs:(" #OFS "*8),%0"
-# define SEG_WRITE(OFS) "movq\t%0,%%fs:(" #OFS "*8)"
+# define SEG_READ(OFS) "movq\t%%fs:(80+" #OFS "*8),%0"
+# define SEG_WRITE(OFS) "movq\t%0,%%fs:(80+" #OFS "*8)"
# define SEG_DECODE_READ(OFS) SEG_READ(OFS) "\n\t" \
"rorq\t$17,%0\n\t" \
"xorq\t%%fs:48,%0"
SEG_WRITE(OFS)
#else
// For X32.
-# define SEG_READ(OFS) "movl\t%%fs:(" #OFS "*4),%0"
-# define SEG_WRITE(OFS) "movl\t%0,%%fs:(" #OFS "*4)"
+# define SEG_READ(OFS) "movl\t%%fs:(48+" #OFS "*4),%0"
+# define SEG_WRITE(OFS) "movl\t%0,%%fs:(48+" #OFS "*4)"
# define SEG_DECODE_READ(OFS) SEG_READ(OFS) "\n\t" \
"rorl\t$9,%0\n\t" \
- "xorl\t%%fs:24,%0"
-# define SEG_ENCODE_WRITE(OFS) "xorl\t%%fs:24,%0\n\t" \
+ "xorl\t%%fs:28,%0"
+# define SEG_ENCODE_WRITE(OFS) "xorl\t%%fs:28,%0\n\t" \
"roll\t$9,%0\n\t" \
SEG_WRITE(OFS)
#endif
#else
-# define SEG_READ(OFS) "movl\t%%gs:(" #OFS "*4),%0"
-# define SEG_WRITE(OFS) "movl\t%0,%%gs:(" #OFS "*4)"
+# define SEG_READ(OFS) "movl\t%%gs:(36+" #OFS "*4),%0"
+# define SEG_WRITE(OFS) "movl\t%0,%%gs:(36+" #OFS "*4)"
# define SEG_DECODE_READ(OFS) SEG_READ(OFS) "\n\t" \
"rorl\t$9,%0\n\t" \
"xorl\t%%gs:24,%0"
static inline struct gtm_thread *gtm_thr(void)
{
struct gtm_thread *r;
- asm volatile (SEG_READ(10) : "=r"(r));
+ asm volatile (SEG_READ(0) : "=r"(r));
return r;
}
static inline void set_gtm_thr(struct gtm_thread *x)
{
- asm volatile (SEG_WRITE(10) : : "r"(x));
+ asm volatile (SEG_WRITE(0) : : "r"(x));
}
static inline struct abi_dispatch *abi_disp(void)
{
struct abi_dispatch *r;
- asm volatile (SEG_DECODE_READ(11) : "=r"(r));
+ asm volatile (SEG_DECODE_READ(1) : "=r"(r));
return r;
}
static inline void set_abi_disp(struct abi_dispatch *x)
{
void *scratch;
- asm volatile (SEG_ENCODE_WRITE(11) : "=r"(scratch) : "0"(x));
+ asm volatile (SEG_ENCODE_WRITE(1) : "=r"(scratch) : "0"(x));
}
#undef SEG_READ