From patchwork Mon Mar 15 16:16:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Munch X-Patchwork-Id: 47764 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 95F90B7D7D for ; Tue, 16 Mar 2010 03:18:07 +1100 (EST) Received: from localhost ([127.0.0.1]:58655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrCzT-0004le-Nn for incoming@patchwork.ozlabs.org; Mon, 15 Mar 2010 12:18:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrCyL-0004Xi-Ml for qemu-devel@nongnu.org; Mon, 15 Mar 2010 12:16:53 -0400 Received: from [199.232.76.173] (port=48833 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrCyL-0004XH-9Y for qemu-devel@nongnu.org; Mon, 15 Mar 2010 12:16:53 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrCyK-0001YD-1m for qemu-devel@nongnu.org; Mon, 15 Mar 2010 12:16:53 -0400 Received: from pasmtpa.tele.dk ([80.160.77.114]:44996) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NrCyJ-0001Xo-KV for qemu-devel@nongnu.org; Mon, 15 Mar 2010 12:16:51 -0400 Received: from firewall (0x535c82dc.virnxx18.dynamic.dsl.tele.dk [83.92.130.220]) by pasmtpA.tele.dk (Postfix) with ESMTP id 9619F8004B2; Mon, 15 Mar 2010 17:16:49 +0100 (CET) Received: by firewall (Postfix, from userid 1000) id 73B2C3E8E; Mon, 15 Mar 2010 17:16:49 +0100 (CET) Date: Mon, 15 Mar 2010 17:16:49 +0100 From: Lars Munch To: Paul Brook Subject: Re: [Qemu-devel] [PATCH] linux-user: use arm features based on cpu model Message-ID: <20100315161649.GE8895@firewall> References: <20100315121732.GA8895@firewall> <201003151226.27621.paul@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201003151226.27621.paul@codesourcery.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: qemu-devel@nongnu.org X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Mon, Mar 15, 2010 at 12:26:27PM +0000, Paul Brook wrote: > > +static uint32_t get_elf_hwcap(void) > > +{ > > + return thread_env->features; > > +} > > No. These values are not the same. > > Paul > Yes, these values are indeed not the same. Below is an updated patch with a function similar to the PPC get_elf_hwcap function. I am unsure if I have too many or too few features as I do not know the details on all the capability flags, so comments are more than welcome. Signed-off-by: Lars Munch --- linux-user/elfload.c | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 91eea62..6364176 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -333,10 +333,26 @@ enum ARM_HWCAP_ARM_VFPv3D16 = 1 << 13, }; -#define ELF_HWCAP (ARM_HWCAP_ARM_SWP | ARM_HWCAP_ARM_HALF \ - | ARM_HWCAP_ARM_THUMB | ARM_HWCAP_ARM_FAST_MULT \ - | ARM_HWCAP_ARM_FPA | ARM_HWCAP_ARM_VFP \ - | ARM_HWCAP_ARM_NEON | ARM_HWCAP_ARM_VFPv3 ) +#define ELF_HWCAP get_elf_hwcap() + +static uint32_t get_elf_hwcap(void) +{ + CPUARMState *e = thread_env; + uint32_t features = ARM_HWCAP_ARM_SWP | ARM_HWCAP_ARM_HALF + | ARM_HWCAP_ARM_THUMB | ARM_HWCAP_ARM_FAST_MULT + | ARM_HWCAP_ARM_FPA; + +#define GET_FEATURE(flag, feature) \ + do {if (e->features & flag) features |= feature; } while(0) + GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP); + GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT); + GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON); + GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3); + GET_FEATURE(ARM_FEATURE_VFP_FP16, ARM_HWCAP_ARM_VFPv3D16); +#undef GET_FEATURE + + return features; +} #endif