From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [PATCH] target/i386: ignore misplaced REX prefixes
Date: Thu, 8 May 2025 14:01:10 -0700 [thread overview]
Message-ID: <f8fa2d89-2028-4d58-9722-13e90e09dc43@linaro.org> (raw)
In-Reply-To: <20250508095436.471819-1-pbonzini@redhat.com>
On 5/8/25 02:54, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@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.henderson@linaro.org>
r~
prev parent reply other threads:[~2025-05-08 21:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 9:54 [PATCH] target/i386: ignore misplaced REX prefixes Paolo Bonzini
2025-05-08 21:01 ` Richard Henderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8fa2d89-2028-4d58-9722-13e90e09dc43@linaro.org \
--to=richard.henderson@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).