public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] Big real mode fixes
@ 2012-08-21 14:06 Avi Kivity
  2012-08-21 14:06 ` [PATCH 01/13] KVM: VMX: Separate saving pre-realmode state from setting segments Avi Kivity
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Avi Kivity @ 2012-08-21 14:06 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm

It turns out that our big real mode implementation was based on a miconception:
I believed that loading a segment register in real mode causes the limit to be
reset to 0xffff (thus undoing the effect), while in reality, the limit is preserved
across segment changes.  This bug was hidden by another bug: we didn't do limit checks
in real mode.  So even though segment loads corrupted the limit, the guest still
functioned because that limit isn't checked.

This patchset fixes both bugs, and introduces an optimization: we can now use
vm86 mode to virtualize big real mode (under usually-met conditions).  This
both speeds up big real mode, and makes it more robust, since fewer instructions
need to be emulated.

I think this patchset means we can remove emulate_invalid_guest_state=0, since it
offers no advantages now.

Avi Kivity (13):
  KVM: VMX: Separate saving pre-realmode state from setting segments
  KVM: VMX: Fix incorrect lookup of segment S flag in
    fix_pmode_dataseg()
  KVM: VMX: Use kvm_segment to save protected-mode segments when
    entering realmode
  KVM: VMX: Retain limit and attributes when entering protected mode
  KVM: VMX: Allow real mode emulation using vm86 with dpl=0
  KVM: VMX: Allow vm86 virtualization of big real mode
  KVM: x86 emulator: Leave segment limit and attributs alone in real
    mode
  KVM: x86 emulator: Check segment limits in real mode too
  KVM: x86 emulator: Fix #GP error code during linearization
  KVM: VMX: Return real real-mode segment data even if
    emulate_invalid_guest_state=1
  KVM: VMX: Preserve segment limit and access rights in real mode
  KVM: VMX: Save all segment data in real mode
  KVM: VMX: Ignore segment G and D bits when considering whether we can
    virtualize

 arch/x86/kvm/emulate.c |  19 ++++------
 arch/x86/kvm/vmx.c     | 100 ++++++++++++++++++-------------------------------
 2 files changed, 44 insertions(+), 75 deletions(-)

-- 
1.7.11.3


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

end of thread, other threads:[~2012-08-28 16:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-21 14:06 [PATCH 00/13] Big real mode fixes Avi Kivity
2012-08-21 14:06 ` [PATCH 01/13] KVM: VMX: Separate saving pre-realmode state from setting segments Avi Kivity
2012-08-21 14:06 ` [PATCH 02/13] KVM: VMX: Fix incorrect lookup of segment S flag in fix_pmode_dataseg() Avi Kivity
2012-08-21 14:07 ` [PATCH 03/13] KVM: VMX: Use kvm_segment to save protected-mode segments when entering realmode Avi Kivity
2012-08-21 14:07 ` [PATCH 04/13] KVM: VMX: Retain limit and attributes when entering protected mode Avi Kivity
2012-08-21 14:07 ` [PATCH 05/13] KVM: VMX: Allow real mode emulation using vm86 with dpl=0 Avi Kivity
2012-08-21 14:07 ` [PATCH 06/13] KVM: VMX: Allow vm86 virtualization of big real mode Avi Kivity
2012-08-21 14:07 ` [PATCH 07/13] KVM: x86 emulator: Leave segment limit and attributs alone in " Avi Kivity
2012-08-21 14:07 ` [PATCH 08/13] KVM: x86 emulator: Check segment limits in real mode too Avi Kivity
2012-08-21 14:07 ` [PATCH 09/13] KVM: x86 emulator: Fix #GP error code during linearization Avi Kivity
2012-08-21 14:07 ` [PATCH 10/13] KVM: VMX: Return real real-mode segment data even if emulate_invalid_guest_state=1 Avi Kivity
2012-08-21 14:07 ` [PATCH 11/13] KVM: VMX: Preserve segment limit and access rights in real mode Avi Kivity
2012-08-21 14:07 ` [PATCH 12/13] KVM: VMX: Save all segment data " Avi Kivity
2012-08-21 14:07 ` [PATCH 13/13] KVM: VMX: Ignore segment G and D bits when considering whether we can virtualize Avi Kivity
2012-08-28  0:08 ` [PATCH 00/13] Big real mode fixes Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox