target/arm: Clean excReturn bits when tail chaining

The TailChain() pseudocode specifies that a tail chaining
exception should sanitize the excReturn all-ones bits and
(if there is no FPU) the excReturn FType bits; we weren't
doing this.

Backports commit 60fba59a2f9a092a44b688df5d058cdd6dd9c276 from qemu
This commit is contained in:
Peter Maydell 2019-04-30 10:35:35 -04:00 committed by Lioncash
parent ca0ac5dca9
commit 746d377221
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -7880,6 +7880,14 @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
// Unicorn: commented out
//armv7m_nvic_get_pending_irq_info(env->nvic, &exc, &targets_secure);
if (dotailchain) {
/* Sanitize LR FType and PREFIX bits */
if (!arm_feature(env, ARM_FEATURE_VFP)) {
lr |= R_V7M_EXCRET_FTYPE_MASK;
}
lr = deposit32(lr, 24, 8, 0xff);
}
if (arm_feature(env, ARM_FEATURE_V8)) {
if (arm_feature(env, ARM_FEATURE_M_SECURITY) &&
(lr & R_V7M_EXCRET_S_MASK)) {