aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0a96c2c7e191..13a99cac3679 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -126,10 +126,8 @@ static inline int valid_vcpu(int n)
126 return likely(n >= 0 && n < KVM_MAX_VCPUS); 126 return likely(n >= 0 && n < KVM_MAX_VCPUS);
127} 127}
128 128
129int kvm_read_guest(struct kvm_vcpu *vcpu, 129int kvm_read_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size,
130 gva_t addr, 130 void *dest)
131 unsigned long size,
132 void *dest)
133{ 131{
134 unsigned char *host_buf = dest; 132 unsigned char *host_buf = dest;
135 unsigned long req_size = size; 133 unsigned long req_size = size;
@@ -161,10 +159,8 @@ int kvm_read_guest(struct kvm_vcpu *vcpu,
161} 159}
162EXPORT_SYMBOL_GPL(kvm_read_guest); 160EXPORT_SYMBOL_GPL(kvm_read_guest);
163 161
164int kvm_write_guest(struct kvm_vcpu *vcpu, 162int kvm_write_guest(struct kvm_vcpu *vcpu, gva_t addr, unsigned long size,
165 gva_t addr, 163 void *data)
166 unsigned long size,
167 void *data)
168{ 164{
169 unsigned char *host_buf = data; 165 unsigned char *host_buf = data;
170 unsigned long req_size = size; 166 unsigned long req_size = size;
@@ -457,7 +453,7 @@ EXPORT_SYMBOL_GPL(set_cr4);
457void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) 453void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
458{ 454{
459 if (is_long_mode(vcpu)) { 455 if (is_long_mode(vcpu)) {
460 if ( cr3 & CR3_L_MODE_RESEVED_BITS) { 456 if (cr3 & CR3_L_MODE_RESEVED_BITS) {
461 printk(KERN_DEBUG "set_cr3: #GP, reserved bits\n"); 457 printk(KERN_DEBUG "set_cr3: #GP, reserved bits\n");
462 inject_gp(vcpu); 458 inject_gp(vcpu);
463 return; 459 return;
@@ -774,7 +770,6 @@ static int kvm_dev_ioctl_get_dirty_log(struct kvm *kvm,
774 if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n)) 770 if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n))
775 goto out; 771 goto out;
776 772
777
778 if (any) { 773 if (any) {
779 cleared = 0; 774 cleared = 0;
780 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 775 for (i = 0; i < KVM_MAX_VCPUS; ++i) {
@@ -903,8 +898,9 @@ static int emulator_read_emulated(unsigned long addr,
903 return X86EMUL_CONTINUE; 898 return X86EMUL_CONTINUE;
904 else { 899 else {
905 gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr); 900 gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, addr);
901
906 if (gpa == UNMAPPED_GVA) 902 if (gpa == UNMAPPED_GVA)
907 return vcpu_printf(vcpu, "not present\n"), X86EMUL_PROPAGATE_FAULT; 903 return X86EMUL_PROPAGATE_FAULT;
908 vcpu->mmio_needed = 1; 904 vcpu->mmio_needed = 1;
909 vcpu->mmio_phys_addr = gpa; 905 vcpu->mmio_phys_addr = gpa;
910 vcpu->mmio_size = bytes; 906 vcpu->mmio_size = bytes;
@@ -1801,12 +1797,11 @@ static long kvm_dev_ioctl(struct file *filp,
1801 case KVM_GET_API_VERSION: 1797 case KVM_GET_API_VERSION:
1802 r = KVM_API_VERSION; 1798 r = KVM_API_VERSION;
1803 break; 1799 break;
1804 case KVM_CREATE_VCPU: { 1800 case KVM_CREATE_VCPU:
1805 r = kvm_dev_ioctl_create_vcpu(kvm, arg); 1801 r = kvm_dev_ioctl_create_vcpu(kvm, arg);
1806 if (r) 1802 if (r)
1807 goto out; 1803 goto out;
1808 break; 1804 break;
1809 }
1810 case KVM_RUN: { 1805 case KVM_RUN: {
1811 struct kvm_run kvm_run; 1806 struct kvm_run kvm_run;
1812 1807