summaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm.h
diff options
context:
space:
mode:
authorAvi Kivity2006-12-30 01:49:37 +0100
committerLinus Torvalds2006-12-30 19:56:44 +0100
commita9058ecd3cd72634cf548588ce79b3f225c9ca32 (patch)
tree11d1edd2dfdcec03ba6b54b3b06d41cae826b940 /drivers/kvm/kvm.h
parent[PATCH] KVM: Use boot_cpu_data instead of current_cpu_data (diff)
downloadkernel-qcow2-linux-a9058ecd3cd72634cf548588ce79b3f225c9ca32.tar.gz
kernel-qcow2-linux-a9058ecd3cd72634cf548588ce79b3f225c9ca32.tar.xz
kernel-qcow2-linux-a9058ecd3cd72634cf548588ce79b3f225c9ca32.zip
[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 <avi@qumranet.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/kvm/kvm.h')
-rw-r--r--drivers/kvm/kvm.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 930e04ce1af6..c2db4218d6cc 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -278,7 +278,6 @@ struct kvm_arch_ops {
struct kvm_segment *var, int seg);
void (*set_segment)(struct kvm_vcpu *vcpu,
struct kvm_segment *var, int seg);
- int (*is_long_mode)(struct kvm_vcpu *vcpu);
void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l);
void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0);
void (*set_cr0_no_modeswitch)(struct kvm_vcpu *vcpu,
@@ -403,6 +402,15 @@ static inline struct page *_gfn_to_page(struct kvm *kvm, gfn_t gfn)
return (slot) ? slot->phys_mem[gfn - slot->base_gfn] : NULL;
}
+static inline int is_long_mode(struct kvm_vcpu *vcpu)
+{
+#ifdef CONFIG_X86_64
+ return vcpu->shadow_efer & EFER_LME;
+#else
+ return 0;
+#endif
+}
+
static inline int is_pae(struct kvm_vcpu *vcpu)
{
return vcpu->cr4 & CR4_PAE_MASK;