From 7ca21d4ab4e640e11d34b4056279ff611f1a152e Mon Sep 17 00:00:00 2001 From: "Aurelio C. Remonda" Date: Tue, 13 Feb 2018 15:07:40 -0500 Subject: [PATCH] target-arm: Add the Cortex-M4 CPU 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. 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. Backports commit ba890a9b2509a0087bb7eafddae02ea5ecbb7bb4 from qemu --- qemu/target-arm/cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/qemu/target-arm/cpu.c b/qemu/target-arm/cpu.c index bd771a59..f2dc038b 100644 --- a/qemu/target-arm/cpu.c +++ b/qemu/target-arm/cpu.c @@ -730,6 +730,16 @@ static void cortex_m3_initfn(struct uc_struct *uc, Object *obj, void *opaque) cpu->midr = 0x410fc231; } +static void cortex_m4_initfn(struct uc_struct *uc, Object *obj, void *opaque) +{ + ARMCPU *cpu = ARM_CPU(uc, 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(struct uc_struct *uc, ObjectClass *oc, void *data) { CPUClass *cc = CPU_CLASS(uc, oc); @@ -1128,6 +1138,7 @@ static const ARMCPUInfo arm_cpus[] = { { "arm1176", arm1176_initfn }, { "arm11mpcore", arm11mpcore_initfn }, { "cortex-m3", cortex_m3_initfn, arm_v7m_class_init }, + { "cortex-m4", cortex_m4_initfn, arm_v7m_class_init }, { "cortex-a8", cortex_a8_initfn }, { "cortex-a9", cortex_a9_initfn }, { "cortex-a15", cortex_a15_initfn },