diff options
author | Avi Kivity <avi@redhat.com> | 2010-11-22 16:53:26 +0100 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 10:29:59 +0100 |
commit | ab9ae3138789afacd133a9c4b3d7a3f1578e25c7 (patch) | |
tree | 27c81b48c395dffd2049b37bafef940573ae6841 /arch/x86/kvm/paging_tmpl.h | |
parent | KVM: x86 emulator: simplify exception generation (diff) | |
download | linux-ab9ae3138789afacd133a9c4b3d7a3f1578e25c7.tar.xz linux-ab9ae3138789afacd133a9c4b3d7a3f1578e25c7.zip |
KVM: Push struct x86_exception info the various gva_to_gpa variants
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/paging_tmpl.h')
-rw-r--r-- | arch/x86/kvm/paging_tmpl.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 2b3d66c7b68d..3ac39de444ec 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h @@ -677,7 +677,7 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) } static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr, u32 access, - u32 *error) + struct x86_exception *exception) { struct guest_walker walker; gpa_t gpa = UNMAPPED_GVA; @@ -688,14 +688,18 @@ static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr, u32 access, if (r) { gpa = gfn_to_gpa(walker.gfn); gpa |= vaddr & ~PAGE_MASK; - } else if (error) - *error = walker.error_code; + } else if (exception) { + exception->vector = PF_VECTOR; + exception->error_code_valid = true; + exception->error_code = walker.error_code; + } return gpa; } static gpa_t FNAME(gva_to_gpa_nested)(struct kvm_vcpu *vcpu, gva_t vaddr, - u32 access, u32 *error) + u32 access, + struct x86_exception *exception) { struct guest_walker walker; gpa_t gpa = UNMAPPED_GVA; @@ -706,8 +710,11 @@ static gpa_t FNAME(gva_to_gpa_nested)(struct kvm_vcpu *vcpu, gva_t vaddr, if (r) { gpa = gfn_to_gpa(walker.gfn); gpa |= vaddr & ~PAGE_MASK; - } else if (error) - *error = walker.error_code; + } else if (exception) { + exception->vector = PF_VECTOR; + exception->error_code_valid = true; + exception->error_code = walker.error_code; + } return gpa; } |