diff options
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r-- | drivers/kvm/kvm_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 7d682586423b..b6ad9c6f2efe 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1071,18 +1071,18 @@ static int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
1071 | { | 1071 | { |
1072 | struct page *page; | 1072 | struct page *page; |
1073 | void *virt; | 1073 | void *virt; |
1074 | unsigned offset = offset_in_page(gpa); | ||
1074 | 1075 | ||
1075 | if (((gpa + bytes - 1) >> PAGE_SHIFT) != (gpa >> PAGE_SHIFT)) | 1076 | if (((gpa + bytes - 1) >> PAGE_SHIFT) != (gpa >> PAGE_SHIFT)) |
1076 | return 0; | 1077 | return 0; |
1077 | page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT); | 1078 | page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT); |
1078 | if (!page) | 1079 | if (!page) |
1079 | return 0; | 1080 | return 0; |
1080 | kvm_mmu_pre_write(vcpu, gpa, bytes); | ||
1081 | mark_page_dirty(vcpu->kvm, gpa >> PAGE_SHIFT); | 1081 | mark_page_dirty(vcpu->kvm, gpa >> PAGE_SHIFT); |
1082 | virt = kmap_atomic(page, KM_USER0); | 1082 | virt = kmap_atomic(page, KM_USER0); |
1083 | kvm_mmu_pte_write(vcpu, gpa, virt + offset, val, bytes); | ||
1083 | memcpy(virt + offset_in_page(gpa), val, bytes); | 1084 | memcpy(virt + offset_in_page(gpa), val, bytes); |
1084 | kunmap_atomic(virt, KM_USER0); | 1085 | kunmap_atomic(virt, KM_USER0); |
1085 | kvm_mmu_post_write(vcpu, gpa, bytes); | ||
1086 | return 1; | 1086 | return 1; |
1087 | } | 1087 | } |
1088 | 1088 | ||