KVM: Fix mov cr4 #GP at wrong instruction

On Intel, we call skip_emulated_instruction() even if we injected a #GP,
resulting in the #GP pointing at the wrong address.

Fix by injecting the exception and skipping the instruction at the same place,
so we can do just one or the other.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Avi Kivity
2010-06-10 17:02:15 +03:00
parent 49a9b07edc
commit a83b29c6ad
3 changed files with 5 additions and 11 deletions

View File

@@ -3189,8 +3189,8 @@ static int handle_cr(struct kvm_vcpu *vcpu)
skip_emulated_instruction(vcpu);
return 1;
case 4:
kvm_set_cr4(vcpu, val);
skip_emulated_instruction(vcpu);
err = kvm_set_cr4(vcpu, val);
complete_insn_gp(vcpu, err);
return 1;
case 8: {
u8 cr8_prev = kvm_get_cr8(vcpu);