Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386 use the __HAVE_CPU_MAXPROC hook to limit kern....
details: https://anonhg.NetBSD.org/src/rev/97b8137cb6f7
branches: trunk
changeset: 540496:97b8137cb6f7
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Mon Dec 16 18:31:08 2002 +0000
description:
use the __HAVE_CPU_MAXPROC hook to limit kern.maxproc to number
of available GDT slots
add code in init386() to force maxproc to be maximum cpu_maxproc()
this fixes port-i386/1635 by John Kohl
diffstat:
sys/arch/i386/i386/machdep.c | 23 +++++++++++++++++++++--
sys/arch/i386/include/cpu.h | 3 ++-
sys/arch/i386/include/types.h | 3 ++-
3 files changed, 25 insertions(+), 4 deletions(-)
diffs (81 lines):
diff -r e46e452918f5 -r 97b8137cb6f7 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Mon Dec 16 18:27:20 2002 +0000
+++ b/sys/arch/i386/i386/machdep.c Mon Dec 16 18:31:08 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.506 2002/12/07 15:36:20 junyoung Exp $ */
+/* $NetBSD: machdep.c,v 1.507 2002/12/16 18:31:09 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.506 2002/12/07 15:36:20 junyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.507 2002/12/16 18:31:09 jdolecek Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@@ -3570,6 +3570,12 @@
ptoa(physmem), 2*1024*1024UL);
cngetc();
}
+
+#ifdef __HAVE_CPU_MAXPROC
+ /* Make sure maxproc is sane */
+ if (maxproc > cpu_maxproc())
+ maxproc = cpu_maxproc();
+#endif
}
#ifdef COMPAT_NOMID
@@ -3784,3 +3790,16 @@
idt_allocmap[vec] = 0;
simple_unlock(&idt_lock);
}
+
+/*
+ * Number of processes is limited by number of available GDT slots.
+ */
+int
+cpu_maxproc(void)
+{
+#ifdef USER_LDT
+ return ((MAXGDTSIZ - NGDT) / 2);
+#else
+ return (MAXGDTSIZ - NGDT);
+#endif
+}
diff -r e46e452918f5 -r 97b8137cb6f7 sys/arch/i386/include/cpu.h
--- a/sys/arch/i386/include/cpu.h Mon Dec 16 18:27:20 2002 +0000
+++ b/sys/arch/i386/include/cpu.h Mon Dec 16 18:31:08 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.92 2002/12/06 14:47:09 junyoung Exp $ */
+/* $NetBSD: cpu.h,v 1.93 2002/12/16 18:31:08 jdolecek Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -355,6 +355,7 @@
/* machdep.c */
void dumpconf __P((void));
+int cpu_maxproc __P((void));
void cpu_reset __P((void));
void i386_init_pcb_tss_ldt __P((struct cpu_info *));
void i386_proc0_tss_ldt_init __P((void));
diff -r e46e452918f5 -r 97b8137cb6f7 sys/arch/i386/include/types.h
--- a/sys/arch/i386/include/types.h Mon Dec 16 18:27:20 2002 +0000
+++ b/sys/arch/i386/include/types.h Mon Dec 16 18:31:08 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.39 2002/10/01 12:57:09 fvdl Exp $ */
+/* $NetBSD: types.h,v 1.40 2002/12/16 18:31:08 jdolecek Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -71,5 +71,6 @@
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_RAS
#define __HAVE_MD_RUNQUEUE
+#define __HAVE_CPU_MAXPROC
#endif /* _MACHTYPES_H_ */
Home |
Main Index |
Thread Index |
Old Index