minor fixups to restart stuff; version 4.1 for distrib
[unix-history] / usr / src / sys / kern / init_main.c
index 78338a3..298936a 100644 (file)
@@ -1,4 +1,4 @@
-/*     init_main.c     3.6     %G%     */
+/*     init_main.c     4.1     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -17,6 +17,8 @@
 #include "../h/clock.h"
 #include "../h/vm.h"
 #include "../h/cmap.h"
 #include "../h/clock.h"
 #include "../h/vm.h"
 #include "../h/cmap.h"
+#include "../h/text.h"
+#include "../h/vlimit.h"
 
 /*
  * Initialization code.
 
 /*
  * Initialization code.
@@ -37,6 +39,7 @@
  */
 main(firstaddr)
 {
  */
 main(firstaddr)
 {
+       register int i;
 
        cpusid = mfpr(SID);             /* get system identification */
 #ifdef FASTVAX
 
        cpusid = mfpr(SID);             /* get system identification */
 #ifdef FASTVAX
@@ -58,6 +61,19 @@ main(firstaddr)
        proc[0].p_nice = NZERO;
        u.u_procp = &proc[0];
        u.u_cmask = CMASK;
        proc[0].p_nice = NZERO;
        u.u_procp = &proc[0];
        u.u_cmask = CMASK;
+       for (i = 1; i < sizeof(u.u_limit)/sizeof(u.u_limit[0]); i++)
+               switch (i) {
+
+               case LIM_STACK:
+                       u.u_limit[i] = 512*1024;
+                       continue;
+               case LIM_DATA:
+                       u.u_limit[i] = ctob(MAXDSIZ);
+                       continue;
+               default:
+                       u.u_limit[i] = INFINITY;
+                       continue;
+               }
        clkstart();
 
        /*
        clkstart();
 
        /*
@@ -105,6 +121,7 @@ main(firstaddr)
        proc[0].p_szpt = CLSIZE;
        if (newproc(0)) {
                expand(clrnd((int)btoc(szicode)), P0BR);
        proc[0].p_szpt = CLSIZE;
        if (newproc(0)) {
                expand(clrnd((int)btoc(szicode)), P0BR);
+               swpexpand(u.u_dsize, 0, &u.u_dmap, &u.u_smap);
                (void) copyout((caddr_t)icode, (caddr_t)0, (unsigned)szicode);
                /*
                 * Return goes to loc. 0 of user init
                (void) copyout((caddr_t)icode, (caddr_t)0, (unsigned)szicode);
                /*
                 * Return goes to loc. 0 of user init
@@ -130,7 +147,6 @@ iinit()
 {
        register struct buf *cp, *bp;
        register struct filsys *fp;
 {
        register struct buf *cp, *bp;
        register struct filsys *fp;
-       register unsigned i, j;
 
        (*bdevsw[major(rootdev)].d_open)(rootdev, 1);
        bp = bread(rootdev, SUPERB);
 
        (*bdevsw[major(rootdev)].d_open)(rootdev, 1);
        bp = bread(rootdev, SUPERB);
@@ -147,13 +163,7 @@ 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;
-       /* on boot, read VAX TODR register (GMT 10 ms.
-       *       clicks into current year) and set software time
-       *       in 'int time' (GMT seconds since year YRREF)
-       */
-       for (i = 0 , j = YRREF ; j < YRCURR ; j++)
-               i += (SECYR + (j%4?0:SECDAY)) ;
-       time = udiv(mfpr(TODR),100) + i ;
+       clkinit(fp->s_time);
        bootime = time;
 }
 
        bootime = time;
 }
 
@@ -164,14 +174,15 @@ iinit()
  * as arguments to the I/O routines to describe
  * I/O to be done-- e.g. swap headers swbuf[] for
  * swapping.
  * 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.
  */
 char   buffers[NBUF][BSIZE];
 
 /*
  * Initialize the buffer I/O system by freeing
  * all buffers and setting all device buffer lists to empty.
- *
- * SHOULD USE MEMALL HERE!!!
  */
 binit()
 {
  */
 binit()
 {