[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-7.2.5 44/44] target/i386: Check CR0.TS before enter_mmx
From: |
Michael Tokarev |
Subject: |
[Stable-7.2.5 44/44] target/i386: Check CR0.TS before enter_mmx |
Date: |
Sat, 5 Aug 2023 22:38:07 +0300 |
From: Matt Borgerson <contact@mborgerson.com>
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>
Message-ID: <CADc=-s5F10muEhLs4f3mxqsEPAHWj0XFfOC2sfFMVHrk9fcpMg@mail.gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit b2ea6450d8e1336a33eb958ccc64604bc35a43dd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc
index c2ee712561..ee4f4a899f 100644
--- a/target/i386/tcg/decode-new.c.inc
+++ b/target/i386/tcg/decode-new.c.inc
@@ -1815,16 +1815,18 @@ 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.39.2
- [Stable-7.2.5 00/44] Patch Round-up for stable 7.2.5, freeze on 2023-08-05, Michael Tokarev, 2023/08/05
- [Stable-7.2.5 37/44] vfio/pci: Disable INTx in vfio_realize error path, Michael Tokarev, 2023/08/05
- [Stable-7.2.5 38/44] vdpa: Fix possible use-after-free for VirtQueueElement, Michael Tokarev, 2023/08/05
- [Stable-7.2.5 39/44] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mac(), Michael Tokarev, 2023/08/05
- [Stable-7.2.5 40/44] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mq(), Michael Tokarev, 2023/08/05
- [Stable-7.2.5 41/44] target/ppc: Implement ASDR register for ISA v3.0 for HPT, Michael Tokarev, 2023/08/05
- [Stable-7.2.5 42/44] target/ppc: Fix pending HDEC when entering PM state, Michael Tokarev, 2023/08/05
- [Stable-7.2.5 43/44] target/ppc: Fix VRMA page size for ISA v3.0, Michael Tokarev, 2023/08/05
- [Stable-7.2.5 44/44] target/i386: Check CR0.TS before enter_mmx,
Michael Tokarev <=