* [PATCH] target/i386: Check CR0.TS before enter_mmx
@ 2023-07-13 7:29 Matt Borgerson
2023-07-14 14:28 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Matt Borgerson @ 2023-07-13 7:29 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
When CR0.TS=1, execution of x87 FPU, MMX, and some SSE instructions will
cause a Device Not Available (DNA) exception (#NM). System software uses
this exception event to lazily context switch FPU state.
Before this patch, enter_mmx helpers may be generated just before #NM
generation, prematurely resetting FPU state before the guest has a
chance to save it.
Signed-off-by: Matt Borgerson <contact@mborgerson.com>
---
target/i386/tcg/decode-new.c.inc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc
index 46afd9960b..0ead1c6011 100644
--- a/target/i386/tcg/decode-new.c.inc
+++ b/target/i386/tcg/decode-new.c.inc
@@ -1803,16 +1803,19 @@ static void disas_insn_new(DisasContext *s,
CPUState *cpu, int b)
}
break;
- case X86_SPECIAL_MMX:
- if (!(s->prefix & (PREFIX_REPZ | PREFIX_REPNZ | PREFIX_DATA))) {
- gen_helper_enter_mmx(cpu_env);
- }
+ default:
break;
}
if (!validate_vex(s, &decode)) {
return;
}
+
+ if (decode.e.special == X86_SPECIAL_MMX &&
+ !(s->prefix & (PREFIX_REPZ | PREFIX_REPNZ | PREFIX_DATA))) {
+ gen_helper_enter_mmx(cpu_env);
+ }
+
if (decode.op[0].has_ea || decode.op[1].has_ea || decode.op[2].has_ea) {
gen_load_ea(s, &decode.mem, decode.e.vex_class == 12);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/i386: Check CR0.TS before enter_mmx
2023-07-13 7:29 [PATCH] target/i386: Check CR0.TS before enter_mmx Matt Borgerson
@ 2023-07-14 14:28 ` Paolo Bonzini
2023-07-17 19:22 ` Matt Borgerson
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2023-07-14 14:28 UTC (permalink / raw)
To: Matt Borgerson; +Cc: qemu-devel, pbonzini
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/i386: Check CR0.TS before enter_mmx
2023-07-14 14:28 ` Paolo Bonzini
@ 2023-07-17 19:22 ` Matt Borgerson
0 siblings, 0 replies; 3+ messages in thread
From: Matt Borgerson @ 2023-07-17 19:22 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Matt Borgerson, qemu-devel
Thanks Paolo!
On Fri, Jul 14, 2023 at 7:28 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Queued, thanks.
>
> Paolo
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-17 19:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-13 7:29 [PATCH] target/i386: Check CR0.TS before enter_mmx Matt Borgerson
2023-07-14 14:28 ` Paolo Bonzini
2023-07-17 19:22 ` Matt Borgerson
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).