Commit 40f1b4d61c for qemu.org
commit 40f1b4d61c315f4d9a4fd8ff3fe4bc2eb60f4713
Author: Mohamed Mediouni <mohamed@unpredictable.fr>
Date: Tue Mar 24 16:13:16 2026 +0100
whpx: i386: don't restore segment registers after MMIO handling
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260324151323.74473-6-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index c0c7ba9177..69d141e7cc 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -416,19 +416,21 @@ void whpx_set_registers(CPUState *cpu, WHPXStateLevel level)
assert(whpx_register_names[idx] == WHvX64RegisterRflags);
lflags_to_rflags(env);
vcxt.values[idx++].Reg64 = env->eflags;
-
- /* Translate 6+4 segment registers. HV and QEMU order matches */
assert(idx == WHvX64RegisterEs);
- for (i = 0; i < 6; i += 1, idx += 1) {
- vcxt.values[idx].Segment = whpx_seg_q2h(&env->segs[i], v86, r86);
- }
- assert(idx == WHvX64RegisterLdtr);
- /*
- * Skip those registers for synchronisation after MMIO accesses
- * as they're not going to be modified in that case.
- */
if (level > WHPX_LEVEL_FAST_RUNTIME_STATE) {
+
+ /* Translate 6+4 segment registers. HV and QEMU order matches */
+ for (i = 0; i < 6; i += 1, idx += 1) {
+ vcxt.values[idx].Segment = whpx_seg_q2h(&env->segs[i], v86, r86);
+ }
+
+ assert(idx == WHvX64RegisterLdtr);
+ /*
+ * Skip those registers for synchronisation after MMIO accesses
+ * as they're not going to be modified in that case.
+ */
+
vcxt.values[idx++].Segment = whpx_seg_q2h(&env->ldt, 0, 0);
assert(idx == WHvX64RegisterTr);