From: deraadt Date: Tue, 30 May 2017 15:11:32 +0000 (+0000) Subject: Support for SMAP is pretty small, so don't exclude it from the RAMDISKS. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c61a50a09c8ec5ddf30640861af6af6a179de793;p=openbsd Support for SMAP is pretty small, so don't exclude it from the RAMDISKS. ok jsg visa --- diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c index 57b75f22fe3..b76d0908b53 100644 --- a/sys/arch/amd64/amd64/cpu.c +++ b/sys/arch/amd64/amd64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.104 2017/05/27 12:21:50 tedu Exp $ */ +/* $OpenBSD: cpu.c,v 1.105 2017/05/30 15:11:32 deraadt Exp $ */ /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */ /*- @@ -125,7 +125,6 @@ struct cpu_softc { struct cpu_info *sc_info; /* pointer to CPU info */ }; -#ifndef SMALL_KERNEL void replacesmap(void); extern long _stac; @@ -148,7 +147,6 @@ replacesmap(void) splx(s); } -#endif /* !SMALL_KERNEL */ #ifdef MULTIPROCESSOR int mp_cpu_start(struct cpu_info *); @@ -496,14 +494,12 @@ cpu_init(struct cpu_info *ci) cr4 = rcr4() | CR4_DEFAULT; if (ci->ci_feature_sefflags_ebx & SEFF0EBX_SMEP) cr4 |= CR4_SMEP; -#ifndef SMALL_KERNEL if (ci->ci_feature_sefflags_ebx & SEFF0EBX_SMAP) cr4 |= CR4_SMAP; if (ci->ci_feature_sefflags_ebx & SEFF0EBX_FSGSBASE) cr4 |= CR4_FSGSBASE; if (ci->ci_feature_sefflags_ecx & SEFF0ECX_UMIP) cr4 |= CR4_UMIP; -#endif if (cpu_ecxfeature & CPUIDECX_XSAVE) cr4 |= CR4_OSXSAVE; lcr4(cr4); diff --git a/sys/arch/amd64/amd64/identcpu.c b/sys/arch/amd64/amd64/identcpu.c index b3c8dce2da3..0ee3e28b241 100644 --- a/sys/arch/amd64/amd64/identcpu.c +++ b/sys/arch/amd64/amd64/identcpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: identcpu.c,v 1.85 2017/05/19 06:29:21 mlarkin Exp $ */ +/* $OpenBSD: identcpu.c,v 1.86 2017/05/30 15:11:32 deraadt Exp $ */ /* $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /* @@ -652,8 +652,8 @@ identifycpu(struct cpu_info *ci) ci->ci_dev->dv_xname); } -#ifndef SMALL_KERNEL if (ci->ci_flags & CPUF_PRIMARY) { +#ifndef SMALL_KERNEL if (!strcmp(cpu_vendor, "AuthenticAMD") && ci->ci_pnfeatset >= 0x80000007) { CPUID(0x80000007, dummy, dummy, dummy, val); @@ -668,6 +668,7 @@ identifycpu(struct cpu_info *ci) if (cpu_ecxfeature & CPUIDECX_EST) setperf_setup = est_init; +#endif if (cpu_ecxfeature & CPUIDECX_RDRAND) has_rdrand = 1; @@ -678,6 +679,7 @@ identifycpu(struct cpu_info *ci) if (ci->ci_feature_sefflags_ebx & SEFF0EBX_SMAP) replacesmap(); } +#ifndef SMALL_KERNEL if (!strncmp(mycpu_model, "Intel", 5)) { u_int32_t cflushsz; diff --git a/sys/arch/amd64/include/cpufunc.h b/sys/arch/amd64/include/cpufunc.h index 3e3b104c239..14131ad0732 100644 --- a/sys/arch/amd64/include/cpufunc.h +++ b/sys/arch/amd64/include/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.18 2017/05/27 12:21:50 tedu Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.19 2017/05/30 15:11:32 deraadt Exp $ */ /* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */ /*- @@ -132,11 +132,9 @@ lcr4(u_int val) static __inline u_int rcr4(void) { - u_int val; u_int64_t val64; __asm volatile("movq %%cr4,%0" : "=r" (val64)); - val = val64; - return val; + return (u_int) val64; } static __inline void diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c index 9d4f16fde1b..e56f8b45b3d 100644 --- a/sys/arch/i386/i386/cpu.c +++ b/sys/arch/i386/i386/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.83 2017/05/27 12:21:50 tedu Exp $ */ +/* $OpenBSD: cpu.c,v 1.84 2017/05/30 15:11:32 deraadt Exp $ */ /* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */ /*- @@ -170,7 +170,6 @@ struct cfdriver cpu_cd = { NULL, "cpu", DV_DULL /* XXX DV_CPU */ }; -#ifndef SMALL_KERNEL void replacesmap(void); extern int _stac; @@ -195,7 +194,6 @@ replacesmap(void) splx(s); } -#endif /* !SMALL_KERNEL */ int cpu_match(struct device *parent, void *match, void *aux) @@ -385,12 +383,10 @@ cpu_init(struct cpu_info *ci) if (ci->ci_feature_sefflags_ebx & SEFF0EBX_SMEP) cr4 |= CR4_SMEP; -#ifndef SMALL_KERNEL if (ci->ci_feature_sefflags_ebx & SEFF0EBX_SMAP) cr4 |= CR4_SMAP; if (ci->ci_feature_sefflags_ecx & SEFF0ECX_UMIP) cr4 |= CR4_UMIP; -#endif /* * If we have FXSAVE/FXRESTOR, use them. diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s index 805e75f7c94..bf1e847bbcb 100644 --- a/sys/arch/i386/i386/locore.s +++ b/sys/arch/i386/i386/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.173 2017/05/12 08:46:28 mpi Exp $ */ +/* $OpenBSD: locore.s,v 1.174 2017/05/30 15:11:32 deraadt Exp $ */ /* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */ /*- @@ -59,7 +59,6 @@ #include #endif -#ifndef SMALL_KERNEL /* * As stac/clac SMAP instructions are 3 bytes, we want the fastest * 3 byte nop sequence possible here. This will be replaced by @@ -77,14 +76,6 @@ SMAP_NOP ;\ CODEPATCH_END(CPTAG_CLAC) -#else - -#define SMAP_STAC -#define SMAP_CLAC - -#endif - - /* * override user-land alignment before including asm.h */ diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 6effaeaf1f1..2cf28746d3a 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.601 2017/05/18 09:20:06 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.602 2017/05/30 15:11:32 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2031,10 +2031,8 @@ identifycpu(struct cpu_info *ci) has_rdrand = 1; if (ci->ci_feature_sefflags_ebx & SEFF0EBX_RDSEED) has_rdseed = 1; -#ifndef SMALL_KERNEL if (ci->ci_feature_sefflags_ebx & SEFF0EBX_SMAP) replacesmap(); -#endif } #ifndef SMALL_KERNEL