@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Transactional Memory Library (libitm).
@@ -29,7 +29,7 @@
_ITM_beginTransaction:
.cfi_startproc
-#ifdef __LP64__
+#ifdef __x86_64__
leaq 8(%rsp), %rax
movq (%rsp), %r8
subq $72, %rsp
@@ -72,7 +72,7 @@ _ITM_beginTransaction:
GTM_longjmp:
.cfi_startproc
-#ifdef __LP64__
+#ifdef __x86_64__
movq (%rdi), %rcx
movq 8(%rdi), %rdx
movq 16(%rdi), %rbx
@@ -37,6 +37,7 @@
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
namespace GTM HIDDEN {
+#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)"
@@ -47,6 +48,17 @@ namespace GTM HIDDEN {
"rolq\t$17,%0\n\t" \
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_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" \
+ "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_DECODE_READ(OFS) SEG_READ(OFS) "\n\t" \