From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24439 invoked by alias); 10 Jul 2008 13:18:02 -0000 Received: (qmail 24386 invoked by uid 22791); 10 Jul 2008 13:18:01 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 Jul 2008 13:17:34 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m6ADHWhh008266; Thu, 10 Jul 2008 09:17:32 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m6ADHV5D010287; Thu, 10 Jul 2008 09:17:31 -0400 Received: from dhcp-10-15-16-109.yyz.redhat.com (dhcp-10-15-16-109.yyz.redhat.com [10.15.16.109]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m6ADHUhO023050; Thu, 10 Jul 2008 09:17:30 -0400 Message-ID: <48760BE5.2080406@redhat.com> Date: Thu, 10 Jul 2008 14:10:00 -0000 From: Andrew Haley User-Agent: Thunderbird 2.0.0.14 (X11/20080421) MIME-Version: 1.0 To: Helge Deller CC: gcc-patches@gcc.gnu.org Subject: Re: [PATCH, ARM] Atomic builtins using kernel helpers for Linux/EABI References: <20080701174632.0b53565a@boris.athome> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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: 2008-07/txt/msg00793.txt.bz2 Helge Deller wrote: > Julian Brown wrote: >> This patch implements the atomic builtins described at: >> >> http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Atomic-Builtins.html >> >> for ARM EABI Linux. This implementation uses the kernel helpers >> __kernel_cmpxchg and __kernel_dmb, and so should work on any >> architecture which supports those. (More-efficient versions are possible >> using ldrex/strex on architectures >=v6, but those are not written yet.) >> >> Atomic operations are provided for data sizes of 1, 2 and 4 bytes (but >> not 8 bytes). The implementation uses actual functions >> (__sync_fetch_and_add_2, etc.) rather than expanding code inline. >> >> Tested with cross to arm-none-linux-gnueabi, and with some additional >> hand-written tests which hopefully exercised the atomicity of the >> operations sufficiently. > > Hi Julian, > > I like the code, since I was just about to put something similar together > for the atomic builtins for the hppa/parisc architecture. > > Basically I think I would be able to reuse all of your code, with only two > exceptions: > a) __kernel_cmpxchg() and __kernel_dmb() are different for hppa > b) You use "#ifdef __ARMEL__" to differentiate the endianess. Needs changing > to a generic solution. > > But else, everything seems usable. > So, why not finding a way to share the code for various architectures? I'm > sure not only ARMEL and HPPA would need this? Hmm. This could turn into a horrible mess of #ifdefs for the various architectures. Andrew.