On 5/8/25 02:54, Paolo Bonzini wrote:
Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
  target/i386/tcg/decode-new.c.inc | 36 ++++++++++++++++++++++++--------
  1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc
index cda32ee6784..55216e0d249 100644
--- a/target/i386/tcg/decode-new.c.inc
+++ b/target/i386/tcg/decode-new.c.inc
@@ -2542,7 +2542,13 @@ static void disas_insn(DisasContext *s, CPUState *cpu)
      s->has_modrm = false;
      s->prefix = 0;
- next_byte:
+ next_byte:;
+#ifdef TARGET_X86_64
+    /* clear any REX prefix followed by other prefixes.  */
+    int rex;
+    rex = -1;
+ next_byte_rex:
+#endif
      b = x86_ldub_code(env, s);

I guess this is ok, with -1. It might be worthwhile rewriting without ifdefs, since we already let CODE64(s) and REX_PREFIX(s) expand to false without TARGET_X86_64.

The only irritating part would be actually setting s->rex_* at the end, because those members are themselves ifdef'ed over in DisasContext.


Reviewed-by: Richard Henderson <richard.hender...@linaro.org>


r~

Reply via email to