Skip to contentSkip to conversation

target/i386/tcg: fix REPScalar with memory operand

PATCH Superseded Paolo Bonzini 3 participants 3 messages Sep 23 – Sep 28

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/i386/tcg: fix REPScalar with memory operand

By the time validate_vex() runs, e->s2 is not used anymore and decode->op[2].ot has already been filled in by decode_size(). So it's the latter that has to be adjusted, just like before commit b7d4ec4832d ("target/i386/tcg: move VEX validation early", 2026-08-26).

Fixes b7d4ec4832d ("target/i386/tcg: move VEX validation early", 2026-08-26)
---
 target/i386/tcg/decode-new.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/tcg/decode-new.c.inc +1 -1
index 8d1e581cfde..26f6d6277be 100644
@@ -2671,7 +2671,7 @@ static bool validate_vex(DisasContext *s, X86DecodedInsn *decode)
             }
             assert(e->op2 == X86_TYPE_W && e->s2 == X86_SIZE_x);
             if ((s->modrm >> 6) != 3) {
-                e->s2 = s->prefix & PREFIX_REPNZ ? X86_SIZE_sd : X86_SIZE_ss;
+                decode->op[2].ot = s->prefix & PREFIX_REPNZ ? MO_64 : MO_32;
             }
         }
         break;
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Paolo Bonzini

By the time validate_vex() runs, e->s2 is not used anymore and decode->op[2].ot has already been filled in by decode_size(). So it's the latter that has to be adjusted, just like before commit b7d4ec4832d ("target/i386/tcg: move VEX validation early", 2026-08-26).

Fixes b7d4ec4832d ("target/i386/tcg: move VEX validation early", 2026-08-26)
---
  target/i386/tcg/decode-new.c.inc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/tcg/decode-new.c.inc +0 -0
index 8d1e581cfde..26f6d6277be 100644

target/i386/tcg/decode-new.c.inc static bool validate_vex(DisasContext *s, X86DecodedInsn *decode) · line 2677

Quoted 8 lines
target/i386/tcg/decode-new.c.inc +1 -1
@@ -2671,7 +2671,7 @@ static bool validate_vex(DisasContext *s, X86DecodedInsn *decode)
              }
              assert(e->op2 == X86_TYPE_W && e->s2 == X86_SIZE_x);
              if ((s->modrm >> 6) != 3) {
-                e->s2 = s->prefix & PREFIX_REPNZ ? X86_SIZE_sd : X86_SIZE_ss;
+                decode->op[2].ot = s->prefix & PREFIX_REPNZ ? MO_64 : MO_32;
              }
          }
          break;

r~

Reviewed-by on v1 1/1
#2 lore raw
In reply to Paolo Bonzini
Quoted 11 lines · Paolo Bonzini

Date: Wed, 23 Sep 2026 14:47:49 +0200
From: Paolo Bonzini <[email protected]>
Subject: [PATCH] target/i386/tcg: fix REPScalar with memory operand
X-Mailer: git-send-email 2.55.0

By the time validate_vex() runs, e->s2 is not used anymore and decode->op[2].ot has already been filled in by decode_size(). So it's the latter that has to be adjusted, just like before commit b7d4ec4832d ("target/i386/tcg: move VEX validation early", 2026-08-26).

Quoted 5 lines
Fixes b7d4ec4832d ("target/i386/tcg: move VEX validation early", 2026-08-26)
---
 target/i386/tcg/decode-new.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)