From patchwork Sat May 8 16:58:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Munch X-Patchwork-Id: 51971 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 D76FAB7D5D for ; Sun, 9 May 2010 03:00:23 +1000 (EST) Received: from localhost ([127.0.0.1]:47170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAnO0-0007WN-Ud for incoming@patchwork.ozlabs.org; Sat, 08 May 2010 13:00:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAnMv-0007Pf-Uf for qemu-devel@nongnu.org; Sat, 08 May 2010 12:59:14 -0400 Received: from [140.186.70.92] (port=34310 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAnMt-0007NA-Sm for qemu-devel@nongnu.org; Sat, 08 May 2010 12:59:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAnMr-0007zr-1M for qemu-devel@nongnu.org; Sat, 08 May 2010 12:59:10 -0400 Received: from mail-ew0-f227.google.com ([209.85.219.227]:63939) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAnMq-0007zn-Qd for qemu-devel@nongnu.org; Sat, 08 May 2010 12:59:08 -0400 Received: by ewy27 with SMTP id 27so499289ewy.10 for ; Sat, 08 May 2010 09:59:07 -0700 (PDT) Received: by 10.213.51.78 with SMTP id c14mr706912ebg.89.1273337947583; Sat, 08 May 2010 09:59:07 -0700 (PDT) Received: from localhost.localdomain (0x535c82dc.virnxx18.dynamic.dsl.tele.dk [83.92.130.220]) by mx.google.com with ESMTPS id 15sm1669935ewy.12.2010.05.08.09.59.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 08 May 2010 09:59:06 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id CBC0AD472A; Sat, 8 May 2010 18:58:56 +0200 (CEST) From: Lars Munch To: qemu-devel@nongnu.org Date: Sat, 8 May 2010 18:58:55 +0200 Message-Id: <1273337935-20387-1-git-send-email-lars@segv.dk> X-Mailer: git-send-email 1.7.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Lars Munch Subject: [Qemu-devel] [PATCH v2] linux-user: use arm features based on cpu model 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 Use arm features based on cpu model. The hardcoded feature list gave problems in the setjmp/longjmp functions of glibc since it tried to use VFP instructions even though I specified a pxa270 as cpu model. This is similar to the PPC get_elf_hwcap function. 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 4ef77bc..1797c79 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) +{ + CPUState *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