aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-09-27 06:03:27 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:53:10 -0400
commit20bd40dc6492da293993559555df07d467fd202e (patch)
tree08396e178fa473a2d70a9797282d81315ce74b9c /arch
parent6292757fb0e758748fdb441861f8c50d397de9f0 (diff)
KVM: MMU: cleanup for error mask set while walk guest page table
Small cleanup for set page fault error code Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/paging_tmpl.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 2bdd843ad63f..a83ff3794055 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -224,9 +224,7 @@ walk:
224 is_cpuid_PSE36()) 224 is_cpuid_PSE36())
225 gfn += pse36_gfn_delta(pte); 225 gfn += pse36_gfn_delta(pte);
226 226
227 access |= write_fault ? PFERR_WRITE_MASK : 0; 227 access |= write_fault | fetch_fault | user_fault;
228 access |= fetch_fault ? PFERR_FETCH_MASK : 0;
229 access |= user_fault ? PFERR_USER_MASK : 0;
230 228
231 real_gpa = mmu->translate_gpa(vcpu, gfn_to_gpa(gfn), 229 real_gpa = mmu->translate_gpa(vcpu, gfn_to_gpa(gfn),
232 access); 230 access);
@@ -268,10 +266,9 @@ error:
268 walker->error_code = 0; 266 walker->error_code = 0;
269 if (present) 267 if (present)
270 walker->error_code |= PFERR_PRESENT_MASK; 268 walker->error_code |= PFERR_PRESENT_MASK;
271 if (write_fault) 269
272 walker->error_code |= PFERR_WRITE_MASK; 270 walker->error_code |= write_fault | user_fault;
273 if (user_fault) 271
274 walker->error_code |= PFERR_USER_MASK;
275 if (fetch_fault && mmu->nx) 272 if (fetch_fault && mmu->nx)
276 walker->error_code |= PFERR_FETCH_MASK; 273 walker->error_code |= PFERR_FETCH_MASK;
277 if (rsvd_fault) 274 if (rsvd_fault)
@@ -673,9 +670,9 @@ static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr, u32 access,
673 int r; 670 int r;
674 671
675 r = FNAME(walk_addr)(&walker, vcpu, vaddr, 672 r = FNAME(walk_addr)(&walker, vcpu, vaddr,
676 !!(access & PFERR_WRITE_MASK), 673 access & PFERR_WRITE_MASK,
677 !!(access & PFERR_USER_MASK), 674 access & PFERR_USER_MASK,
678 !!(access & PFERR_FETCH_MASK)); 675 access & PFERR_FETCH_MASK);
679 676
680 if (r) { 677 if (r) {
681 gpa = gfn_to_gpa(walker.gfn); 678 gpa = gfn_to_gpa(walker.gfn);