Skip to contentSkip to conversation

target-sh4: Fix operands for fipr, ftrv instructions

PATCH Applied Stefan Weil 2 participants 2 messages Jan 7, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-sh4: Fix operands for fipr, ftrv instructions

Coverity complained about right shifts of opcode (16, 18) which were larger than the size of opcode (16 bit).

Using the correct shift values fixes this.

Cc Aurelien Jarno <[email protected]>
---
 target-sh4/translate.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
target-sh4/translate.c +3 -3
index bad3577..2ecb236 100644
@@ -1864,8 +1864,8 @@ static void _decode_opc(DisasContext * ctx)
         CHECK_FPU_ENABLED
         if ((ctx->fpscr & FPSCR_PR) == 0) {
             TCGv m, n;
-            m = tcg_const_i32((ctx->opcode >> 16) & 3);
-            n = tcg_const_i32((ctx->opcode >> 18) & 3);
+            m = tcg_const_i32((ctx->opcode >> 8) & 3);
+            n = tcg_const_i32((ctx->opcode >> 10) & 3);
             gen_helper_fipr(m, n);
             tcg_temp_free(m);
             tcg_temp_free(n);
@@ -1877,7 +1877,7 @@ static void _decode_opc(DisasContext * ctx)
         if ((ctx->opcode & 0x0300) == 0x0100 &&
             (ctx->fpscr & FPSCR_PR) == 0) {
             TCGv n;
-            n = tcg_const_i32((ctx->opcode >> 18) & 3);
+            n = tcg_const_i32((ctx->opcode >> 10) & 3);
             gen_helper_ftrv(n);
             tcg_temp_free(n);
             return;
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 10 lines · Stefan Weil

Coverity complained about right shifts of opcode (16, 18) which were larger than the size of opcode (16 bit).

Using the correct shift values fixes this.

Cc Aurelien Jarno <[email protected]>
---
 target-sh4/translate.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Thanks, applied.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net