Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/sys/arch/sun3/sun3x pull up 1.46 -> 1.47:



details:   https://anonhg.NetBSD.org/src/rev/a08143ad6ed2
branches:  netbsd-1-4
changeset: 468281:a08143ad6ed2
user:      chs <chs%NetBSD.org@localhost>
date:      Fri Apr 16 16:25:36 1999 +0000

description:
pull up 1.46 -> 1.47:
add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.

diffstat:

 sys/arch/sun3/sun3x/machdep.c |  881 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 881 insertions(+), 0 deletions(-)

diffs (truncated from 885 to 300 lines):

diff -r 22b61befcacb -r a08143ad6ed2 sys/arch/sun3/sun3x/machdep.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sun3/sun3x/machdep.c     Fri Apr 16 16:25:36 1999 +0000
@@ -0,0 +1,881 @@
+/*     $NetBSD: machdep.c,v 1.46.2.2 1999/04/16 16:25:36 chs Exp $     */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1986, 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     from: Utah Hdr: machdep.c 1.74 92/12/20
+ *     from: @(#)machdep.c     8.10 (Berkeley) 4/20/94
+ */
+
+#include "opt_bufcache.h"
+#include "opt_ddb.h"
+#include "opt_sysv.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/map.h>
+#include <sys/proc.h>
+#include <sys/buf.h>
+#include <sys/reboot.h>
+#include <sys/conf.h>
+#include <sys/file.h>
+#include <sys/clist.h>
+#include <sys/callout.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/msgbuf.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/mount.h>
+#include <sys/user.h>
+#include <sys/exec.h>
+#include <sys/core.h>
+#include <sys/kcore.h>
+#include <sys/vnode.h>
+#include <sys/syscallargs.h>
+#ifdef SYSVMSG
+#include <sys/msg.h>
+#endif
+#ifdef SYSVSEM
+#include <sys/sem.h>
+#endif
+#ifdef SYSVSHM
+#include <sys/shm.h>
+#endif
+#ifdef KGDB
+#include <sys/kgdb.h>
+#endif
+
+#include <vm/vm.h>
+#include <vm/vm_map.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_page.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <sys/sysctl.h>
+
+#include <dev/cons.h>
+
+#include <machine/cpu.h>
+#include <machine/dvma.h>
+#include <machine/idprom.h>
+#include <machine/kcore.h>
+#include <machine/reg.h>
+#include <machine/psl.h>
+#include <machine/pte.h>
+
+#if defined(DDB)
+#include <machine/db_machdep.h>
+#include <ddb/db_sym.h>
+#include <ddb/db_extern.h>
+#endif
+
+#include <sun3/sun3/machdep.h>
+
+/* Defined in locore.s */
+extern char kernel_text[];
+/* Defined by the linker */
+extern char etext[];
+
+vm_map_t exec_map = NULL;  
+vm_map_t mb_map = NULL;
+vm_map_t phys_map = NULL;
+
+int    physmem;
+int    fputype;
+caddr_t        msgbufaddr;
+
+/* Virtual page frame for /dev/mem (see mem.c) */
+vm_offset_t vmmap;
+
+/*
+ * safepri is a safe priority for sleep to set for a spin-wait
+ * during autoconfiguration or after a panic.
+ */
+int    safepri = PSL_LOWIPL;
+
+/*
+ * Declare these as initialized data so we can patch them.
+ */
+int    nswbuf = 0;
+#ifdef NBUF
+int    nbuf = NBUF;
+#else
+int    nbuf = 0;
+#endif
+#ifdef BUFPAGES
+int    bufpages = BUFPAGES;
+#else
+int    bufpages = 0;
+#endif
+
+u_char cpu_machine_id = 0;
+char *cpu_string = NULL;
+int cpu_has_vme = 0;
+int has_iocache = 0;
+
+static void identifycpu __P((void));
+static void initcpu __P((void));
+
+/*
+ * Console initialization: called early on from main,
+ * before vm init or cpu_startup.  This system is able
+ * to use the console for output immediately (via PROM)
+ * but can not use it for input until after this point.
+ */
+void
+consinit()
+{
+
+       /*
+        * Switch from the PROM console (output only)
+        * to our own console driver.
+        */
+       cninit();
+
+#ifdef DDB
+       db_machine_init();
+       {
+               extern int end[];
+               extern char *esym;
+
+               /* symsize, symstart, symend */
+               ddb_init(end[0], end + 1, (int*)esym);
+       }
+#endif DDB
+
+       /*
+        * Now that the console can do input as well as
+        * output, consider stopping for a debugger.
+        */
+       if (boothowto & RB_KDB) {
+#ifdef KGDB
+               /* XXX - Ask on console for kgdb_dev? */
+               /* Note: this will just return if kgdb_dev==NODEV */
+               kgdb_connect(1);
+#else  /* KGDB */
+               /* Either DDB or no debugger (just PROM). */
+               Debugger();
+#endif /* KGDB */
+       }
+}
+
+/*
+ * allocsys() - Private routine used by cpu_startup() below.
+ *
+ * Allocate space for system data structures.  We are given
+ * a starting virtual address and we return a final virtual
+ * address; along the way we set each data structure pointer.
+ *
+ * We call allocsys() with 0 to find out how much space we want,
+ * allocate that much and fill it with zeroes, and then call
+ * allocsys() again with the correct base virtual address.
+ */
+#define        valloc(name, type, num) \
+       v = (caddr_t)(((name) = (type *)v) + (num))
+static caddr_t allocsys __P((caddr_t));
+static caddr_t
+allocsys(v)
+       register caddr_t v;
+{
+
+#ifdef REAL_CLISTS
+       valloc(cfree, struct cblock, nclist);
+#endif
+       valloc(callout, struct callout, ncallout);
+#ifdef SYSVSHM
+       valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
+#endif
+#ifdef SYSVSEM
+       valloc(sema, struct semid_ds, seminfo.semmni);
+       valloc(sem, struct sem, seminfo.semmns);
+       /* This is pretty disgusting! */
+       valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
+#endif
+#ifdef SYSVMSG
+       valloc(msgpool, char, msginfo.msgmax);
+       valloc(msgmaps, struct msgmap, msginfo.msgseg);
+       valloc(msghdrs, struct msg, msginfo.msgtql);
+       valloc(msqids, struct msqid_ds, msginfo.msgmni);
+#endif
+
+       /*
+        * Determine how many buffers to allocate. We allocate
+        * the BSD standard of use 10% of memory for the first 2 Meg,
+        * 5% of remaining. Insure a minimum of 16 buffers.
+        * Allocate 1/2 as many swap buffer headers as file i/o buffers.
+        */
+       if (bufpages == 0) {
+               /* We always have more than 2MB of memory. */
+               bufpages = ((btoc(2 * 1024 * 1024) + physmem) /
+                           (20 * CLSIZE));
+       }
+       if (nbuf == 0) {
+               nbuf = bufpages;
+               if (nbuf < 16)
+                       nbuf = 16;
+       }
+       if (nswbuf == 0) {
+               nswbuf = (nbuf / 2) &~ 1;       /* force even */
+               if (nswbuf > 256)
+                       nswbuf = 256;           /* sanity */
+       }
+       valloc(buf, struct buf, nbuf);
+       return v;
+}
+#undef valloc
+
+/*
+ * cpu_startup: allocate memory for variable-sized tables,
+ * initialize cpu, and do autoconfiguration.
+ *
+ * This is called early in init_main.c:main(), after the
+ * kernel memory allocator is ready for use, but before
+ * the creation of processes 1,2, and mountroot, etc.
+ */
+void
+cpu_startup()
+{
+       caddr_t v;
+       int sz, i;
+       vm_size_t size;
+       int base, residual;
+       vm_offset_t minaddr, maxaddr;
+
+       /*
+        * Initialize message buffer (for kernel printf).
+        * This is put in physical page zero so it will
+        * always be in the same place after a reboot.
+        * Its mapping was prepared in pmap_bootstrap().
+        * Also, offset some to avoid PROM scribbles.
+        */
+       v = (caddr_t) KERNBASE;
+       msgbufaddr = (caddr_t)(v + MSGBUFOFF);
+       initmsgbuf(msgbufaddr, MSGBUFSIZE);
+
+       /*
+        * Good {morning,afternoon,evening,night}.
+        */
+       printf(version);



Home | Main Index | Thread Index | Old Index