target-i386: Allow execute from user mode when SMEP is enabled.

Previously, execute would be disabled for all pages with SMEP enabled,
regardless of what mode the access took place in.

Signed-off-by: Ricky Zhou <ricky@rzhou.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Ricky Zhou 2014-07-14 13:54:47 -07:00 committed by Paolo Bonzini
parent 146ae00192
commit b4bda1ae57

View File

@ -750,7 +750,8 @@ do_check_protect_pse36:
/* the page can be put in the TLB */
prot = PAGE_READ;
if (!(ptep & PG_NX_MASK) &&
!((env->cr[4] & CR4_SMEP_MASK) && (ptep & PG_USER_MASK))) {
(mmu_idx == MMU_USER_IDX ||
!((env->cr[4] & CR4_SMEP_MASK) && (ptep & PG_USER_MASK)))) {
prot |= PAGE_EXEC;
}
if (pte & PG_DIRTY_MASK) {