aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-12-29 11:07:30 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:35:50 -0500
commit4d4ec0874583b127caac1d0f84033c8971b2fd2a (patch)
tree2ed5d1edff6a5253561fff0593e89d1c49518b1b /arch/x86/kvm/emulate.c
parenta1f83a74feaa9718a5c61587256ea6cc1b993d16 (diff)
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/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 7e8faea4651e..0f89e320bc96 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1515,7 +1515,7 @@ emulate_syscall(struct x86_emulate_ctxt *ctxt)
1515 1515
1516 /* syscall is not available in real mode */ 1516 /* syscall is not available in real mode */
1517 if (c->lock_prefix || ctxt->mode == X86EMUL_MODE_REAL 1517 if (c->lock_prefix || ctxt->mode == X86EMUL_MODE_REAL
1518 || !(ctxt->vcpu->arch.cr0 & X86_CR0_PE)) 1518 || !kvm_read_cr0_bits(ctxt->vcpu, X86_CR0_PE))
1519 return -1; 1519 return -1;
1520 1520
1521 setup_syscalls_segments(ctxt, &cs, &ss); 1521 setup_syscalls_segments(ctxt, &cs, &ss);
@@ -1569,7 +1569,7 @@ emulate_sysenter(struct x86_emulate_ctxt *ctxt)
1569 1569
1570 /* inject #GP if in real mode or paging is disabled */ 1570 /* inject #GP if in real mode or paging is disabled */
1571 if (ctxt->mode == X86EMUL_MODE_REAL || 1571 if (ctxt->mode == X86EMUL_MODE_REAL ||
1572 !(ctxt->vcpu->arch.cr0 & X86_CR0_PE)) { 1572 !kvm_read_cr0_bits(ctxt->vcpu, X86_CR0_PE)) {
1573 kvm_inject_gp(ctxt->vcpu, 0); 1573 kvm_inject_gp(ctxt->vcpu, 0);
1574 return -1; 1574 return -1;
1575 } 1575 }
@@ -1635,7 +1635,7 @@ emulate_sysexit(struct x86_emulate_ctxt *ctxt)
1635 1635
1636 /* inject #GP if in real mode or paging is disabled */ 1636 /* inject #GP if in real mode or paging is disabled */
1637 if (ctxt->mode == X86EMUL_MODE_REAL 1637 if (ctxt->mode == X86EMUL_MODE_REAL
1638 || !(ctxt->vcpu->arch.cr0 & X86_CR0_PE)) { 1638 || !kvm_read_cr0_bits(ctxt->vcpu, X86_CR0_PE)) {
1639 kvm_inject_gp(ctxt->vcpu, 0); 1639 kvm_inject_gp(ctxt->vcpu, 0);
1640 return -1; 1640 return -1;
1641 } 1641 }