target/arm: Make Cortex-M3 and M4 default to 8 PMSA regions

The Cortex-M3 and M4 CPUs always have 8 PMSA MPU regions (this isn't
a configurable option for the hardware). Make the default value of
the pmsav7-dregion property be set per-cpu, so we don't need to have
every user of these CPUs set it manually. (The existing default of
16 is correct for the other PMSAv7 core, the Cortex-R5.)

This fixes a bug where we were creating the M3 and M4 with
too many regions; most guest software would not notice or
care, though, since it would just not use the registers
associated with the unexpected extra regions.

Backports commit 8d92e26b452f8961ec90df3f93cf5f3b7a9d158f from qemu
This commit is contained in:
Peter Maydell 2018-03-03 22:30:29 -05:00 committed by Lioncash
parent 3bd5694a0a
commit e31653de84
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -864,6 +864,7 @@ static void cortex_m3_initfn(struct uc_struct *uc, Object *obj, void *opaque)
set_feature(&cpu->env, ARM_FEATURE_V7);
set_feature(&cpu->env, ARM_FEATURE_M);
cpu->midr = 0x410fc231;
cpu->pmsav7_dregion = 8;
}
static void cortex_m4_initfn(struct uc_struct *uc, Object *obj, void *opaque)
@ -874,6 +875,7 @@ static void cortex_m4_initfn(struct uc_struct *uc, Object *obj, void *opaque)
set_feature(&cpu->env, ARM_FEATURE_M);
set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
cpu->midr = 0x410fc240; /* r0p0 */
cpu->pmsav7_dregion = 8;
}
static void arm_v7m_class_init(struct uc_struct *uc, ObjectClass *oc, void *data)