]> xenbits.xensource.com Git - qemu-upstream-unstable.git/commitdiff
target-i386: simplify SMAP handling in MMU_KSMAP_IDX
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 28 Mar 2014 10:49:20 +0000 (11:49 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 5 Jun 2014 14:10:34 +0000 (16:10 +0200)
Do not use this MMU index at all if CR4.SMAP is false, and drop
the SMAP check from x86_cpu_handle_mmu_fault.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-i386/cpu.h
target-i386/helper.c

index b80df664a1d63028219cc7e80177cf5b38d374e3..f2d5b1949ec2d9fd3e3fc9aa8b654f16b1b494fc 100644 (file)
@@ -1162,7 +1162,7 @@ static inline CPUX86State *cpu_init(const char *cpu_model)
 static inline int cpu_mmu_index(CPUX86State *env)
 {
     return (env->hflags & HF_CPL_MASK) == 3 ? MMU_USER_IDX :
-        ((env->hflags & HF_SMAP_MASK) && (env->eflags & AC_MASK))
+        (!(env->hflags & HF_SMAP_MASK) || (env->eflags & AC_MASK))
         ? MMU_KNOSMAP_IDX : MMU_KSMAP_IDX;
 }
 
index 6d8e3506814d21ca4ed9c706c9fd9d28c5c7cdd4..d10de26934c9960f169a71fc3f0f2075d1454e1c 100644 (file)
@@ -649,8 +649,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
                 break;
 
             case MMU_KSMAP_IDX:
-                if (is_write1 != 2 && (env->cr[4] & CR4_SMAP_MASK) &&
-                    (ptep & PG_USER_MASK)) {
+                if (is_write1 != 2 && (ptep & PG_USER_MASK)) {
                     goto do_fault_protect;
                 }
                 /* fall through */
@@ -711,8 +710,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
                 break;
 
             case MMU_KSMAP_IDX:
-                if (is_write1 != 2 && (env->cr[4] & CR4_SMAP_MASK) &&
-                    (ptep & PG_USER_MASK)) {
+                if (is_write1 != 2 && (ptep & PG_USER_MASK)) {
                     goto do_fault_protect;
                 }
                 /* fall through */
@@ -766,8 +764,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
                 break;
 
             case MMU_KSMAP_IDX:
-                if (is_write1 != 2 && (env->cr[4] & CR4_SMAP_MASK) &&
-                    (pde & PG_USER_MASK)) {
+                if (is_write1 != 2 && (pde & PG_USER_MASK)) {
                     goto do_fault_protect;
                 }
                 /* fall through */
@@ -823,8 +820,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
                 break;
 
             case MMU_KSMAP_IDX:
-                if (is_write1 != 2 && (env->cr[4] & CR4_SMAP_MASK) &&
-                    (ptep & PG_USER_MASK)) {
+                if (is_write1 != 2 && (ptep & PG_USER_MASK)) {
                     goto do_fault_protect;
                 }
                 /* fall through */