From a9058ecd3cd72634cf548588ce79b3f225c9ca32 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Fri, 29 Dec 2006 16:49:37 -0800 Subject: [PATCH] KVM: Simplify is_long_mode() Instead of doing tricky stuff with the arch dependent virtualization registers, take a peek at the guest's efer. This simlifies some code, and fixes some confusion in the mmu branch. Signed-off-by: Avi Kivity Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/kvm/paging_tmpl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/kvm/paging_tmpl.h') diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index a9771b4c5bb..09bb9b4ed12 100644 --- a/drivers/kvm/paging_tmpl.h +++ b/drivers/kvm/paging_tmpl.h @@ -68,7 +68,7 @@ static void FNAME(init_walker)(struct guest_walker *walker, hpa = safe_gpa_to_hpa(vcpu, vcpu->cr3 & PT64_BASE_ADDR_MASK); walker->table = kmap_atomic(pfn_to_page(hpa >> PAGE_SHIFT), KM_USER0); - ASSERT((!kvm_arch_ops->is_long_mode(vcpu) && is_pae(vcpu)) || + ASSERT((!is_long_mode(vcpu) && is_pae(vcpu)) || (vcpu->cr3 & ~(PAGE_MASK | CR3_FLAGS_MASK)) == 0); walker->table = (pt_element_t *)( (unsigned long)walker->table | @@ -131,7 +131,7 @@ static pt_element_t *FNAME(fetch_guest)(struct kvm_vcpu *vcpu, (walker->table[index] & PT_PAGE_SIZE_MASK) && (PTTYPE == 64 || is_pse(vcpu)))) return &walker->table[index]; - if (walker->level != 3 || kvm_arch_ops->is_long_mode(vcpu)) + if (walker->level != 3 || is_long_mode(vcpu)) walker->inherited_ar &= walker->table[index]; paddr = safe_gpa_to_hpa(vcpu, walker->table[index] & PT_BASE_ADDR_MASK); kunmap_atomic(walker->table, KM_USER0); -- cgit v1.2.3