hw/intc/armv7m_nvic: Only show ID register values for Main Extension CPUs
M-profile CPUs only implement the ID registers as guest-visible if the CPU implements the Main Extension (all our current CPUs except the Cortex-M0 do). Currently we handle this by having the Cortex-M0 leave the ID register values in the ARMCPU struct as zero, but this conflicts with our design decision to make QEMU behaviour be keyed off ID register fields wherever possible. Explicitly code the ID registers in the NVIC to return 0 if the Main Extension is not implemented, so we can make the M0 model set the ARMCPU struct fields to obtain the correct behaviour without those values becoming guest-visible. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20200910173855.4068-4-peter.maydell@linaro.org
This commit is contained in:
parent
8a130a7be6
commit
d20c3ebda2
@ -1238,32 +1238,74 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
|
||||
"Aux Fault status registers unimplemented\n");
|
||||
return 0;
|
||||
case 0xd40: /* PFR0. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_pfr0;
|
||||
case 0xd44: /* PFR1. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_pfr1;
|
||||
case 0xd48: /* DFR0. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_dfr0;
|
||||
case 0xd4c: /* AFR0. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->id_afr0;
|
||||
case 0xd50: /* MMFR0. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_mmfr0;
|
||||
case 0xd54: /* MMFR1. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_mmfr1;
|
||||
case 0xd58: /* MMFR2. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_mmfr2;
|
||||
case 0xd5c: /* MMFR3. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_mmfr3;
|
||||
case 0xd60: /* ISAR0. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_isar0;
|
||||
case 0xd64: /* ISAR1. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_isar1;
|
||||
case 0xd68: /* ISAR2. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_isar2;
|
||||
case 0xd6c: /* ISAR3. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_isar3;
|
||||
case 0xd70: /* ISAR4. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_isar4;
|
||||
case 0xd74: /* ISAR5. */
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_M_MAIN)) {
|
||||
goto bad_offset;
|
||||
}
|
||||
return cpu->isar.id_isar5;
|
||||
case 0xd78: /* CLIDR */
|
||||
return cpu->clidr;
|
||||
|
Loading…
Reference in New Issue
Block a user