From: "Alexandro Sanchez Bach" <alexandro@phi.nz>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] target/i386: Fixed CR0.TS check in gen_sse
Date: Tue, 29 May 2018 12:19:35 +0200 [thread overview]
Message-ID: <007a01d3f736$8b5e63f0$a21b2bd0$@phi.nz> (raw)
The function `gen_sse` assumes all of its instructions require CR0.TS=0.
However, integer extensions at `0F 38 F[0-F]` and `0F 3A F[0-F]` such as
CRC32, MOVBE, ADX, BMI1, BMI2 that are handled by `gen_sse` are not supposed
to throw an exception in this scenario. This causes issues while booting
some FreeBSD-based guests.
Reported-by: Alexandro Sanchez Bach <alexandro@phi.nz>
Signed-off-by: Alexandro Sanchez Bach <alexandro@phi.nz>
Cc: qemu-stable@nongnu.org
diff --git a/target/i386/translate.c b/target/i386/translate.c
index 7c21814676..079ab7afef 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -3049,8 +3049,16 @@ static void gen_sse(CPUX86State *env, DisasContext
*s, int b,
is_xmm = 1;
}
}
+
+ modrm = x86_ldub_code(env, s);
+ reg = ((modrm >> 3) & 7);
+ if (is_xmm)
+ reg |= rex_r;
+ mod = (modrm >> 6) & 3;
+
/* simple MMX/SSE operation */
- if (s->flags & HF_TS_MASK) {
+ if (s->flags & HF_TS_MASK
+ && ((b != 0x38 && b != 0x3A) || !(modrm & 0xF0))) {
gen_exception(s, EXCP07_PREX, pc_start - s->cs_base);
return;
}
@@ -3084,11 +3092,6 @@ static void gen_sse(CPUX86State *env, DisasContext
*s, int b,
gen_helper_enter_mmx(cpu_env);
}
- modrm = x86_ldub_code(env, s);
- reg = ((modrm >> 3) & 7);
- if (is_xmm)
- reg |= rex_r;
- mod = (modrm >> 6) & 3;
if (sse_fn_epp == SSE_SPECIAL) {
b |= (b1 << 8);
switch(b) {
next reply other threads:[~2018-05-29 10:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 10:19 Alexandro Sanchez Bach [this message]
2018-06-27 9:30 ` [Qemu-devel] [PATCH] target/i386: Fixed CR0.TS check in gen_sse Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2018-06-26 17:39 Alexandro Sanchez Bach
2018-06-26 17:51 ` Peter Maydell
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='007a01d3f736$8b5e63f0$a21b2bd0$@phi.nz' \
--to=alexandro@phi.nz \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.