Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54117
b: refs/heads/master
c: e7df56e
h: refs/heads/master
i:
  54115: 8e95685
v: v3
  • Loading branch information
Avi Kivity committed May 3, 2007
1 parent 4ebba1f commit e34e0da
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 94dfbdb3894eda2f673b70e20da2743c4a8d3968
refs/heads/master: e7df56e4a00358b6975fae3b70dc9df1282d427a
1 change: 1 addition & 0 deletions trunk/drivers/kvm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ struct kvm_vcpu {
int mmio_size;
unsigned char mmio_data[8];
gpa_t mmio_phys_addr;
gva_t mmio_fault_cr2;
struct kvm_pio_request pio;
void *pio_data;

Expand Down
16 changes: 13 additions & 3 deletions trunk/drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
int r;
int cs_db, cs_l;

vcpu->mmio_fault_cr2 = cr2;
kvm_arch_ops->cache_regs(vcpu);

kvm_arch_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
Expand Down Expand Up @@ -1804,14 +1805,23 @@ static int kvm_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
r = complete_pio(vcpu);
if (r)
goto out;
} else {
} else if (!vcpu->mmio_is_write) {
memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8);
vcpu->mmio_read_completed = 1;
vcpu->mmio_needed = 0;
r = emulate_instruction(vcpu, kvm_run,
vcpu->mmio_fault_cr2, 0);
if (r == EMULATE_DO_MMIO) {
/*
* Read-modify-write. Back to userspace.
*/
kvm_run->exit_reason = KVM_EXIT_MMIO;
r = 0;
goto out;
}
}
}

vcpu->mmio_needed = 0;

if (kvm_run->exit_reason == KVM_EXIT_HYPERCALL) {
kvm_arch_ops->cache_regs(vcpu);
vcpu->regs[VCPU_REGS_RAX] = kvm_run->hypercall.ret;
Expand Down

0 comments on commit e34e0da

Please sign in to comment.