Skip to contentSkip to conversation

target-arm: Correct conversion of Thumb Neon dp encodings into ARM

PATCH Applied Peter Maydell 2 participants 2 messages Feb 11, 2011 – Feb 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-arm: Correct conversion of Thumb Neon dp encodings into ARM

From: Juha Riihimäki <[email protected]>

We handle Thumb Neon data processing instructions by converting them into the equivalent ARM encoding, as the two are very close. However the ARM encoding should have bit 28 set, not clear. This wasn't causing any problems because we don't actually look at that bit during decode; however it is better to do the conversion correctly to avoid problems later if we add checks to UNDEF on SBZ/SBO bits.

---
 target-arm/translate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-arm/translate.c +1 -1
index 3087a5d..793fd59 100644
@@ -8011,7 +8011,7 @@ static int disas_thumb2_insn(CPUState *env, DisasContext *s, uint16_t insn_hw1)
         /* Coprocessor.  */
         if (((insn >> 24) & 3) == 3) {
             /* Translate into the equivalent ARM encoding.  */
-            insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4);
+            insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28);
             if (disas_neon_data_insn(env, s, insn))
                 goto illegal_op;
         } else {
Signature · 1 line
1.7.1
#1 lore raw
Quoted 9 lines · Peter Maydell

From: Juha Riihimäki <[email protected]>

We handle Thumb Neon data processing instructions by converting them into the equivalent ARM encoding, as the two are very close. However the ARM encoding should have bit 28 set, not clear. This wasn't causing any problems because we don't actually look at that bit during decode; however it is better to do the conversion correctly to avoid problems later if we add checks to UNDEF on SBZ/SBO bits.

Quoted 5 lines
---
 target-arm/translate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied.

Quoted 18 lines
target-arm/translate.c +1 -1
index 3087a5d..793fd59 100644
@@ -8011,7 +8011,7 @@ static int disas_thumb2_insn(CPUState *env, DisasContext *s, uint16_t insn_hw1)
         /* Coprocessor.  */
         if (((insn >> 24) & 3) == 3) {
             /* Translate into the equivalent ARM encoding.  */
-            insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4);
+            insn = (insn & 0xe2ffffff) | ((insn & (1 << 28)) >> 4) | (1 << 28);
             if (disas_neon_data_insn(env, s, insn))
                 goto illegal_op;
         } else {
Signature · 1 line
1.7.1
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net