qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stevie Lavern <stevie.lavern@gmail.com>
To: qemu-devel@nongnu.org
Cc: eduardo@habkost.net, Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	stevie.lavern@gmail.com
Subject: [PATCH] i386/tcg: generate an illegal op when translating AVX instructions
Date: Thu, 6 Jan 2022 11:35:42 +0100	[thread overview]
Message-ID: <CADV2EAuttJSjXMc1CHmyJ9ApjOFLJ8CKxa81LLQp3DAYn2A2ZA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 877 bytes --]

The AVX instruction set is not supported by Qemu.
However, some AVX instructions are properly decoded and emulated as their
legacy SSE version.
This patch prevent this by generating an illegal_op instead of a bogus SSE
instruction.

Signed-off-by: Stevie Lavern <stevie.lavern@gmail.com>
---
 target/i386/tcg/translate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 05f9336c9b..996fce65b2 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -4706,6 +4706,11 @@ static target_ulong disas_insn(DisasContext *s,
CPUState *cpu)
         }
     }

+    if (s->vex_l & 1) {
+        /* If set, registers are 256bits.
+           Fail as AVX extension is not supported. */
+        goto illegal_op;
+    }
     s->prefix = prefixes;
     s->aflag = aflag;
     s->dflag = dflag;
--

[-- Attachment #2: Type: text/html, Size: 1091 bytes --]

             reply	other threads:[~2022-01-06 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06 10:35 Stevie Lavern [this message]
2022-01-06 18:22 ` [PATCH] i386/tcg: generate an illegal op when translating AVX instructions Richard Henderson

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=CADV2EAuttJSjXMc1CHmyJ9ApjOFLJ8CKxa81LLQp3DAYn2A2ZA@mail.gmail.com \
    --to=stevie.lavern@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).