summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/kvm_cache_regs.h
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-12-29 18:07:30 +0200
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 12:35:50 -0300
commit4d4ec0874583b127caac1d0f84033c8971b2fd2a (patch)
tree2ed5d1edff6a5253561fff0593e89d1c49518b1b /arch/x86/kvm/kvm_cache_regs.h
parenta1f83a74feaa9718a5c61587256ea6cc1b993d16 (diff)
downloadblackbird-op-linux-4d4ec0874583b127caac1d0f84033c8971b2fd2a.tar.gz
blackbird-op-linux-4d4ec0874583b127caac1d0f84033c8971b2fd2a.zip
KVM: Replace read accesses of vcpu->arch.cr0 by an accessor
Since we'd like to allow the guest to own a few bits of cr0 at times, we need to know when we access those bits. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/kvm_cache_regs.h')
-rw-r--r--arch/x86/kvm/kvm_cache_regs.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h
index 35acc36e1782..f46859751b30 100644
--- a/arch/x86/kvm/kvm_cache_regs.h
+++ b/arch/x86/kvm/kvm_cache_regs.h
@@ -38,6 +38,16 @@ static inline u64 kvm_pdptr_read(struct kvm_vcpu *vcpu, int index)
return vcpu->arch.pdptrs[index];
}
+static inline ulong kvm_read_cr0_bits(struct kvm_vcpu *vcpu, ulong mask)
+{
+ return vcpu->arch.cr0 & mask;
+}
+
+static inline ulong kvm_read_cr0(struct kvm_vcpu *vcpu)
+{
+ return kvm_read_cr0_bits(vcpu, ~0UL);
+}
+
static inline ulong kvm_read_cr4_bits(struct kvm_vcpu *vcpu, ulong mask)
{
if (mask & vcpu->arch.cr4_guest_owned_bits)
OpenPOWER on IntegriCloud