qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: <meadori@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Meador Inge <meadori@codesourcery.com>
Subject: [Qemu-devel] [PATCH 2/2] target-arm: Add "anyvfp" CPU
Date: Mon, 6 Jul 2015 11:53:52 -0700	[thread overview]
Message-ID: <1436208832-17651-3-git-send-email-meadori@codesourcery.com> (raw)
In-Reply-To: <1436208832-17651-1-git-send-email-meadori@codesourcery.com>

From: Meador Inge <meadori@codesourcery.com>

This patch adds support for `-cpu anyvfp`, which is just
like `-cpu any`, but enables the coprocessors by default.
This is useful for working with a wide range of bare-metal
C/C++ applications that have been compiled in different
ways and assume the coprocessor has been enabled already.

Original patch by Daniel Jacobowitz.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
---
 target-arm/cpu.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 3665f6b..2a00e73 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -181,7 +181,14 @@ static void arm_cpu_reset(CPUState *s)
         env->regs[15] = 0xFFFF0000;
     }
 
-    env->vfp.xregs[ARM_VFP_FPEXC] = 0;
+    /* For -cpu anyvfp, enable coprocessors by default.  Useful for
+       testing code that expects something else to turn on the
+       coprocessor.  */
+    if (cpu->midr == 0xfffffffe) {
+        env->vfp.xregs[ARM_VFP_FPEXC] = 1 << 30;
+    } else {
+        env->vfp.xregs[ARM_VFP_FPEXC] = 0;
+    }
 #endif
     set_flush_to_zero(1, &env->vfp.standard_fp_status);
     set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status);
@@ -1258,6 +1265,13 @@ static void arm_any_initfn(Object *obj)
     cpu->midr = 0xffffffff;
 }
 
+static void arm_anyvfp_initfn(Object *obj)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+    arm_any_initfn(obj);
+    cpu->midr = 0xfffffffe;
+}
+
 #endif /* !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) */
 
 typedef struct ARMCPUInfo {
@@ -1304,6 +1318,7 @@ static const ARMCPUInfo arm_cpus[] = {
     { .name = "pxa270-c0",   .initfn = pxa270c0_initfn },
     { .name = "pxa270-c5",   .initfn = pxa270c5_initfn },
     { .name = "any",         .initfn = arm_any_initfn },
+    { .name = "anyvfp",      .initfn = arm_anyvfp_initfn },
 #endif
     { .name = NULL }
 };
-- 
1.8.1.1

  parent reply	other threads:[~2015-07-06 18:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 18:53 [Qemu-devel] [PATCH 0/2] target-arm: "any" CPUs for system-mode meadori
2015-07-06 18:53 ` [Qemu-devel] [PATCH 1/2] target-arm: Allow CPU "any" for system-mode emulation meadori
2015-07-06 21:51   ` Peter Crosthwaite
2015-07-06 18:53 ` meadori [this message]
2015-07-06 22:00   ` [Qemu-devel] [PATCH 2/2] target-arm: Add "anyvfp" CPU Peter Crosthwaite
2015-07-13 20:21     ` Meador Inge
2015-07-13 21:32       ` Peter Crosthwaite
2015-07-06 22:31   ` Peter Maydell
2015-07-13 20:36     ` Meador Inge
2015-07-06 22:29 ` [Qemu-devel] [PATCH 0/2] target-arm: "any" CPUs for system-mode Peter Maydell
2015-07-06 22:42   ` Peter Crosthwaite
2015-07-06 22:49     ` Peter Maydell
2015-07-06 23:05       ` Peter Crosthwaite
2015-07-13 20:34         ` Meador Inge

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=1436208832-17651-3-git-send-email-meadori@codesourcery.com \
    --to=meadori@codesourcery.com \
    --cc=peter.maydell@linaro.org \
    --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).