-/* $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 $ */
/*-
struct cpu_info *sc_info; /* pointer to CPU info */
};
-#ifndef SMALL_KERNEL
void replacesmap(void);
extern long _stac;
splx(s);
}
-#endif /* !SMALL_KERNEL */
#ifdef MULTIPROCESSOR
int mp_cpu_start(struct cpu_info *);
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);
-/* $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 $ */
/*
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);
if (cpu_ecxfeature & CPUIDECX_EST)
setperf_setup = est_init;
+#endif
if (cpu_ecxfeature & CPUIDECX_RDRAND)
has_rdrand = 1;
if (ci->ci_feature_sefflags_ebx & SEFF0EBX_SMAP)
replacesmap();
}
+#ifndef SMALL_KERNEL
if (!strncmp(mycpu_model, "Intel", 5)) {
u_int32_t cflushsz;
-/* $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 $ */
/*-
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
-/* $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 $ */
/*-
NULL, "cpu", DV_DULL /* XXX DV_CPU */
};
-#ifndef SMALL_KERNEL
void replacesmap(void);
extern int _stac;
splx(s);
}
-#endif /* !SMALL_KERNEL */
int
cpu_match(struct device *parent, void *match, void *aux)
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.
-/* $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 $ */
/*-
#include <machine/i82489reg.h>
#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
SMAP_NOP ;\
CODEPATCH_END(CPTAG_CLAC)
-#else
-
-#define SMAP_STAC
-#define SMAP_CLAC
-
-#endif
-
-
/*
* override user-land alignment before including asm.h
*/
-/* $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 $ */
/*-
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