diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-06-11 04:26:11 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:32:56 -0400 |
commit | 6edf14d8d0df144d6928799040f46fa37b5460ae (patch) | |
tree | 521ba25839ba2a4f0d438baf50a568c714292cce /arch/x86/kvm/x86.c | |
parent | 54dee9933e8d93589ad63ec3d6be39f1921b0767 (diff) |
KVM: Replace pending exception by PF if it happens serially
Replace previous exception with a new one in a hope that instruction
re-execution will regenerate lost exception.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 30492f0ba4ea..a066876f1373 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -181,16 +181,22 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long addr, | |||
181 | ++vcpu->stat.pf_guest; | 181 | ++vcpu->stat.pf_guest; |
182 | 182 | ||
183 | if (vcpu->arch.exception.pending) { | 183 | if (vcpu->arch.exception.pending) { |
184 | if (vcpu->arch.exception.nr == PF_VECTOR) { | 184 | switch(vcpu->arch.exception.nr) { |
185 | printk(KERN_DEBUG "kvm: inject_page_fault:" | 185 | case DF_VECTOR: |
186 | " double fault 0x%lx\n", addr); | ||
187 | vcpu->arch.exception.nr = DF_VECTOR; | ||
188 | vcpu->arch.exception.error_code = 0; | ||
189 | } else if (vcpu->arch.exception.nr == DF_VECTOR) { | ||
190 | /* triple fault -> shutdown */ | 186 | /* triple fault -> shutdown */ |
191 | set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests); | 187 | set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests); |
188 | return; | ||
189 | case PF_VECTOR: | ||
190 | vcpu->arch.exception.nr = DF_VECTOR; | ||
191 | vcpu->arch.exception.error_code = 0; | ||
192 | return; | ||
193 | default: | ||
194 | /* replace previous exception with a new one in a hope | ||
195 | that instruction re-execution will regenerate lost | ||
196 | exception */ | ||
197 | vcpu->arch.exception.pending = false; | ||
198 | break; | ||
192 | } | 199 | } |
193 | return; | ||
194 | } | 200 | } |
195 | vcpu->arch.cr2 = addr; | 201 | vcpu->arch.cr2 = addr; |
196 | kvm_queue_exception_e(vcpu, PF_VECTOR, error_code); | 202 | kvm_queue_exception_e(vcpu, PF_VECTOR, error_code); |