target/arm: Allow reading flags from FPSCR for M-profile

rt==15 is a special case when reading the flags: it means the
destination is APSR. This patch avoids rejecting vmrs apsr_nzcv, fpscr
as illegal instruction.

Backports commit cdc6896659b85f7ed8f7552850312e55170de0c5 from qemu
This commit is contained in:
Christophe Lyon 2019-11-18 16:31:51 -05:00 committed by Lioncash
parent 3fc86e1901
commit 8264cb84fe
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -714,9 +714,10 @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a)
if (arm_dc_feature(s, ARM_FEATURE_M)) { if (arm_dc_feature(s, ARM_FEATURE_M)) {
/* /*
* The only M-profile VFP vmrs/vmsr sysreg is FPSCR. * The only M-profile VFP vmrs/vmsr sysreg is FPSCR.
* Writes to R15 are UNPREDICTABLE; we choose to undef. * Accesses to R15 are UNPREDICTABLE; we choose to undef.
* (FPSCR -> r15 is a special case which writes to the PSR flags.)
*/ */
if (a->rt == 15 || a->reg != ARM_VFP_FPSCR) { if (a->rt == 15 && (!a->l || a->reg != ARM_VFP_FPSCR)) {
return false; return false;
} }
} }