Module Name:    src
Committed By:   cherry
Date:           Tue Dec  4 19:22:42 UTC 2018

Modified Files:
        src/sys/arch/x86/x86: cpu.c

Log Message:
Stop panic()ing on a UP system.

The reason for the panic is that the cpu_attach() doesn't run to
completion because it thinks it's run past maxcpus (which in the case
of UP), is 1.

This is because on x86 at least, mi_cpu_attach() is called *before*
configure() (and thus the cpu_match()/cpu_attach() pair). Thus ncpu
has already been incremented by the time MD cpu_attach() is called.

Fix this.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/x86/x86/cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.162 src/sys/arch/x86/x86/cpu.c:1.163
--- src/sys/arch/x86/x86/cpu.c:1.162	Mon Nov 12 18:10:36 2018
+++ src/sys/arch/x86/x86/cpu.c	Tue Dec  4 19:22:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.162 2018/11/12 18:10:36 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.163 2018/12/04 19:22:42 cherry Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.162 2018/11/12 18:10:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.163 2018/12/04 19:22:42 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -320,7 +320,7 @@ cpu_attach(device_t parent, device_t sel
 
 	sc->sc_dev = self;
 
-	if (ncpu == maxcpus) {
+	if (ncpu > maxcpus) {
 #ifndef _LP64
 		aprint_error(": too many CPUs, please use NetBSD/amd64\n");
 #else

Reply via email to