[PATCH 1/3] target/arm: Make CBZ/CBNZ UNDEF before v6T2
Peter Maydell <[email protected]>
| Newsgroups | org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
The Thumb CBZ/CBNZ encodings are only introduced in v6T2 (for A-profile) and v7M (for M-profile). We missed out the feature-check in trans_CBZ(), so don't UNDEF on v5T or v6M. Add the missing check: conveniently, the ARM_FEATURE_THUMB2 feature is true for exactly the cases where CBZ is implemented. Cc: [email protected] Fixes: 9ee6e8bb853bde ("ARMv7 support.") Signed-off-by: Peter Maydell <[email protected]> --- target/arm/tcg/translate.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 055f3c5b403..df98dc2e34d 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -5783,7 +5783,14 @@ static bool trans_TBH(DisasContext *s, arg_tbranch *a) static bool trans_CBZ(DisasContext *s, arg_CBZ *a) { - TCGv_i32 tmp = load_reg(s, a->rn); + TCGv_i32 tmp; + + /* CBZ was introduced in v6T2 and v7M */ + if (!arm_dc_feature(s, ARM_FEATURE_THUMB2)) { + return false; + } + + tmp = load_reg(s, a->rn); arm_gen_condlabel(s); tcg_gen_brcondi_i32(a->nz ? TCG_COND_EQ : TCG_COND_NE, -- 2.43.0