diff options
author | Gleb Natapov <gleb@redhat.com> | 2010-04-28 12:15:40 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 03:35:35 -0400 |
commit | ef050dc0390176ec6888f373edb776587c88be3d (patch) | |
tree | 1e205bbfa3d64385889e976181b086bf3618837e | |
parent | 95c5588652f7742a21c33d9dcce0e043e057d04f (diff) |
KVM: x86 emulator: set RFLAGS outside x86 emulator code
Removes the need for set_flags() callback.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/include/asm/kvm_emulate.h | 1 | ||||
-rw-r--r-- | arch/x86/kvm/emulate.c | 1 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 7 |
3 files changed, 1 insertions, 8 deletions
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h index b7e00cb21c6e..a87d95f09572 100644 --- a/arch/x86/include/asm/kvm_emulate.h +++ b/arch/x86/include/asm/kvm_emulate.h | |||
@@ -142,7 +142,6 @@ struct x86_emulate_ops { | |||
142 | ulong (*get_cr)(int cr, struct kvm_vcpu *vcpu); | 142 | ulong (*get_cr)(int cr, struct kvm_vcpu *vcpu); |
143 | int (*set_cr)(int cr, ulong val, struct kvm_vcpu *vcpu); | 143 | int (*set_cr)(int cr, ulong val, struct kvm_vcpu *vcpu); |
144 | int (*cpl)(struct kvm_vcpu *vcpu); | 144 | int (*cpl)(struct kvm_vcpu *vcpu); |
145 | void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); | ||
146 | int (*get_dr)(int dr, unsigned long *dest, struct kvm_vcpu *vcpu); | 145 | int (*get_dr)(int dr, unsigned long *dest, struct kvm_vcpu *vcpu); |
147 | int (*set_dr)(int dr, unsigned long value, struct kvm_vcpu *vcpu); | 146 | int (*set_dr)(int dr, unsigned long value, struct kvm_vcpu *vcpu); |
148 | int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); | 147 | int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); |
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 437f31bcffea..291e220c69a5 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -3034,7 +3034,6 @@ writeback: | |||
3034 | /* Commit shadow register state. */ | 3034 | /* Commit shadow register state. */ |
3035 | memcpy(ctxt->vcpu->arch.regs, c->regs, sizeof c->regs); | 3035 | memcpy(ctxt->vcpu->arch.regs, c->regs, sizeof c->regs); |
3036 | ctxt->eip = c->eip; | 3036 | ctxt->eip = c->eip; |
3037 | ops->set_rflags(ctxt->vcpu, ctxt->eflags); | ||
3038 | 3037 | ||
3039 | done: | 3038 | done: |
3040 | return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0; | 3039 | return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8f45cc712dda..04ca343ee512 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3806,11 +3806,6 @@ static void emulator_set_segment_selector(u16 sel, int seg, | |||
3806 | kvm_set_segment(vcpu, &kvm_seg, seg); | 3806 | kvm_set_segment(vcpu, &kvm_seg, seg); |
3807 | } | 3807 | } |
3808 | 3808 | ||
3809 | static void emulator_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags) | ||
3810 | { | ||
3811 | kvm_x86_ops->set_rflags(vcpu, rflags); | ||
3812 | } | ||
3813 | |||
3814 | static struct x86_emulate_ops emulate_ops = { | 3809 | static struct x86_emulate_ops emulate_ops = { |
3815 | .read_std = kvm_read_guest_virt_system, | 3810 | .read_std = kvm_read_guest_virt_system, |
3816 | .write_std = kvm_write_guest_virt_system, | 3811 | .write_std = kvm_write_guest_virt_system, |
@@ -3829,7 +3824,6 @@ static struct x86_emulate_ops emulate_ops = { | |||
3829 | .get_cr = emulator_get_cr, | 3824 | .get_cr = emulator_get_cr, |
3830 | .set_cr = emulator_set_cr, | 3825 | .set_cr = emulator_set_cr, |
3831 | .cpl = emulator_get_cpl, | 3826 | .cpl = emulator_get_cpl, |
3832 | .set_rflags = emulator_set_rflags, | ||
3833 | .get_dr = emulator_get_dr, | 3827 | .get_dr = emulator_get_dr, |
3834 | .set_dr = emulator_set_dr, | 3828 | .set_dr = emulator_set_dr, |
3835 | .set_msr = kvm_set_msr, | 3829 | .set_msr = kvm_set_msr, |
@@ -3941,6 +3935,7 @@ restart: | |||
3941 | 3935 | ||
3942 | shadow_mask = vcpu->arch.emulate_ctxt.interruptibility; | 3936 | shadow_mask = vcpu->arch.emulate_ctxt.interruptibility; |
3943 | kvm_x86_ops->set_interrupt_shadow(vcpu, shadow_mask); | 3937 | kvm_x86_ops->set_interrupt_shadow(vcpu, shadow_mask); |
3938 | kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); | ||
3944 | kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip); | 3939 | kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip); |
3945 | 3940 | ||
3946 | if (vcpu->arch.pio.count) { | 3941 | if (vcpu->arch.pio.count) { |