]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
target/arm: Allow reading flags from FPSCR for M-profile
authorChristophe Lyon <christophe.lyon@linaro.org>
Fri, 25 Oct 2019 09:57:11 +0000 (11:57 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 4 Nov 2019 14:34:45 +0000 (08:34 -0600)
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.

Cc: qemu-stable@nongnu.org
Signed-off-by: Christophe Lyon <christophe.lyon@linaro.org>
Message-id: 20191025095711.10853-1-christophe.lyon@linaro.org
[PMM: updated the comment]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 2529ab43b8a05534494704e803e0332d111d8b91)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
target/arm/translate-vfp.inc.c

index ef45cecbeac18edb6dffbcad7980e454a980999e..75406fd9dbeeabdcaff39cbad40f3dfe5606c6ea 100644 (file)
@@ -704,9 +704,10 @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a)
     if (arm_dc_feature(s, ARM_FEATURE_M)) {
         /*
          * 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;
         }
     }