Encode smp-capability into the makefile so that it can be used to

avoid potential screwups.
This commit is contained in:
pooka 2010-11-21 22:17:24 +00:00
parent a78ea8c07c
commit a742ba8060
2 changed files with 14 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.rumpkern,v 1.100 2010/11/21 21:46:43 pooka Exp $
# $NetBSD: Makefile.rumpkern,v 1.101 2010/11/21 22:17:24 pooka Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@ -25,6 +25,12 @@ SRCS+= compat.c
SRCS+= locks.c
#SRCS+= locks_up.c
# Does the arch support multiple processors?
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
RUMP_SMP= # defined
CPPFLAGS.rump.c+= -DRUMP_SMP
.endif
vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh ${RUMPTOP}/../sys/param.h
${_MKMSG_CREATE} vers.c
${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n
@ -175,8 +181,12 @@ KERNMISCCPPFLAGS+= -D_RUMPKERNEL
|| ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
|| ${MACHINE_CPU} == "vax" || ${MACHINE_ARCH} == "m68000"
CPPFLAGS+= -I${RUMPTOP}/../../common/lib/libc/atomic
.ifdef RUMP_SMP
SRCS+= atomic_cas_generic.c
.else
SRCS+= atomic_cas_up.c
.endif
.endif
.include <bsd.lib.mk>
.include <bsd.klinks.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump.c,v 1.204 2010/11/21 22:01:15 pooka Exp $ */
/* $NetBSD: rump.c,v 1.205 2010/11/21 22:17:24 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.204 2010/11/21 22:01:15 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.205 2010/11/21 22:17:24 pooka Exp $");
#include <sys/systm.h>
#define ELFSIZE ARCH_ELFSIZE
@ -249,7 +249,7 @@ rump__init(int rump_version)
if (rumpuser_getenv("RUMP_NCPU", buf, sizeof(buf), &error) == 0)
error = 0;
/* non-x86 is missing CPU_INFO_FOREACH() support */
#if defined(__i386__) || defined(__x86_64__)
#ifdef RUMP_SMP
if (error == 0) {
numcpu = strtoll(buf, NULL, 10);
if (numcpu < 1)