Fix situation where we try to configure >MAXCPUS cpus.

This commit is contained in:
pooka 2010-11-21 22:01:15 +00:00
parent 566f7922d9
commit a78ea8c07c
3 changed files with 12 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump.c,v 1.203 2010/11/21 17:34:11 pooka Exp $ */
/* $NetBSD: rump.c,v 1.204 2010/11/21 22:01:15 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.203 2010/11/21 17:34:11 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.204 2010/11/21 22:01:15 pooka Exp $");
#include <sys/systm.h>
#define ELFSIZE ARCH_ELFSIZE
@ -262,7 +262,7 @@ rump__init(int rump_version)
printf("NCPU limited to 1 on this machine architecture\n");
numcpu = 1;
#endif
rump_cpus_bootstrap(numcpu);
rump_cpus_bootstrap(&numcpu);
rumpuser_gettime(&sec, &nsec, &error);
boottime.tv_sec = sec;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_private.h,v 1.63 2010/11/17 21:57:33 pooka Exp $ */
/* $NetBSD: rump_private.h,v 1.64 2010/11/21 22:01:15 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -96,7 +96,7 @@ extern struct cpu_info *rump_cpu;
struct lwp * rump__lwproc_alloclwp(struct proc *);
void rump_cpus_bootstrap(int);
void rump_cpus_bootstrap(int *);
void rump_scheduler_init(int);
void rump_schedule(void);
void rump_unschedule(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: scheduler.c,v 1.21 2010/10/29 15:32:24 pooka Exp $ */
/* $NetBSD: scheduler.c,v 1.22 2010/11/21 22:01:15 pooka Exp $ */
/*
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.21 2010/10/29 15:32:24 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.22 2010/11/21 22:01:15 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@ -120,15 +120,16 @@ getnextcpu(void)
/* this could/should be mi_attach_cpu? */
void
rump_cpus_bootstrap(int num)
rump_cpus_bootstrap(int *nump)
{
struct rumpcpu *rcpu;
struct cpu_info *ci;
int num = *nump;
int i;
if (num > MAXCPUS) {
aprint_verbose("CPU limit: %d wanted, %d (MAXCPUS) available\n",
num, MAXCPUS);
aprint_verbose("CPU limit: %d wanted, %d (MAXCPUS) "
"available (adjusted)\n", num, MAXCPUS);
num = MAXCPUS;
}
@ -141,6 +142,7 @@ rump_cpus_bootstrap(int num)
/* attach first cpu for bootstrap */
rump_cpu_attach(&rump_cpus[0]);
ncpu = 1;
*nump = num;
}
void