mirror of https://gitee.com/openkylin/qemu.git
target/arm: Add new-in-v8M SFSR and SFAR
Add the new M profile Secure Fault Status Register and Secure Fault Address Register. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 1506092407-26985-10-git-send-email-peter.maydell@linaro.org
This commit is contained in:
parent
4e4259d3c5
commit
bed079da04
|
@ -1017,6 +1017,22 @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
|
||||||
goto bad_offset;
|
goto bad_offset;
|
||||||
}
|
}
|
||||||
return cpu->env.pmsav8.mair1[attrs.secure];
|
return cpu->env.pmsav8.mair1[attrs.secure];
|
||||||
|
case 0xde4: /* SFSR */
|
||||||
|
if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
|
||||||
|
goto bad_offset;
|
||||||
|
}
|
||||||
|
if (!attrs.secure) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return cpu->env.v7m.sfsr;
|
||||||
|
case 0xde8: /* SFAR */
|
||||||
|
if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
|
||||||
|
goto bad_offset;
|
||||||
|
}
|
||||||
|
if (!attrs.secure) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return cpu->env.v7m.sfar;
|
||||||
default:
|
default:
|
||||||
bad_offset:
|
bad_offset:
|
||||||
qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad read offset 0x%x\n", offset);
|
qemu_log_mask(LOG_GUEST_ERROR, "NVIC: Bad read offset 0x%x\n", offset);
|
||||||
|
@ -1368,6 +1384,24 @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
|
||||||
* only affect cacheability, and we don't implement caching.
|
* only affect cacheability, and we don't implement caching.
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
case 0xde4: /* SFSR */
|
||||||
|
if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
|
||||||
|
goto bad_offset;
|
||||||
|
}
|
||||||
|
if (!attrs.secure) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cpu->env.v7m.sfsr &= ~value; /* W1C */
|
||||||
|
break;
|
||||||
|
case 0xde8: /* SFAR */
|
||||||
|
if (!arm_feature(&cpu->env, ARM_FEATURE_V8)) {
|
||||||
|
goto bad_offset;
|
||||||
|
}
|
||||||
|
if (!attrs.secure) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cpu->env.v7m.sfsr = value;
|
||||||
|
break;
|
||||||
case 0xf00: /* Software Triggered Interrupt Register */
|
case 0xf00: /* Software Triggered Interrupt Register */
|
||||||
{
|
{
|
||||||
int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ;
|
int excnum = (value & 0x1ff) + NVIC_FIRST_IRQ;
|
||||||
|
|
|
@ -443,8 +443,10 @@ typedef struct CPUARMState {
|
||||||
uint32_t cfsr[M_REG_NUM_BANKS]; /* Configurable Fault Status */
|
uint32_t cfsr[M_REG_NUM_BANKS]; /* Configurable Fault Status */
|
||||||
uint32_t hfsr; /* HardFault Status */
|
uint32_t hfsr; /* HardFault Status */
|
||||||
uint32_t dfsr; /* Debug Fault Status Register */
|
uint32_t dfsr; /* Debug Fault Status Register */
|
||||||
|
uint32_t sfsr; /* Secure Fault Status Register */
|
||||||
uint32_t mmfar[M_REG_NUM_BANKS]; /* MemManage Fault Address */
|
uint32_t mmfar[M_REG_NUM_BANKS]; /* MemManage Fault Address */
|
||||||
uint32_t bfar; /* BusFault Address */
|
uint32_t bfar; /* BusFault Address */
|
||||||
|
uint32_t sfar; /* Secure Fault Address Register */
|
||||||
unsigned mpu_ctrl[M_REG_NUM_BANKS]; /* MPU_CTRL */
|
unsigned mpu_ctrl[M_REG_NUM_BANKS]; /* MPU_CTRL */
|
||||||
int exception;
|
int exception;
|
||||||
uint32_t primask[M_REG_NUM_BANKS];
|
uint32_t primask[M_REG_NUM_BANKS];
|
||||||
|
@ -1260,6 +1262,16 @@ FIELD(V7M_DFSR, DWTTRAP, 2, 1)
|
||||||
FIELD(V7M_DFSR, VCATCH, 3, 1)
|
FIELD(V7M_DFSR, VCATCH, 3, 1)
|
||||||
FIELD(V7M_DFSR, EXTERNAL, 4, 1)
|
FIELD(V7M_DFSR, EXTERNAL, 4, 1)
|
||||||
|
|
||||||
|
/* V7M SFSR bits */
|
||||||
|
FIELD(V7M_SFSR, INVEP, 0, 1)
|
||||||
|
FIELD(V7M_SFSR, INVIS, 1, 1)
|
||||||
|
FIELD(V7M_SFSR, INVER, 2, 1)
|
||||||
|
FIELD(V7M_SFSR, AUVIOL, 3, 1)
|
||||||
|
FIELD(V7M_SFSR, INVTRAN, 4, 1)
|
||||||
|
FIELD(V7M_SFSR, LSPERR, 5, 1)
|
||||||
|
FIELD(V7M_SFSR, SFARVALID, 6, 1)
|
||||||
|
FIELD(V7M_SFSR, LSERR, 7, 1)
|
||||||
|
|
||||||
/* v7M MPU_CTRL bits */
|
/* v7M MPU_CTRL bits */
|
||||||
FIELD(V7M_MPU_CTRL, ENABLE, 0, 1)
|
FIELD(V7M_MPU_CTRL, ENABLE, 0, 1)
|
||||||
FIELD(V7M_MPU_CTRL, HFNMIENA, 1, 1)
|
FIELD(V7M_MPU_CTRL, HFNMIENA, 1, 1)
|
||||||
|
|
|
@ -276,6 +276,8 @@ static const VMStateDescription vmstate_m_security = {
|
||||||
VMSTATE_UINT32(env.v7m.ccr[M_REG_S], ARMCPU),
|
VMSTATE_UINT32(env.v7m.ccr[M_REG_S], ARMCPU),
|
||||||
VMSTATE_UINT32(env.v7m.mmfar[M_REG_S], ARMCPU),
|
VMSTATE_UINT32(env.v7m.mmfar[M_REG_S], ARMCPU),
|
||||||
VMSTATE_UINT32(env.v7m.cfsr[M_REG_S], ARMCPU),
|
VMSTATE_UINT32(env.v7m.cfsr[M_REG_S], ARMCPU),
|
||||||
|
VMSTATE_UINT32(env.v7m.sfsr, ARMCPU),
|
||||||
|
VMSTATE_UINT32(env.v7m.sfar, ARMCPU),
|
||||||
VMSTATE_END_OF_LIST()
|
VMSTATE_END_OF_LIST()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue