diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2007-04-27 02:29:21 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:31 -0400 |
commit | 25c4c2762e31a75403eca0dd59f2cab85e3a2532 (patch) | |
tree | 151c4a309da81608bdf729d701dcbfc3d4e1e9d7 /drivers/kvm/kvm_main.c | |
parent | e0e5127d06957e76da3906b7a58d5d2665e81f59 (diff) |
KVM: VMX: Properly shadow the CR0 register in the vcpu struct
Set all of the host mask bits for CR0 so that we can maintain a proper
shadow of CR0. This exposes CR0.TS, paving the way for lazy fpu handling.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r-- | drivers/kvm/kvm_main.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 67554034d001..cdf0b176851d 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -510,7 +510,6 @@ EXPORT_SYMBOL_GPL(set_cr0); | |||
510 | 510 | ||
511 | void lmsw(struct kvm_vcpu *vcpu, unsigned long msw) | 511 | void lmsw(struct kvm_vcpu *vcpu, unsigned long msw) |
512 | { | 512 | { |
513 | kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); | ||
514 | set_cr0(vcpu, (vcpu->cr0 & ~0x0ful) | (msw & 0x0f)); | 513 | set_cr0(vcpu, (vcpu->cr0 & ~0x0ful) | (msw & 0x0f)); |
515 | } | 514 | } |
516 | EXPORT_SYMBOL_GPL(lmsw); | 515 | EXPORT_SYMBOL_GPL(lmsw); |
@@ -1117,7 +1116,6 @@ int emulate_clts(struct kvm_vcpu *vcpu) | |||
1117 | { | 1116 | { |
1118 | unsigned long cr0; | 1117 | unsigned long cr0; |
1119 | 1118 | ||
1120 | kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); | ||
1121 | cr0 = vcpu->cr0 & ~CR0_TS_MASK; | 1119 | cr0 = vcpu->cr0 & ~CR0_TS_MASK; |
1122 | kvm_arch_ops->set_cr0(vcpu, cr0); | 1120 | kvm_arch_ops->set_cr0(vcpu, cr0); |
1123 | return X86EMUL_CONTINUE; | 1121 | return X86EMUL_CONTINUE; |
@@ -1318,7 +1316,7 @@ void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw, | |||
1318 | 1316 | ||
1319 | unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr) | 1317 | unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr) |
1320 | { | 1318 | { |
1321 | kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); | 1319 | kvm_arch_ops->decache_cr4_guest_bits(vcpu); |
1322 | switch (cr) { | 1320 | switch (cr) { |
1323 | case 0: | 1321 | case 0: |
1324 | return vcpu->cr0; | 1322 | return vcpu->cr0; |
@@ -1934,7 +1932,7 @@ static int kvm_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, | |||
1934 | sregs->gdt.limit = dt.limit; | 1932 | sregs->gdt.limit = dt.limit; |
1935 | sregs->gdt.base = dt.base; | 1933 | sregs->gdt.base = dt.base; |
1936 | 1934 | ||
1937 | kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); | 1935 | kvm_arch_ops->decache_cr4_guest_bits(vcpu); |
1938 | sregs->cr0 = vcpu->cr0; | 1936 | sregs->cr0 = vcpu->cr0; |
1939 | sregs->cr2 = vcpu->cr2; | 1937 | sregs->cr2 = vcpu->cr2; |
1940 | sregs->cr3 = vcpu->cr3; | 1938 | sregs->cr3 = vcpu->cr3; |
@@ -1985,7 +1983,7 @@ static int kvm_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | |||
1985 | #endif | 1983 | #endif |
1986 | vcpu->apic_base = sregs->apic_base; | 1984 | vcpu->apic_base = sregs->apic_base; |
1987 | 1985 | ||
1988 | kvm_arch_ops->decache_cr0_cr4_guest_bits(vcpu); | 1986 | kvm_arch_ops->decache_cr4_guest_bits(vcpu); |
1989 | 1987 | ||
1990 | mmu_reset_needed |= vcpu->cr0 != sregs->cr0; | 1988 | mmu_reset_needed |= vcpu->cr0 != sregs->cr0; |
1991 | kvm_arch_ops->set_cr0(vcpu, sregs->cr0); | 1989 | kvm_arch_ops->set_cr0(vcpu, sregs->cr0); |