aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-01-21 15:31:49 +0200
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 12:36:04 -0300
commit836a1b3c3456042704c86aaa3d837b976de9343b (patch)
treecf40744cf19a2e0bc407913ac86d53081116b022 /arch/x86/kvm/x86.h
parentKVM: Add a helper for checking if the guest is in protected mode (diff)
downloadlinux-dev-836a1b3c3456042704c86aaa3d837b976de9343b.tar.xz
linux-dev-836a1b3c3456042704c86aaa3d837b976de9343b.zip
KVM: Move cr0/cr4/efer related helpers to x86.h
They have more general scope than the mmu. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to '')
-rw-r--r--arch/x86/kvm/x86.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index f783d8fe0d1d..2dc24a755b6d 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -41,4 +41,28 @@ static inline bool is_protmode(struct kvm_vcpu *vcpu)
return kvm_read_cr0_bits(vcpu, X86_CR0_PE);
}
+static inline int is_long_mode(struct kvm_vcpu *vcpu)
+{
+#ifdef CONFIG_X86_64
+ return vcpu->arch.shadow_efer & EFER_LMA;
+#else
+ return 0;
+#endif
+}
+
+static inline int is_pae(struct kvm_vcpu *vcpu)
+{
+ return kvm_read_cr4_bits(vcpu, X86_CR4_PAE);
+}
+
+static inline int is_pse(struct kvm_vcpu *vcpu)
+{
+ return kvm_read_cr4_bits(vcpu, X86_CR4_PSE);
+}
+
+static inline int is_paging(struct kvm_vcpu *vcpu)
+{
+ return kvm_read_cr0_bits(vcpu, X86_CR0_PG);
+}
+
#endif