target/arm: Execute Thumb instructions when their condbits are 0xf
commit5529de1e5512c05276825fa8b922147663fd6eac
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 4 Jul 2019 16:14:44 +0000 (4 17:14 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 4 Jul 2019 16:25:30 +0000 (4 17:25 +0100)
tree2c8a35db5ce53d7b7ca1fcf7d9abc3e7dccbdddf
parent9bed521ec894d30c58088e2fa5da43f3814a54d8
target/arm: Execute Thumb instructions when their condbits are 0xf

Thumb instructions in an IT block are set up to be conditionally
executed depending on a set of condition bits encoded into the IT
bits of the CPSR/XPSR.  The architecture specifies that if the
condition bits are 0b1111 this means "always execute" (like 0b1110),
not "never execute"; we were treating it as "never execute".  (See
the ConditionHolds() pseudocode in both the A-profile and M-profile
Arm ARM.)

This is a bit of an obscure corner case, because the only legal
way to get to an 0b1111 set of condbits is to do an exception
return which sets the XPSR/CPSR up that way. An IT instruction
which encodes a condition sequence that would include an 0b1111 is
UNPREDICTABLE, and for v8A the CONSTRAINED UNPREDICTABLE choices
for such an IT insn are to NOP, UNDEF, or treat 0b1111 like 0b1110.
Add a comment noting that we take the latter option.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190617175317.27557-7-peter.maydell@linaro.org
target/arm/translate.c