qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Aurelio C. Remonda" <aurelioremonda@gmail.com>
To: qemu-devel@nongnu.org, ilg@livius.net, peter.maydell@linaro.org,
	martin.galvan@tallertechnologies.com,
	daniel.gutson@tallertechnologies.com
Subject: [Qemu-devel] [PATCH V3] Target-arm: Add the Cortex-M4 CPU
Date: Mon, 15 Jun 2015 17:31:00 -0300	[thread overview]
Message-ID: <1434400260-5191-1-git-send-email-aurelioremonda@gmail.com> (raw)

This patch adds the Cortex-M4 CPU. The M4 is basically the same as the M3,
the main differences being the DSP instructions and an optional FPU.
Created an ARM_FEATURE_THUMB_DSP to be added to any non-M thumb2-compatible
CPU that uses DSP instructions, and manually added it to the M4 in its initfn.

Signed-off-by: Aurelio C. Remonda <aurelioremonda@gmail.com>
---
* Changes in V3: Add the ARM_FEATURE_THUMB_DSP in a separate patch and create 
just the CPU init on this one.
 target-arm/cpu.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 4a888ab..4950897 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -783,6 +783,21 @@ static void cortex_m3_initfn(Object *obj)
     cpu->midr = 0x410fc231;
 }
 
+static void cortex_m4_initfn(Object *obj)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+    set_feature(&cpu->env, ARM_FEATURE_V7);
+    set_feature(&cpu->env, ARM_FEATURE_M);
+    set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
+    cpu->midr = 0x410fc240;
+    /*main id register CPUID bit assignments
+    Bits    NAME        Function
+    [31:24] IMPLEMENTER Indicates implementor: 0x41 = ARM
+    [23:20] VARIANT     Indicates processor revision: 0x0 = Revision 0
+    [19:16] (Constant)  Reads as 0xF
+    [15:4]  PARTNO      Indicates part number: 0xC24 = Cortex-M4
+    [3:0]   REVISION    Indicates patch release: 0x0 = Patch 0.*/
+}
 static void arm_v7m_class_init(ObjectClass *oc, void *data)
 {
     CPUClass *cc = CPU_CLASS(oc);
@@ -1185,6 +1200,8 @@ static const ARMCPUInfo arm_cpus[] = {
     { .name = "arm11mpcore", .initfn = arm11mpcore_initfn },
     { .name = "cortex-m3",   .initfn = cortex_m3_initfn,
                              .class_init = arm_v7m_class_init },
+    { .name = "cortex-m4",   .initfn = cortex_m4_initfn,
+                             .class_init = arm_v7m_class_init },
     { .name = "cortex-a8",   .initfn = cortex_a8_initfn },
     { .name = "cortex-a9",   .initfn = cortex_a9_initfn },
     { .name = "cortex-a15",  .initfn = cortex_a15_initfn },
-- 
1.9.1

             reply	other threads:[~2015-06-15 20:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 20:31 Aurelio C. Remonda [this message]
2015-06-16 11:21 ` [Qemu-devel] [PATCH V3] Target-arm: Add the Cortex-M4 CPU Peter Maydell
2015-06-16 12:25   ` aurelio remonda
2015-06-16 12:29   ` Liviu Ionescu
2015-06-16 12:52     ` aurelio remonda
2015-06-16 12:59       ` Peter Maydell

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=1434400260-5191-1-git-send-email-aurelioremonda@gmail.com \
    --to=aurelioremonda@gmail.com \
    --cc=daniel.gutson@tallertechnologies.com \
    --cc=ilg@livius.net \
    --cc=martin.galvan@tallertechnologies.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).