target-i386: do not duplicate page protection checks
commit76c64d33601a4948d6f72022992574a75b6fab97
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 17 Nov 2015 16:09:33 +0000 (17 17:09 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 Jan 2016 17:57:50 +0000 (15 18:57 +0100)
tree184d3890142d5bec526e0b7a422803be14743e17
parent3daa41078aedf227ec98b0d1c9d56b77b6d20153
target-i386: do not duplicate page protection checks

x86_cpu_handle_mmu_fault is currently checking twice for writability
and executability of pages; the first time to decide whether to
trigger a page fault, the second time to compute the "prot" argument
to tlb_set_page_with_attrs.

Reorganize code so that first "prot" is computed, then it is used
to check whether to raise a page fault, then finally PROT_WRITE is
removed if the D bit will have to be set.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386/helper.c