Skip to content

Commit

Permalink
KVM: VMX: Force seg.base == (seg.sel << 4) in real mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan Kiszka authored and Avi Kivity committed Jan 30, 2008
1 parent 54f1585 commit 15b00f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 15b00f3

Please sign in to comment.