Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186001
b: refs/heads/master
c: 888f9f3
h: refs/heads/master
i:
  185999: a0b98ca
v: v3
  • Loading branch information
Avi Kivity authored and Marcelo Tosatti committed Mar 1, 2010
1 parent 762e2a3 commit c950492
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bff7827479ed004c0394e6e7b35ae601bb1a97ad
refs/heads/master: 888f9f3e0cfa32baf05b3840f0248f5502292a0f
29 changes: 7 additions & 22 deletions trunk/arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,8 @@ static void init_vmcb(struct vcpu_svm *svm)
control->intercept &= ~((1ULL << INTERCEPT_TASK_SWITCH) |
(1ULL << INTERCEPT_INVLPG));
control->intercept_exceptions &= ~(1 << PF_VECTOR);
control->intercept_cr_read &= ~(INTERCEPT_CR0_MASK|
INTERCEPT_CR3_MASK);
control->intercept_cr_write &= ~(INTERCEPT_CR0_MASK|
INTERCEPT_CR3_MASK);
control->intercept_cr_read &= ~INTERCEPT_CR3_MASK;
control->intercept_cr_write &= ~INTERCEPT_CR3_MASK;
save->g_pat = 0x0007040600070406ULL;
save->cr3 = 0;
save->cr4 = 0;
Expand Down Expand Up @@ -982,15 +980,13 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
}
}
#endif
if (npt_enabled)
goto set;

vcpu->arch.cr0 = cr0;
cr0 |= X86_CR0_PG | X86_CR0_WP;

if (!npt_enabled)
cr0 |= X86_CR0_PG | X86_CR0_WP;

if (!vcpu->fpu_active)
cr0 |= X86_CR0_TS;
set:
/*
* re-enable caching here because the QEMU bios
* does not do it - this results in some delay at
Expand Down Expand Up @@ -2386,21 +2382,10 @@ static int handle_exit(struct kvm_vcpu *vcpu)

svm_complete_interrupts(svm);

if (npt_enabled) {
int mmu_reload = 0;
if ((kvm_read_cr0_bits(vcpu, X86_CR0_PG) ^ svm->vmcb->save.cr0)
& X86_CR0_PG) {
svm_set_cr0(vcpu, svm->vmcb->save.cr0);
mmu_reload = 1;
}
if (!(svm->vmcb->control.intercept_cr_write & INTERCEPT_CR0_MASK))
vcpu->arch.cr0 = svm->vmcb->save.cr0;
if (npt_enabled)
vcpu->arch.cr3 = svm->vmcb->save.cr3;
if (mmu_reload) {
kvm_mmu_reset_context(vcpu);
kvm_mmu_load(vcpu);
}
}


if (svm->vmcb->control.exit_code == SVM_EXIT_ERR) {
kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
Expand Down

0 comments on commit c950492

Please sign in to comment.