cleaned up and re-enable compaction
[unix-history] / usr / src / sys / kern / init_main.c
index 987be48..0d3f4ec 100644 (file)
@@ -1,4 +1,4 @@
-/*     init_main.c     4.9     %G%     */
+/*     init_main.c     4.22    81/11/18        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/cmap.h"
 #include "../h/text.h"
 #include "../h/vlimit.h"
 #include "../h/cmap.h"
 #include "../h/text.h"
 #include "../h/vlimit.h"
+#include "../h/clist.h"
+#ifdef INET
+#include "../h/protosw.h"
+#endif
 
 /*
  * Initialization code.
 
 /*
  * Initialization code.
@@ -44,8 +48,6 @@ main(firstaddr)
 
        rqinit();
        startup(firstaddr);
 
        rqinit();
        startup(firstaddr);
-       if (lotsfree == 0)
-               lotsfree = LOTSFREE;
 
        /*
         * set up system process 0 (swapper)
 
        /*
         * set up system process 0 (swapper)
@@ -73,13 +75,16 @@ main(firstaddr)
                        u.u_limit[i] = INFINITY;
                        continue;
                }
                        u.u_limit[i] = INFINITY;
                        continue;
                }
+       p->p_maxrss = INFINITY/NBPG;
        clkstart();
 
        /*
        clkstart();
 
        /*
-        * Initialize devices and
-        * set up 'known' i-nodes
+        * Initialize tables, protocols, and set up well-known inodes.
         */
         */
-
+       mbinit();
+#ifdef INET
+       pfinit();
+#endif
        ihinit();
        bhinit();
        cinit();
        ihinit();
        bhinit();
        cinit();
@@ -94,13 +99,17 @@ main(firstaddr)
        u.u_dmap = zdmap;
        u.u_smap = zdmap;
 
        u.u_dmap = zdmap;
        u.u_smap = zdmap;
 
+       /*
+        * Set the scan rate and other parameters of the paging subsystem.
+        */
+       setupclock();
+
        /*
         * make page-out daemon (process 2)
         * the daemon has ctopt(nswbuf*CLSIZE*KLMAX) pages of page
         * table so that it can map dirty pages into
         * its address space during asychronous pushes.
         */
        /*
         * make page-out daemon (process 2)
         * the daemon has ctopt(nswbuf*CLSIZE*KLMAX) pages of page
         * table so that it can map dirty pages into
         * its address space during asychronous pushes.
         */
-
        mpid = 1;
        proc[0].p_szpt = clrnd(ctopt(nswbuf*CLSIZE*KLMAX + UPAGES));
        proc[1].p_stat = SZOMB;         /* force it to be in proc slot 2 */
        mpid = 1;
        proc[0].p_szpt = clrnd(ctopt(nswbuf*CLSIZE*KLMAX + UPAGES));
        proc[1].p_stat = SZOMB;         /* force it to be in proc slot 2 */
@@ -128,6 +137,13 @@ main(firstaddr)
                 */
                return;
        }
                 */
                return;
        }
+
+#ifdef BBNNET 
+       /*
+        * Initialize bbn network.
+        */
+       netmain();
+#endif BBNNET
        proc[0].p_szpt = 1;
        sched();
 }
        proc[0].p_szpt = 1;
        sched();
 }
@@ -146,6 +162,7 @@ iinit()
 {
        register struct buf *bp;
        register struct filsys *fp;
 {
        register struct buf *bp;
        register struct filsys *fp;
+       register int i;
 
        (*bdevsw[major(rootdev)].d_open)(rootdev, 1);
        bp = bread(rootdev, SUPERB);
 
        (*bdevsw[major(rootdev)].d_open)(rootdev, 1);
        bp = bread(rootdev, SUPERB);
@@ -161,23 +178,13 @@ iinit()
        fp->s_ronly = 0;
        fp->s_lasti = 1;
        fp->s_nbehind = 0;
        fp->s_ronly = 0;
        fp->s_lasti = 1;
        fp->s_nbehind = 0;
+       fp->s_fsmnt[0] = '/';
+       for (i = 1; i < sizeof(fp->s_fsmnt); i++)
+               fp->s_fsmnt[i] = 0;
        clkinit(fp->s_time);
        bootime = time;
 }
 
        clkinit(fp->s_time);
        bootime = time;
 }
 
-/*
- * This is the set of buffers proper, whose heads
- * were declared in buf.h.  There can exist buffer
- * headers not pointing here that are used purely
- * as arguments to the I/O routines to describe
- * I/O to be done-- e.g. swap headers swbuf[] for
- * swapping.
- *
- * These are actually allocated kernel map slots and space is
- * allocated in locore.s for them.
- */
-char   buffers[NBUF][BSIZE];
-
 /*
  * Initialize the buffer I/O system by freeing
  * all buffers and setting all device buffer lists to empty.
 /*
  * Initialize the buffer I/O system by freeing
  * all buffers and setting all device buffer lists to empty.
@@ -195,10 +202,10 @@ binit()
                dp->b_flags = B_HEAD;
        }
        dp--;                           /* dp = &bfreelist[BQUEUES-1]; */
                dp->b_flags = B_HEAD;
        }
        dp--;                           /* dp = &bfreelist[BQUEUES-1]; */
-       for (i=0; i<NBUF; i++) {
+       for (i=0; i<nbuf; i++) {
                bp = &buf[i];
                bp->b_dev = NODEV;
                bp = &buf[i];
                bp->b_dev = NODEV;
-               bp->b_un.b_addr = buffers[i];
+               bp->b_un.b_addr = buffers + i * BSIZE;
                bp->b_back = dp;
                bp->b_forw = dp->b_forw;
                dp->b_forw->b_back = bp;
                bp->b_back = dp;
                bp->b_forw = dp->b_forw;
                dp->b_forw->b_back = bp;
@@ -218,6 +225,8 @@ binit()
                nswdev++;
        if (nswdev == 0)
                panic("binit");
                nswdev++;
        if (nswdev == 0)
                panic("binit");
+       if (nswdev > 1)
+               nswap = (nswap/DMMAX)*DMMAX;
        nswap *= nswdev;
        maxpgio *= nswdev;
        swfree(0);
        nswap *= nswdev;
        maxpgio *= nswdev;
        swfree(0);
@@ -232,10 +241,10 @@ binit()
 bswinit()
 {
        register int i;
 bswinit()
 {
        register int i;
-       register struct buf *sp
+       register struct buf *sp = swbuf;
 
        bswlist.av_forw = sp;
 
        bswlist.av_forw = sp;
-       for (i=0; i<NSWBUF-1; i++, sp++)
+       for (i=0; i<nswbuf-1; i++, sp++)
                sp->av_forw = sp+1;
        sp->av_forw = NULL;
 }
                sp->av_forw = sp+1;
        sp->av_forw = NULL;
 }