qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lars Munch <lars@segv.dk>
To: Paul Brook <paul@codesourcery.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] linux-user: use arm features based on cpu model
Date: Mon, 15 Mar 2010 17:16:49 +0100	[thread overview]
Message-ID: <20100315161649.GE8895@firewall> (raw)
In-Reply-To: <201003151226.27621.paul@codesourcery.com>

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 <lars@segv.dk>
---
 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
 
-- 
1.7.0

      reply	other threads:[~2010-03-15 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-15 12:17 [Qemu-devel] [PATCH] linux-user: use arm features based on cpu model Lars Munch
2010-03-15 12:26 ` Paul Brook
2010-03-15 16:16   ` Lars Munch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100315161649.GE8895@firewall \
    --to=lars@segv.dk \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).