aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-03-21 07:44:58 -0400
committerAvi Kivity <avi@qumranet.com>2007-05-03 03:52:26 -0400
commit024aa1c02f0a9f938af83f55c727bcb18187eba4 (patch)
tree9b431c38f5fc673f7c494bd39a87c12063745d47 /drivers/kvm
parentf6528b03f167785301908bf124db7be591e983ca (diff)
KVM: Modify guest segments after potentially switching modes
The SET_SREGS ioctl modifies both cr0.pe (real mode/protected mode) and guest segment registers. Since segment handling is modified by the mode on Intel procesors, update the segment registers after the mode switch has taken place. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm')
-rw-r--r--drivers/kvm/kvm_main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index b998bc68e9f2..05235e1751fb 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1904,16 +1904,6 @@ static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1904 1904
1905 vcpu_load(vcpu); 1905 vcpu_load(vcpu);
1906 1906
1907 set_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
1908 set_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
1909 set_segment(vcpu, &sregs->es, VCPU_SREG_ES);
1910 set_segment(vcpu, &sregs->fs, VCPU_SREG_FS);
1911 set_segment(vcpu, &sregs->gs, VCPU_SREG_GS);
1912 set_segment(vcpu, &sregs->ss, VCPU_SREG_SS);
1913
1914 set_segment(vcpu, &sregs->tr, VCPU_SREG_TR);
1915 set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
1916
1917 dt.limit = sregs->idt.limit; 1907 dt.limit = sregs->idt.limit;
1918 dt.base = sregs->idt.base; 1908 dt.base = sregs->idt.base;
1919 kvm_arch_ops->set_idt(vcpu, &dt); 1909 kvm_arch_ops->set_idt(vcpu, &dt);
@@ -1953,6 +1943,16 @@ static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1953 if (vcpu->irq_pending[i]) 1943 if (vcpu->irq_pending[i])
1954 __set_bit(i, &vcpu->irq_summary); 1944 __set_bit(i, &vcpu->irq_summary);
1955 1945
1946 set_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
1947 set_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
1948 set_segment(vcpu, &sregs->es, VCPU_SREG_ES);
1949 set_segment(vcpu, &sregs->fs, VCPU_SREG_FS);
1950 set_segment(vcpu, &sregs->gs, VCPU_SREG_GS);
1951 set_segment(vcpu, &sregs->ss, VCPU_SREG_SS);
1952
1953 set_segment(vcpu, &sregs->tr, VCPU_SREG_TR);
1954 set_segment(vcpu, &sregs->ldt, VCPU_SREG_LDTR);
1955
1956 vcpu_put(vcpu); 1956 vcpu_put(vcpu);
1957 1957
1958 return 0; 1958 return 0;