Skip to contentSkip to conversation

KVM: SVM: Always clear interrupt shadow in skip_emulated_instruction

PATCH In review Jan Kiszka 2 participants 2 messages Feb 16, 2010

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 KVM: SVM: Always clear interrupt shadow in skip_emulated_instruction

emulate_instruction(EMULTYPE_SKIP) does not clear the shadow (only full emulation does), so we have to do this here.

---
 arch/x86/kvm/svm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/svm.c +1 -1
index 52f78dd..84c838d 100644
@@ -282,6 +282,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
+	svm_set_interrupt_shadow(vcpu, 0);
 	if (!svm->next_rip) {
 		if (emulate_instruction(vcpu, 0, 0, EMULTYPE_SKIP) !=
 				EMULATE_DONE)
@@ -293,7 +294,6 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
 		       __func__, kvm_rip_read(vcpu), svm->next_rip);
 
 	kvm_rip_write(vcpu, svm->next_rip);
-	svm_set_interrupt_shadow(vcpu, 0);
 }
 
 static int has_svm(void)
#1 lore raw
Quoted 4 lines · Jan Kiszka

emulate_instruction(EMULTYPE_SKIP) does not clear the shadow (only full emulation does), so we have to do this here.

Obviously correct.

Quoted 17 lines
---
 arch/x86/kvm/svm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/svm.c +1 -0
index 52f78dd..84c838d 100644
@@ -282,6 +282,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
+	svm_set_interrupt_shadow(vcpu, 0);
 	if (!svm->next_rip) {
 		if (emulate_instruction(vcpu, 0, 0, EMULTYPE_SKIP) !=
 				EMULATE_DONE)

arch/x86/kvm/svm.c static void skip_emulated_instruction(struct kvm_vcpu *vcpu) · line 299

Quoted 7 lines
arch/x86/kvm/svm.c +0 -1
@@ -293,7 +294,6 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
 		       __func__, kvm_rip_read(vcpu), svm->next_rip);
 
 	kvm_rip_write(vcpu, svm->next_rip);
-	svm_set_interrupt_shadow(vcpu, 0);
 }
 
 static int has_svm(void)

--
Gleb.