]> err.no Git - linux-2.6/commitdiff
KVM: VMX: Force seg.base == (seg.sel << 4) in real mode
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 19 Nov 2007 09:21:45 +0000 (10:21 +0100)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:53:06 +0000 (17:53 +0200)
Ensure that segment.base == segment.selector << 4 when entering the real
mode on Intel so that the CPU will not bark at us.  This fixes some old
protected mode demo from http://www.x86.org/articles/pmbasics/tspec_a1_doc.htm.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/vmx.c

index 0c082faaa6db813bd529892633f94dfdd7aae7db..b4c0bdce7b34acf0fa33c74b0789dadd049f58b1 100644 (file)
@@ -1165,7 +1165,8 @@ static void fix_rmode_seg(int seg, struct kvm_save_segment *save)
        save->base = vmcs_readl(sf->base);
        save->limit = vmcs_read32(sf->limit);
        save->ar = vmcs_read32(sf->ar_bytes);
-       vmcs_write16(sf->selector, vmcs_readl(sf->base) >> 4);
+       vmcs_write16(sf->selector, save->base >> 4);
+       vmcs_write32(sf->base, save->base & 0xfffff);
        vmcs_write32(sf->limit, 0xffff);
        vmcs_write32(sf->ar_bytes, 0xf3);
 }