diff options
author | Avi Kivity <avi@qumranet.com> | 2007-04-17 03:53:22 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:29 -0400 |
commit | c9047f533373e934b96d19d6a3d313ca2132fbe5 (patch) | |
tree | e64c9ed660d71321dcc9fb9d035fbc45a42fcaba /drivers | |
parent | 364b625b561b1dd74e6fa696949ae3de28999a66 (diff) |
KVM: Handle guest page faults when emulating mmio
Usually, guest page faults are detected by the kvm page fault handler,
which detects if they are shadow faults, mmio faults, pagetable faults,
or normal guest page faults.
However, in ceratin circumstances, we can detect a page fault much later.
One of these events is the following combination:
- A two memory operand instruction (e.g. movsb) is executed.
- The first operand is in mmio space (which is the fault reported to kvm)
- The second operand is in an ummaped address (e.g. a guest page fault)
The Windows 2000 installer does such an access, an promptly hangs. Fix
by adding the missing page fault injection on that path.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/kvm/kvm_main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index ab4dbd7fa5f8..03c0ee74d757 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1071,8 +1071,10 @@ static int emulator_write_emulated(unsigned long addr, | |||
1071 | struct kvm_vcpu *vcpu = ctxt->vcpu; | 1071 | struct kvm_vcpu *vcpu = ctxt->vcpu; |
1072 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr); | 1072 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr); |
1073 | 1073 | ||
1074 | if (gpa == UNMAPPED_GVA) | 1074 | if (gpa == UNMAPPED_GVA) { |
1075 | kvm_arch_ops->inject_page_fault(vcpu, addr, 2); | ||
1075 | return X86EMUL_PROPAGATE_FAULT; | 1076 | return X86EMUL_PROPAGATE_FAULT; |
1077 | } | ||
1076 | 1078 | ||
1077 | if (emulator_write_phys(vcpu, gpa, val, bytes)) | 1079 | if (emulator_write_phys(vcpu, gpa, val, bytes)) |
1078 | return X86EMUL_CONTINUE; | 1080 | return X86EMUL_CONTINUE; |