target-arm: decode TBB/TBH more thoroughly
PATCH 1/1 target-arm: decode TBB/TBH more thoroughly
This avoids other opcodes being incorrectly decoded as TBB/TBH. The LDA/STL instructions new in ARMv8 use this space.
---
This was previously sent as part of the LDA/STL patch. Separating it seems clearer.
--- target-arm/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-arm/translate.c +1 -1
@@ -8126,7 +8126,7 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hwgen_store_exclusive (s, rd, rs,15 , addr,2 ); }tcg_temp_free_i32 (addr); - }else if ((insn & (1 <<6 )) ==0 ) { + }else if ((insn & (7 <<5 )) ==0 ) {/* Table Branch. */ if (rn ==15 ) { addr =tcg_temp_new_i32 ();
Signature · 1 line
1.8.2.1
Quoted 16 lines · Mans Rullgard
This avoids other opcodes being incorrectly decoded as TBB/TBH. The LDA/STL instructions new in ARMv8 use this space.
Signed-off-by Mans Rullgard <[email protected]>---
This was previously sent as part of the LDA/STL patch. Separating it seems clearer.--- target-arm/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target-arm/translate.c +0
-0
target-arm/translate.c static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw · line 8132
Quoted 8 lines
target-arm/translate.c +1
-1@@ -8126,7 +8126,7 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hwgen_store_exclusive (s, rd, rs,15 , addr,2 ); }tcg_temp_free_i32 (addr); - }else if ((insn & (1 <<6 )) ==0 ) { + }else if ((insn & (7 <<5 )) ==0 ) {/* Table Branch. */ if (rn ==15 ) { addr =tcg_temp_new_i32 ();
The thing is that this change on its own is just shifting the patterns that should UNDEF from the 'table branch' arm of the elseif ladder into the 'load/store exclusive' arm, and the latter doesn't (yet) have enough decode to throw out the invalid cases. That's why I thought it made more sense as part of the LDA/STL patch, because you have to update the decode of the load/store excl arm of the ladder anyway.
If you want this as a separate patch then it should include the necessary bits of decode in the ld/st excl arm to cause the patterns to undef (then the lda/stl patch can fill in extra cases in the switch() that this patch would introduce.)
thanks
-- PMM
Quoted 35 lines · Peter Maydell
Quoted 16 lines · Mans Rullgard
This avoids other opcodes being incorrectly decoded as TBB/TBH. The LDA/STL instructions new in ARMv8 use this space.
Signed-off-by Mans Rullgard <[email protected]>---
This was previously sent as part of the LDA/STL patch. Separating it seems clearer.--- target-arm/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target-arm/translate.c +0
-0target-arm/translate.c static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw · line 8132
Quoted 8 lines
target-arm/translate.c +1
-1@@ -8126,7 +8126,7 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hwgen_store_exclusive (s, rd, rs,15 , addr,2 ); }tcg_temp_free_i32 (addr); - }else if ((insn & (1 <<6 )) ==0 ) { + }else if ((insn & (7 <<5 )) ==0 ) {/* Table Branch. */ if (rn ==15 ) { addr =tcg_temp_new_i32 ();The thing is that this change on its own is just shifting the patterns that should UNDEF from the 'table branch' arm of the elseif ladder into the 'load/store exclusive' arm, and the latter doesn't (yet) have enough decode to throw out the invalid cases. That's why I thought it made more sense as part of the LDA/STL patch, because you have to update the decode of the load/store excl arm of the ladder anyway.
Quoted 5 lines
If you want this as a separate patch then it should include the necessary bits of decode in the ld/st excl arm to cause the patterns to undef (then the lda/stl patch can fill in extra cases in the
switch()that this patch would introduce.)
You're quite right. Keeping that one line in the big patch is probably the simplest after all.
Signature · 2 lines
Måns Rullgård [email protected]