aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-08-02 08:30:20 -0400
committerAvi Kivity <avi@redhat.com>2011-05-11 07:56:54 -0400
commitf6e78475894d6534d7d62714a95e2265f53d2a92 (patch)
tree86250a469ccac50490a2d922ee2a1a2d0f5ea915 /arch/x86/kvm/x86.c
parent0ee8dcb87e403397e575674d0e79272b06dea12e (diff)
KVM: Use kvm_get_rflags() and kvm_set_rflags() instead of the raw versions
Some rflags bits are owned by the host, not guest, so we need to use kvm_get_rflags() to strip those bits away or kvm_set_rflags() to add them back. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 934b4c6b0bf9..3a557eefd2fb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4310,7 +4310,7 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu)
4310 kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); 4310 kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
4311 4311
4312 vcpu->arch.emulate_ctxt.vcpu = vcpu; 4312 vcpu->arch.emulate_ctxt.vcpu = vcpu;
4313 vcpu->arch.emulate_ctxt.eflags = kvm_x86_ops->get_rflags(vcpu); 4313 vcpu->arch.emulate_ctxt.eflags = kvm_get_rflags(vcpu);
4314 vcpu->arch.emulate_ctxt.eip = kvm_rip_read(vcpu); 4314 vcpu->arch.emulate_ctxt.eip = kvm_rip_read(vcpu);
4315 vcpu->arch.emulate_ctxt.mode = 4315 vcpu->arch.emulate_ctxt.mode =
4316 (!is_protmode(vcpu)) ? X86EMUL_MODE_REAL : 4316 (!is_protmode(vcpu)) ? X86EMUL_MODE_REAL :
@@ -4340,7 +4340,7 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq)
4340 vcpu->arch.emulate_ctxt.eip = c->eip; 4340 vcpu->arch.emulate_ctxt.eip = c->eip;
4341 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs); 4341 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs);
4342 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip); 4342 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
4343 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); 4343 kvm_set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
4344 4344
4345 if (irq == NMI_VECTOR) 4345 if (irq == NMI_VECTOR)
4346 vcpu->arch.nmi_pending = false; 4346 vcpu->arch.nmi_pending = false;
@@ -4473,7 +4473,7 @@ restart:
4473 r = EMULATE_DONE; 4473 r = EMULATE_DONE;
4474 4474
4475 toggle_interruptibility(vcpu, vcpu->arch.emulate_ctxt.interruptibility); 4475 toggle_interruptibility(vcpu, vcpu->arch.emulate_ctxt.interruptibility);
4476 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); 4476 kvm_set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
4477 kvm_make_request(KVM_REQ_EVENT, vcpu); 4477 kvm_make_request(KVM_REQ_EVENT, vcpu);
4478 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs); 4478 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs);
4479 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip); 4479 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
@@ -5592,7 +5592,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason,
5592 5592
5593 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs); 5593 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs);
5594 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip); 5594 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
5595 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); 5595 kvm_set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
5596 kvm_make_request(KVM_REQ_EVENT, vcpu); 5596 kvm_make_request(KVM_REQ_EVENT, vcpu);
5597 return EMULATE_DONE; 5597 return EMULATE_DONE;
5598} 5598}