summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-11-06 02:49:07 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-11-06 02:49:07 +0000
commit7db32e4e50839a3209b01641e31c79ac7a10d1a2 (patch)
tree02296f5d05718cf0a590dcf1f98cffb961d41d15 /sys/arch
parentda1fb06330d1bb7cebaa88631cc83bcdcd468475 (diff)
Only read/write cr4 if we have a bit to set after testing the various
cpuid based flags. Unlike amd64 there is no CR4_DEFAULT used here, cr4 does not exist on most/all? 486s and cr4 access traps on Cyrix 5x86 processors. Should fix a regression introduced in rev 1.65 encountered by 'Ppractivus' on a 5x86. "looks good" guenther@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/cpu.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c
index 7a978aae1a8..df06c49c2d2 100644
--- a/sys/arch/i386/i386/cpu.c
+++ b/sys/arch/i386/i386/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.67 2015/07/18 19:21:03 sf Exp $ */
+/* $OpenBSD: cpu.c,v 1.68 2015/11/06 02:49:06 jsg Exp $ */
/* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */
/*-
@@ -354,7 +354,7 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
void
cpu_init(struct cpu_info *ci)
{
- u_int cr4;
+ u_int cr4 = 0;
/* configure the CPU if needed */
if (ci->cpu_setup != NULL)
@@ -372,7 +372,6 @@ cpu_init(struct cpu_info *ci)
*/
lcr0(rcr0() | CR0_WP);
- cr4 = rcr4();
if (cpu_feature & CPUID_PGE)
cr4 |= CR4_PGE; /* enable global TLB caching */
@@ -395,7 +394,9 @@ cpu_init(struct cpu_info *ci)
if (cpu_feature & (CPUID_SSE|CPUID_SSE2))
cr4 |= CR4_OSXMMEXCPT;
}
- lcr4(cr4);
+ /* no cr4 on most 486s */
+ if (cr4 != 0)
+ lcr4(rcr4()|cr4);
#ifdef MULTIPROCESSOR
ci->ci_flags |= CPUF_RUNNING;