[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/33] target-i386: simplify SMAP handling in MMU_KSM
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 17/33] target-i386: simplify SMAP handling in MMU_KSMAP_IDX |
Date: |
Thu, 5 Jun 2014 16:22:07 +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 <address@hidden>
---
target-i386/cpu.h | 2 +-
target-i386/helper.c | 12 ++++--------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index b80df66..f2d5b19 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -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;
}
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 6d8e350..d10de26 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -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 */
--
1.8.3.1
- [Qemu-devel] [PULL 07/33] softmmu: make do_unaligned_access a method of CPU, (continued)
- [Qemu-devel] [PULL 07/33] softmmu: make do_unaligned_access a method of CPU, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 08/33] softmmu: move ALIGNED_ONLY to cpu.h, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 05/33] softmmu: move MMUSUFFIX under SOFTMMU_CODE_ACCESS, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 09/33] softmmu: commonize helper definitions, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 12/33] softmmu: introduce cpu_ldst.h, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 10/33] softmmu: move softmmu_template.h out of include/, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 11/33] target-arm: move arm_*_code to a separate file, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 13/33] softmmu: move all load/store functions to cpu_ldst.h, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 16/33] target-i386: fix kernel accesses with SMAP and CPL = 3, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 15/33] target-i386: move check_io helpers to seg_helper.c, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 17/33] target-i386: simplify SMAP handling in MMU_KSMAP_IDX,
Paolo Bonzini <=
- [Qemu-devel] [PULL 14/33] target-i386: rename KSMAP to KNOSMAP, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 18/33] target-i386: fix coding standards in x86_cpu_handle_mmu_fault, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 20/33] target-i386: commonize checks for 4MB and 4KB pages, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 19/33] target-i386: commonize checks for 2MB and 4KB pages, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 21/33] target-i386: commonize checks for PAE and non-PAE, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 23/33] target-i386: introduce do_check_protect label, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 22/33] target-i386: tweak handling of PG_NX_MASK, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 24/33] target-i386: introduce support for 1 GB pages, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 26/33] target-i386: test reserved PS bit on PML4Es, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 25/33] target-i386: set correct error code for reserved bit access, Paolo Bonzini, 2014/06/05