summaryrefslogtreecommitdiff
path: root/target-i386
diff options
context:
space:
mode:
authorRicky Zhou <ricky@rzhou.org>2014-07-14 13:54:47 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2014-07-15 18:43:14 +0200
commitb4bda1ae57a20a7ce7cb0077946fc33d6d6fd6c5 (patch)
treee9806cae9b6ea9d379f5297e41e0d7451965908a /target-i386
parent146ae00192ffcbd78f6b11fa78c72d1b3d628d8a (diff)
downloadqemu-b4bda1ae57a20a7ce7cb0077946fc33d6d6fd6c5.tar.gz
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>
Diffstat (limited to 'target-i386')
-rw-r--r--target-i386/helper.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 11ca8649b5..47b982b437 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -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) {