Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nathanw_sa]: src/sys Sync with HEAD.
details: https://anonhg.NetBSD.org/src/rev/a0123ec733c1
branches: nathanw_sa
changeset: 506555:a0123ec733c1
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Dec 11 15:44:46 2002 +0000
description:
Sync with HEAD.
diffstat:
sys/arch/sparc/stand/boot/boot.c | 33 +++++++++++++++++++++++++++++----
sys/kern/kern_fork.c | 6 ++----
sys/kern/kern_sysctl.c | 8 ++++++--
sys/lib/libsa/loadfile.c | 9 ++++++---
sys/sys/lkm.h | 4 ++--
sys/sys/sysctl.h | 10 +++++++---
sys/uvm/uvm_extern.h | 9 +++++----
sys/uvm/uvm_map.c | 14 +++++++-------
8 files changed, 64 insertions(+), 29 deletions(-)
diffs (297 lines):
diff -r 78af63a16d5a -r a0123ec733c1 sys/arch/sparc/stand/boot/boot.c
--- a/sys/arch/sparc/stand/boot/boot.c Wed Dec 11 14:22:12 2002 +0000
+++ b/sys/arch/sparc/stand/boot/boot.c Wed Dec 11 15:44:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.10.8.3 2002/11/11 22:04:37 nathanw Exp $ */
+/* $NetBSD: boot.c,v 1.10.8.4 2002/12/11 15:53:53 thorpej Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993
@@ -116,6 +116,7 @@
u_long marks[MARK_MAX], bootinfo;
struct btinfo_symtab bi_sym;
void *arg;
+ u_long maxkernsize;
#ifdef HEAP_VARIABLE
{
@@ -123,6 +124,16 @@
setheap((void *)ALIGN(end), (void *)0xffffffff);
}
#endif
+ {
+ /*
+ * Find maximum the kernel size that we can handle.
+ * Our stack grows down from label `start'; assume
+ * we need no more that 16K of stack space.
+ */
+ extern char start[]; /* top of stack (see srt0.S) */
+ maxkernsize = (u_long)start - (16*1024) - PROM_LOADADDR;
+
+ }
prom_init();
printf(">> %s, Revision %s\n", bootprog_name, bootprog_rev);
@@ -170,9 +181,23 @@
marks[MARK_START] = 0;
printf("Booting %s\n", kernel);
- if ((io = loadfile(kernel, marks, LOAD_KERNEL)) != -1)
- break;
-
+ if ((io = loadfile(kernel, marks, COUNT_KERNEL)) != -1) {
+ close(io);
+ if (marks[MARK_END] - marks[MARK_START] > maxkernsize) {
+ printf("kernel too large: %lu"
+ " (maximum kernel size is %lu)\n",
+ marks[MARK_END] - marks[MARK_START],
+ maxkernsize);
+ how |= RB_ASKNAME;
+ continue;
+ }
+ marks[MARK_START] = 0;
+ if ((io = loadfile(kernel, marks, LOAD_KERNEL)) != -1) {
+ close(io);
+ break;
+ }
+ }
+
/*
* if we have are not in askname mode, and we aren't using the
* prom bootfile, try the next one (if it exits). otherwise,
diff -r 78af63a16d5a -r a0123ec733c1 sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c Wed Dec 11 14:22:12 2002 +0000
+++ b/sys/kern/kern_fork.c Wed Dec 11 15:44:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_fork.c,v 1.84.2.20 2002/12/11 06:43:03 thorpej Exp $ */
+/* $NetBSD: kern_fork.c,v 1.84.2.21 2002/12/11 15:44:47 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.84.2.20 2002/12/11 06:43:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.84.2.21 2002/12/11 15:44:47 thorpej Exp $");
#include "opt_ktrace.h"
#include "opt_systrace.h"
@@ -221,7 +221,6 @@
if (ratecheck(&lasttfm, &fork_tfmrate))
tablefull("proc", "increase kern.maxproc or NPROC");
- (void)tsleep(&nprocs, PUSER, "forkmx", hz / 2);
return (EAGAIN);
}
nprocs++;
@@ -235,7 +234,6 @@
p1->p_rlimit[RLIMIT_NPROC].rlim_cur)) {
(void)chgproccnt(uid, -1);
nprocs--;
- (void)tsleep(&nprocs, PUSER, "forkulim", hz / 2);
return (EAGAIN);
}
diff -r 78af63a16d5a -r a0123ec733c1 sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c Wed Dec 11 14:22:12 2002 +0000
+++ b/sys/kern/kern_sysctl.c Wed Dec 11 15:44:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sysctl.c,v 1.86.2.25 2002/12/11 06:43:06 thorpej Exp $ */
+/* $NetBSD: kern_sysctl.c,v 1.86.2.26 2002/12/11 15:44:48 thorpej Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.86.2.25 2002/12/11 06:43:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.86.2.26 2002/12/11 15:44:48 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_insecure.h"
@@ -593,6 +593,10 @@
#else
return (EOPNOTSUPP);
#endif
+ case KERN_LABELSECTOR:
+ return (sysctl_rdint(oldp, oldlenp, newp, LABELSECTOR));
+ case KERN_LABELOFFSET:
+ return (sysctl_rdint(oldp, oldlenp, newp, LABELOFFSET));
default:
return (EOPNOTSUPP);
}
diff -r 78af63a16d5a -r a0123ec733c1 sys/lib/libsa/loadfile.c
--- a/sys/lib/libsa/loadfile.c Wed Dec 11 14:22:12 2002 +0000
+++ b/sys/lib/libsa/loadfile.c Wed Dec 11 15:44:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile.c,v 1.10.2.2 2001/11/14 19:16:51 nathanw Exp $ */
+/* $NetBSD: loadfile.c,v 1.10.2.3 2002/12/11 15:51:03 thorpej Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -94,7 +94,8 @@
#include "loadfile.h"
/*
- * Open 'filename', read in program and and return 0 if ok 1 on error.
+ * Open 'filename', read in program and return the opened file
+ * descriptor if ok, or -1 on error.
* Fill in marks
*/
int
@@ -165,7 +166,9 @@
}
if (rval == 0) {
- PROGRESS(("=0x%lx\n", marks[MARK_END] - marks[MARK_START]));
+ if ((flags & LOAD_ALL) != 0)
+ PROGRESS(("=0x%lx\n",
+ marks[MARK_END] - marks[MARK_START]));
return fd;
}
err:
diff -r 78af63a16d5a -r a0123ec733c1 sys/sys/lkm.h
--- a/sys/sys/lkm.h Wed Dec 11 14:22:12 2002 +0000
+++ b/sys/sys/lkm.h Wed Dec 11 15:44:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lkm.h,v 1.20.2.3 2002/11/11 22:16:28 nathanw Exp $ */
+/* $NetBSD: lkm.h,v 1.20.2.4 2002/12/11 15:44:46 thorpej Exp $ */
/*
* Header file used by loadable kernel modules and loadable kernel module
@@ -281,7 +281,7 @@
switch (cmd) { \
int error; \
case LKM_E_LOAD: \
- lkmtp->private.lkm_any = (struct lkm_any *)&_module; \
+ lkmtp->private.lkm_any = (void *)&_module; \
if ((error = load(lkmtp, cmd)) != 0) \
return error; \
break; \
diff -r 78af63a16d5a -r a0123ec733c1 sys/sys/sysctl.h
--- a/sys/sys/sysctl.h Wed Dec 11 14:22:12 2002 +0000
+++ b/sys/sys/sysctl.h Wed Dec 11 15:44:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysctl.h,v 1.60.2.15 2002/12/11 06:50:08 thorpej Exp $ */
+/* $NetBSD: sysctl.h,v 1.60.2.16 2002/12/11 15:44:46 thorpej Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -185,8 +185,10 @@
#ifndef _KERNEL
#define KERN_ARND KERN_URND /* compat w/ openbsd */
#endif
-#define KERN_LWP 62 /* struct: lwp entries */
-#define KERN_MAXID 63 /* number of valid kern ids */
+#define KERN_LABELSECTOR 62 /* int: disklabel sector */
+#define KERN_LABELOFFSET 63 /* int: offset of label within sector */
+#define KERN_LWP 64 /* struct: lwp entries */
+#define KERN_MAXID 65 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
@@ -252,6 +254,8 @@
{ "tkstat", CTLTYPE_NODE }, \
{ "monotonic_clock", CTLTYPE_INT }, \
{ "urandom", CTLTYPE_INT }, \
+ { "labelsector", CTLTYPE_INT }, \
+ { "labeloffset", CTLTYPE_INT }, \
{ "lwp", CTLTYPE_STRUCT }, \
}
diff -r 78af63a16d5a -r a0123ec733c1 sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h Wed Dec 11 14:22:12 2002 +0000
+++ b/sys/uvm/uvm_extern.h Wed Dec 11 15:44:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_extern.h,v 1.56.2.10 2002/12/11 06:51:53 thorpej Exp $ */
+/* $NetBSD: uvm_extern.h,v 1.56.2.11 2002/12/11 15:44:49 thorpej Exp $ */
/*
*
@@ -146,6 +146,7 @@
#define UVM_FLAG_COPYONW 0x080000 /* set copy_on_write flag */
#define UVM_FLAG_AMAPPAD 0x100000 /* for bss: pad amap to reduce malloc() */
#define UVM_FLAG_TRYLOCK 0x200000 /* fail if we can not lock map */
+#define UVM_FLAG_NOWAIT 0x400000 /* not allowed to sleep */
/* macros to extract info */
#define UVM_PROTECTION(X) ((X) & UVM_PROT_MASK)
@@ -162,10 +163,10 @@
/*
* the following defines are for uvm_km_kmemalloc's flags
*/
-#define UVM_KMF_NOWAIT 0x1 /* matches M_NOWAIT */
-#define UVM_KMF_VALLOC 0x2 /* allocate VA only */
-#define UVM_KMF_CANFAIL 0x4 /* caller handles failure */
+#define UVM_KMF_VALLOC 0x1 /* allocate VA only */
+#define UVM_KMF_CANFAIL 0x2 /* caller handles failure */
#define UVM_KMF_TRYLOCK UVM_FLAG_TRYLOCK /* try locking only */
+#define UVM_KMF_NOWAIT UVM_FLAG_NOWAIT /* not allowed to sleep */
/*
* the following defines the strategies for uvm_pagealloc_strat()
diff -r 78af63a16d5a -r a0123ec733c1 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Wed Dec 11 14:22:12 2002 +0000
+++ b/sys/uvm/uvm_map.c Wed Dec 11 15:44:46 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_map.c,v 1.93.2.17 2002/12/11 06:51:55 thorpej Exp $ */
+/* $NetBSD: uvm_map.c,v 1.93.2.18 2002/12/11 15:44:49 thorpej Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.93.2.17 2002/12/11 06:51:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.93.2.18 2002/12/11 15:44:49 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -212,7 +212,7 @@
{
struct vm_map_entry *me;
int s;
- int pflags = (flags & UVM_KMF_NOWAIT) ? PR_NOWAIT : PR_WAITOK;
+ int pflags = (flags & UVM_FLAG_NOWAIT) ? PR_NOWAIT : PR_WAITOK;
UVMHIST_FUNC("uvm_mapent_alloc"); UVMHIST_CALLED(maphist);
if (map->flags & VM_MAP_INTRSAFE || cold) {
@@ -543,7 +543,7 @@
uvm_flag_t flags;
{
struct vm_map_entry *prev_entry, *new_entry;
- const int amapwaitflag = (flags & UVM_KMF_NOWAIT) ?
+ const int amapwaitflag = (flags & UVM_FLAG_NOWAIT) ?
AMAP_EXTEND_NOWAIT : 0;
vm_prot_t prot = UVM_PROTECTION(flags), maxprot =
UVM_MAXPROTECTION(flags);
@@ -580,7 +580,7 @@
new_entry = NULL;
if (map == pager_map) {
- new_entry = uvm_mapent_alloc(map, (flags & UVM_KMF_NOWAIT));
+ new_entry = uvm_mapent_alloc(map, (flags & UVM_FLAG_NOWAIT));
if (__predict_false(new_entry == NULL))
return ENOMEM;
}
@@ -890,7 +890,7 @@
if (new_entry == NULL) {
new_entry = uvm_mapent_alloc(map,
- (flags & UVM_KMF_NOWAIT));
+ (flags & UVM_FLAG_NOWAIT));
if (__predict_false(new_entry == NULL)) {
vm_map_unlock(map);
return ENOMEM;
@@ -927,7 +927,7 @@
vaddr_t to_add = (flags & UVM_FLAG_AMAPPAD) ?
UVM_AMAP_CHUNK << PAGE_SHIFT : 0;
struct vm_amap *amap = amap_alloc(size, to_add,
- (flags & UVM_KMF_NOWAIT) ? M_NOWAIT : M_WAITOK);
+ (flags & UVM_FLAG_NOWAIT) ? M_NOWAIT : M_WAITOK);
if (__predict_false(amap == NULL)) {
vm_map_unlock(map);
uvm_mapent_free(new_entry);
Home |
Main Index |
Thread Index |
Old Index