diff options
author | Avi Kivity <avi@redhat.com> | 2010-11-22 10:53:27 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:30:01 -0500 |
commit | 8c28d031657adaf238634ac406834a839d7fa43d (patch) | |
tree | 1818bfd9bb856c4b61339d02fa7fc3ab9172c249 /arch | |
parent | ab9ae3138789afacd133a9c4b3d7a3f1578e25c7 (diff) |
KVM: Push struct x86_exception into walk_addr()
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/paging_tmpl.h | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 3ac39de444ec..ad5a5a28b96e 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -72,7 +72,7 @@ struct guest_walker { | |||
72 | unsigned pt_access; | 72 | unsigned pt_access; |
73 | unsigned pte_access; | 73 | unsigned pte_access; |
74 | gfn_t gfn; | 74 | gfn_t gfn; |
75 | u32 error_code; | 75 | struct x86_exception fault; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | static gfn_t gpte_to_gfn_lvl(pt_element_t gpte, int lvl) | 78 | static gfn_t gpte_to_gfn_lvl(pt_element_t gpte, int lvl) |
@@ -266,21 +266,23 @@ walk: | |||
266 | return 1; | 266 | return 1; |
267 | 267 | ||
268 | error: | 268 | error: |
269 | walker->error_code = 0; | 269 | walker->fault.vector = PF_VECTOR; |
270 | walker->fault.error_code_valid = true; | ||
271 | walker->fault.error_code = 0; | ||
270 | if (present) | 272 | if (present) |
271 | walker->error_code |= PFERR_PRESENT_MASK; | 273 | walker->fault.error_code |= PFERR_PRESENT_MASK; |
272 | 274 | ||
273 | walker->error_code |= write_fault | user_fault; | 275 | walker->fault.error_code |= write_fault | user_fault; |
274 | 276 | ||
275 | if (fetch_fault && mmu->nx) | 277 | if (fetch_fault && mmu->nx) |
276 | walker->error_code |= PFERR_FETCH_MASK; | 278 | walker->fault.error_code |= PFERR_FETCH_MASK; |
277 | if (rsvd_fault) | 279 | if (rsvd_fault) |
278 | walker->error_code |= PFERR_RSVD_MASK; | 280 | walker->fault.error_code |= PFERR_RSVD_MASK; |
279 | 281 | ||
280 | vcpu->arch.fault.address = addr; | 282 | vcpu->arch.fault.address = addr; |
281 | vcpu->arch.fault.error_code = walker->error_code; | 283 | vcpu->arch.fault.error_code = walker->fault.error_code; |
282 | 284 | ||
283 | trace_kvm_mmu_walker_error(walker->error_code); | 285 | trace_kvm_mmu_walker_error(walker->fault.error_code); |
284 | return 0; | 286 | return 0; |
285 | } | 287 | } |
286 | 288 | ||
@@ -688,11 +690,8 @@ static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr, u32 access, | |||
688 | if (r) { | 690 | if (r) { |
689 | gpa = gfn_to_gpa(walker.gfn); | 691 | gpa = gfn_to_gpa(walker.gfn); |
690 | gpa |= vaddr & ~PAGE_MASK; | 692 | gpa |= vaddr & ~PAGE_MASK; |
691 | } else if (exception) { | 693 | } else if (exception) |
692 | exception->vector = PF_VECTOR; | 694 | *exception = walker.fault; |
693 | exception->error_code_valid = true; | ||
694 | exception->error_code = walker.error_code; | ||
695 | } | ||
696 | 695 | ||
697 | return gpa; | 696 | return gpa; |
698 | } | 697 | } |
@@ -710,11 +709,8 @@ static gpa_t FNAME(gva_to_gpa_nested)(struct kvm_vcpu *vcpu, gva_t vaddr, | |||
710 | if (r) { | 709 | if (r) { |
711 | gpa = gfn_to_gpa(walker.gfn); | 710 | gpa = gfn_to_gpa(walker.gfn); |
712 | gpa |= vaddr & ~PAGE_MASK; | 711 | gpa |= vaddr & ~PAGE_MASK; |
713 | } else if (exception) { | 712 | } else if (exception) |
714 | exception->vector = PF_VECTOR; | 713 | *exception = walker.fault; |
715 | exception->error_code_valid = true; | ||
716 | exception->error_code = walker.error_code; | ||
717 | } | ||
718 | 714 | ||
719 | return gpa; | 715 | return gpa; |
720 | } | 716 | } |