target/arm: Clear CONTROL.SFPA in BXNS and BLXNS

For v8M floating point support, transitions from Secure
to Non-secure state via BLNS and BLXNS must clear the
CONTROL.SFPA bit. (This corresponds to the pseudocode
BranchToNS() function.)

Backports commit 3cd6726f0ba7cc77342ee721bd86094e13b2a42a from qemu
This commit is contained in:
Peter Maydell 2019-04-30 10:33:22 -04:00 committed by Lioncash
parent c7f5633cfe
commit ca0ac5dca9
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -7623,6 +7623,9 @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
/* translate.c should have made BXNS UNDEF unless we're secure */ /* translate.c should have made BXNS UNDEF unless we're secure */
assert(env->v7m.secure); assert(env->v7m.secure);
if (!(dest & 1)) {
env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK;
}
switch_v7m_security_state(env, dest & 1); switch_v7m_security_state(env, dest & 1);
env->thumb = 1; env->thumb = 1;
env->regs[15] = dest & ~1; env->regs[15] = dest & ~1;
@ -7680,6 +7683,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
*/ */
write_v7m_exception(env, 1); write_v7m_exception(env, 1);
} }
env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK;
switch_v7m_security_state(env, 0); switch_v7m_security_state(env, 0);
env->thumb = 1; env->thumb = 1;
env->regs[15] = dest; env->regs[15] = dest;