Skip to content

Commit

Permalink
kvm: x86: vmx: cleanup handle_ept_violation
Browse files Browse the repository at this point in the history
Instead, just use PFERR_{FETCH, PRESENT, WRITE}_MASK
inside handle_ept_violation() for slightly better code.

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Tiejun Chen authored and Paolo Bonzini committed Nov 18, 2014
1 parent f210f75 commit 81ed33e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -5482,11 +5482,11 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
trace_kvm_page_fault(gpa, exit_qualification);

/* It is a write fault? */
error_code = exit_qualification & (1U << 1);
error_code = exit_qualification & PFERR_WRITE_MASK;
/* It is a fetch fault? */
error_code |= (exit_qualification & (1U << 2)) << 2;
error_code |= (exit_qualification << 2) & PFERR_FETCH_MASK;
/* ept page table is present? */
error_code |= (exit_qualification >> 3) & 0x1;
error_code |= (exit_qualification >> 3) & PFERR_PRESENT_MASK;

vcpu->arch.exit_qualification = exit_qualification;

Expand Down

0 comments on commit 81ed33e

Please sign in to comment.