From 65d0e176c307c0c254e7b363d84034543395069b Mon Sep 17 00:00:00 2001 From: Julia Suvorova Date: Fri, 29 Jun 2018 14:13:56 -0500 Subject: [PATCH] target/arm: Introduce ARM_FEATURE_M_MAIN This feature is intended to distinguish ARMv8-M variants: Baseline and Mainline. ARMv7-M compatibility requires the Main Extension. ARMv6-M compatibility is provided by all ARMv8-M implementations. Backports commit cc2ae7c9de14efd72c6205825eb7cd980ac09c11 from qemu --- qemu/target/arm/cpu.c | 3 +++ qemu/target/arm/cpu.h | 1 + 2 files changed, 4 insertions(+) diff --git a/qemu/target/arm/cpu.c b/qemu/target/arm/cpu.c index fee6029c..6a768e56 100644 --- a/qemu/target/arm/cpu.c +++ b/qemu/target/arm/cpu.c @@ -990,6 +990,7 @@ static void cortex_m3_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_M_MAIN); cpu->midr = 0x410fc231; cpu->pmsav7_dregion = 8; cpu->id_pfr0 = 0x00000030; @@ -1014,6 +1015,7 @@ static void cortex_m4_initfn(struct uc_struct *uc, Object *obj, void *opaque) set_feature(&cpu->env, ARM_FEATURE_V7); set_feature(&cpu->env, ARM_FEATURE_M); + set_feature(&cpu->env, ARM_FEATURE_M_MAIN); set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); cpu->midr = 0x410fc240; /* r0p0 */ cpu->pmsav7_dregion = 8; @@ -1039,6 +1041,7 @@ static void cortex_m33_initfn(struct uc_struct *uc, Object *obj, void *opaque) set_feature(&cpu->env, ARM_FEATURE_V8); set_feature(&cpu->env, ARM_FEATURE_M); + set_feature(&cpu->env, ARM_FEATURE_M_MAIN); set_feature(&cpu->env, ARM_FEATURE_M_SECURITY); set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); cpu->midr = 0x410fd213; /* r0p3 */ diff --git a/qemu/target/arm/cpu.h b/qemu/target/arm/cpu.h index 32589bc9..f2c34315 100644 --- a/qemu/target/arm/cpu.h +++ b/qemu/target/arm/cpu.h @@ -1422,6 +1422,7 @@ enum arm_features { ARM_FEATURE_V8_RDM, /* implements v8.1 simd round multiply */ ARM_FEATURE_V8_FP16, /* implements v8.2 half-precision float */ ARM_FEATURE_V8_FCMA, /* has complex number part of v8.3 extensions. */ + ARM_FEATURE_M_MAIN, /* M profile Main Extension */ }; static inline int arm_feature(CPUARMState *env, int feature)