diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2010-11-29 16:51:47 (GMT) |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 09:30:04 (GMT) |
commit | ec9e60b21977007e3dfacc2b8fe3a8fbb9276b51 (patch) | |
tree | 419f1a51980fb3cd93ab857d0c47457795fa90ef /arch/x86/kvm/kvm_cache_regs.h | |
parent | 6389ee946303cb4313dba0a49865e495a53351ff (diff) | |
download | linux-ec9e60b21977007e3dfacc2b8fe3a8fbb9276b51.tar.xz |
KVM: X86: Introduce generic guest-mode representation
This patch introduces a generic representation of guest-mode
fpr a vcpu. This currently only exists in the SVM code.
Having this representation generic will help making the
non-svm code aware of nesting when this is necessary.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/kvm_cache_regs.h')
-rw-r--r-- | arch/x86/kvm/kvm_cache_regs.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h index 975bb45..95ac3af 100644 --- a/arch/x86/kvm/kvm_cache_regs.h +++ b/arch/x86/kvm/kvm_cache_regs.h @@ -84,4 +84,19 @@ static inline u64 kvm_read_edx_eax(struct kvm_vcpu *vcpu) | ((u64)(kvm_register_read(vcpu, VCPU_REGS_RDX) & -1u) << 32); } +static inline void enter_guest_mode(struct kvm_vcpu *vcpu) +{ + vcpu->arch.hflags |= HF_GUEST_MASK; +} + +static inline void leave_guest_mode(struct kvm_vcpu *vcpu) +{ + vcpu->arch.hflags &= ~HF_GUEST_MASK; +} + +static inline bool is_guest_mode(struct kvm_vcpu *vcpu) +{ + return vcpu->arch.hflags & HF_GUEST_MASK; +} + #endif |