qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V4] Target-arm: Add the Cortex-M4 CPU
@ 2015-06-16 13:37 Aurelio C. Remonda
  2015-06-16 14:20 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Aurelio C. Remonda @ 2015-06-16 13:37 UTC (permalink / raw)
  To: qemu-devel, ilg, peter.maydell, martin.galvan, daniel.gutson

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. The THUMB_DSP feature was created in a different patch
along with the bit checking on each DSP instruction. Only no-FPU cortex-M4 is
implemented here, cortex-M4F is not because the core target-arm code doesn't
support the M-profile FPU model yet.

Signed-off-by: Aurelio C. Remonda <aurelioremonda@gmail.com>
---
* Changes in V4: Commit message updated. Deleted unnecessary comment and 
added a blank line in cortex-M4 initfn.
 target-arm/cpu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 4a888ab..d25a500 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -783,6 +783,15 @@ 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; /* r0p0 */
+}
 static void arm_v7m_class_init(ObjectClass *oc, void *data)
 {
     CPUClass *cc = CPU_CLASS(oc);
@@ -1185,6 +1194,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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-16 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-16 13:37 [Qemu-devel] [PATCH V4] Target-arm: Add the Cortex-M4 CPU Aurelio C. Remonda
2015-06-16 14:20 ` Peter Maydell
2015-06-16 14:35   ` aurelio remonda

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).