Thanks, Eddie commit 6688a1fbc37330f2c4e16d1a78050b64e1ce5dcc Author: root <root@xxxxxxxxxxxxxxxxxxxx> Date: Mon Mar 30 11:31:10 2009 +0800 cleanup to reuse is_long_mode(vcpu) Signed-off-by: Eddie Dong <eddie.dong@xxxxxxxxx> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index db5021b..affc31d 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -859,7 +859,7 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) struct vcpu_svm *svm = to_svm(vcpu); #ifdef CONFIG_X86_64 - if (vcpu->arch.shadow_efer & EFER_LME) { + if (is_long_mode(vcpu)) { if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) { vcpu->arch.shadow_efer |= EFER_LMA; svm->vmcb->save.efer |= EFER_LMA | EFER_LME; diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9913a1d..b1f1458 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -1543,7 +1543,7 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) enter_rmode(vcpu); #ifdef CONFIG_X86_64 - if (vcpu->arch.shadow_efer & EFER_LME) { + if (is_long_mode(vcpu)) { if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) enter_lmode(vcpu); if (is_paging(vcpu) && !(cr0 & X86_CR0_PG)) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bf6683a..961bd2b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -289,7 +289,7 @@ void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) { #ifdef CONFIG_X86_64 - if ((vcpu->arch.shadow_efer & EFER_LME)) { + if (is_long_mode(vcpu)) { int cs_db, cs_l; if (!is_pae(vcpu)) {
Attachment:
cleanup.patch
Description: cleanup.patch