summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-01-21 15:31:48 +0200
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 12:36:04 -0300
commit3eeb3288bcbf64da90afc26389b8844df7c34912 (patch)
tree1b7bc55641015605da0b415a928ecf39aac64a2e /arch/x86/kvm/x86.h
parent6b52d18605f580bdffaffd48c8da228c3e848deb (diff)
downloadlinux-3eeb3288bcbf64da90afc26389b8844df7c34912.tar.bz2
KVM: Add a helper for checking if the guest is in protected mode
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.h')
-rw-r--r--arch/x86/kvm/x86.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 5eadea585d2a..f783d8fe0d1d 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -2,6 +2,7 @@
#define ARCH_X86_KVM_X86_H
#include <linux/kvm_host.h>
+#include "kvm_cache_regs.h"
static inline void kvm_clear_exception_queue(struct kvm_vcpu *vcpu)
{
@@ -35,4 +36,9 @@ static inline bool kvm_exception_is_soft(unsigned int nr)
struct kvm_cpuid_entry2 *kvm_find_cpuid_entry(struct kvm_vcpu *vcpu,
u32 function, u32 index);
+static inline bool is_protmode(struct kvm_vcpu *vcpu)
+{
+ return kvm_read_cr0_bits(vcpu, X86_CR0_PE);
+}
+
#endif