qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i386/tcg: generate an illegal op when translating AVX instructions
@ 2022-01-06 10:35 Stevie Lavern
  2022-01-06 18:22 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Stevie Lavern @ 2022-01-06 10:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: eduardo, Paolo Bonzini, Richard Henderson, stevie.lavern

[-- 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 --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i386/tcg: generate an illegal op when translating AVX instructions
  2022-01-06 10:35 [PATCH] i386/tcg: generate an illegal op when translating AVX instructions Stevie Lavern
@ 2022-01-06 18:22 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2022-01-06 18:22 UTC (permalink / raw)
  To: Stevie Lavern, qemu-devel; +Cc: eduardo, Paolo Bonzini

On 1/6/22 2:35 AM, Stevie Lavern wrote:
> 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 <mailto: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) {

The whole value should be 0, not only bit 0.

> +        /* If set, registers are 256bits.
> +           Fail as AVX extension is not supported. */

checkpatch.pl should have complained about the comment formatting:

     /*
      * multi line
      * comment
      */

Otherwise it looks good.


r~


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-06 18:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-06 10:35 [PATCH] i386/tcg: generate an illegal op when translating AVX instructions Stevie Lavern
2022-01-06 18:22 ` Richard Henderson

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).