From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21652 invoked by alias); 23 Aug 2011 12:33:44 -0000 Received: (qmail 21636 invoked by uid 22791); 23 Aug 2011 12:33:43 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_OV X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Aug 2011 12:33:21 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7NCXKxF018134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 23 Aug 2011 08:33:21 -0400 Received: from [10.36.7.111] (vpn1-7-111.ams2.redhat.com [10.36.7.111]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7NCXJqt013331; Tue, 23 Aug 2011 08:33:19 -0400 Subject: Re: [trans-mem] Use __x86_64__ instead of __LP64__. From: Torvald Riegel To: Richard Henderson Cc: GCC Patches , "H.J. Lu" In-Reply-To: <4E52CD44.4020609@redhat.com> References: <1314006155.3533.2576.camel@triegel.csb> <4E52CD44.4020609@redhat.com> Content-Type: multipart/mixed; boundary="=-sjLYeG87v60xhOown3po" Date: Tue, 23 Aug 2011 14:37:00 -0000 Message-ID: <1314102798.3533.3524.camel@triegel.csb> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg01887.txt.bz2 --=-sjLYeG87v60xhOown3po Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 488 On Mon, 2011-08-22 at 14:42 -0700, Richard Henderson wrote: > On 08/22/2011 02:42 AM, Torvald Riegel wrote: > > Use __x86_64__ instead of __LP64__ in setjmp/longjmp and TLS > > definitions. > > > > H.J.: Is that sufficient for x32, or do we need entirely different code? > > If so, can you please provide the required changes? > > The SJLJ part should be ok for x32. > > The TLS part needs to use a 32-bit load and "*4". Hmm, like in the attached patch? (I'm just guessing here ...!) --=-sjLYeG87v60xhOown3po Content-Disposition: attachment; filename="patch1" Content-Type: text/plain; name="patch1"; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-length: 2173 commit 3f10f6882e8dd19ca0f11a0f9d953aebe6027ead Author: Torvald Riegel Date: Mon Aug 22 11:21:03 2011 +0200 Use __x86_64__ instead of __LP64__. * config/x86/tls.h: Use __x86_64__ instead of __LP64__. Add X32 support. * config/x86/sjlj.S: Same. diff --git a/libitm/config/x86/sjlj.S b/libitm/config/x86/sjlj.S index 0e9c246..725ffec 100644 --- a/libitm/config/x86/sjlj.S +++ b/libitm/config/x86/sjlj.S @@ -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 . 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 diff --git a/libitm/config/x86/tls.h b/libitm/config/x86/tls.h index 03fdab2..3d247e3 100644 --- a/libitm/config/x86/tls.h +++ b/libitm/config/x86/tls.h @@ -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" \ --=-sjLYeG87v60xhOown3po--