target-i386: simplify SMAP handling in MMU_KSMAP_IDX
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>
This commit is contained in:
parent
8a201bd47e
commit
f57584dc87
|
@ -1162,7 +1162,7 @@ static inline CPUX86State *cpu_init(const char *cpu_model)
|
||||||
static inline int cpu_mmu_index(CPUX86State *env)
|
static inline int cpu_mmu_index(CPUX86State *env)
|
||||||
{
|
{
|
||||||
return (env->hflags & HF_CPL_MASK) == 3 ? MMU_USER_IDX :
|
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;
|
? MMU_KNOSMAP_IDX : MMU_KSMAP_IDX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -649,8 +649,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMU_KSMAP_IDX:
|
case MMU_KSMAP_IDX:
|
||||||
if (is_write1 != 2 && (env->cr[4] & CR4_SMAP_MASK) &&
|
if (is_write1 != 2 && (ptep & PG_USER_MASK)) {
|
||||||
(ptep & PG_USER_MASK)) {
|
|
||||||
goto do_fault_protect;
|
goto do_fault_protect;
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
@ -711,8 +710,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMU_KSMAP_IDX:
|
case MMU_KSMAP_IDX:
|
||||||
if (is_write1 != 2 && (env->cr[4] & CR4_SMAP_MASK) &&
|
if (is_write1 != 2 && (ptep & PG_USER_MASK)) {
|
||||||
(ptep & PG_USER_MASK)) {
|
|
||||||
goto do_fault_protect;
|
goto do_fault_protect;
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
@ -766,8 +764,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMU_KSMAP_IDX:
|
case MMU_KSMAP_IDX:
|
||||||
if (is_write1 != 2 && (env->cr[4] & CR4_SMAP_MASK) &&
|
if (is_write1 != 2 && (pde & PG_USER_MASK)) {
|
||||||
(pde & PG_USER_MASK)) {
|
|
||||||
goto do_fault_protect;
|
goto do_fault_protect;
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
@ -823,8 +820,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMU_KSMAP_IDX:
|
case MMU_KSMAP_IDX:
|
||||||
if (is_write1 != 2 && (env->cr[4] & CR4_SMAP_MASK) &&
|
if (is_write1 != 2 && (ptep & PG_USER_MASK)) {
|
||||||
(ptep & PG_USER_MASK)) {
|
|
||||||
goto do_fault_protect;
|
goto do_fault_protect;
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
Loading…
Reference in a new issue