diff options
author | Avi Kivity <avi@qumranet.com> | 2008-07-03 07:59:22 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-10-15 04:15:13 -0400 |
commit | 26eef70c3e8c76e73dff2579c792fc7355f8a291 (patch) | |
tree | 2ec10a2e0f68ca0de77d446fa6d5be9189809e8d /arch/x86/kvm | |
parent | 668f612fa0d8d4120ec5dc0725d7e1ca3152a954 (diff) |
KVM: Clear exception queue before emulating an instruction
If we're emulating an instruction, either it will succeed, in which case
any previously queued exception will be spurious, or we will requeue the
same exception.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/x86.c | 2 | ||||
-rw-r--r-- | arch/x86/kvm/x86.h | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2f0696bc7d2f..5620df2685db 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "i8254.h" | 20 | #include "i8254.h" |
21 | #include "tss.h" | 21 | #include "tss.h" |
22 | #include "kvm_cache_regs.h" | 22 | #include "kvm_cache_regs.h" |
23 | #include "x86.h" | ||
23 | 24 | ||
24 | #include <linux/clocksource.h> | 25 | #include <linux/clocksource.h> |
25 | #include <linux/kvm.h> | 26 | #include <linux/kvm.h> |
@@ -2121,6 +2122,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu, | |||
2121 | int r; | 2122 | int r; |
2122 | struct decode_cache *c; | 2123 | struct decode_cache *c; |
2123 | 2124 | ||
2125 | kvm_clear_exception_queue(vcpu); | ||
2124 | vcpu->arch.mmio_fault_cr2 = cr2; | 2126 | vcpu->arch.mmio_fault_cr2 = cr2; |
2125 | /* | 2127 | /* |
2126 | * TODO: fix x86_emulate.c to use guest_read/write_register | 2128 | * TODO: fix x86_emulate.c to use guest_read/write_register |
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h new file mode 100644 index 000000000000..c666649c4bb2 --- /dev/null +++ b/arch/x86/kvm/x86.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef ARCH_X86_KVM_X86_H | ||
2 | #define ARCH_X86_KVM_X86_H | ||
3 | |||
4 | #include <linux/kvm_host.h> | ||
5 | |||
6 | static inline void kvm_clear_exception_queue(struct kvm_vcpu *vcpu) | ||
7 | { | ||
8 | vcpu->arch.exception.pending = false; | ||
9 | } | ||
10 | |||
11 | #endif | ||