patchable olducode varable
[unix-history] / usr / src / sys / kern / init_main.c
index 982a64d..06fdeb7 100644 (file)
@@ -1,4 +1,4 @@
-/*     init_main.c     3.3     %H%     */
+/*     init_main.c     3.9     %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/limit.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,8 @@ 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++)
+               u.u_limit[i] = INFINITY;
        clkstart();
 
        /*
        clkstart();
 
        /*
@@ -105,7 +110,8 @@ 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);
-               VOID copyout((caddr_t)icode, (caddr_t)0, (unsigned)szicode);
+               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
                 * code just copied out.
                /*
                 * Return goes to loc. 0 of user init
                 * code just copied out.
@@ -179,6 +185,7 @@ binit()
        register struct buf *dp;
        register int i;
        struct bdevsw *bdp;
        register struct buf *dp;
        register int i;
        struct bdevsw *bdp;
+       struct swdevt *swp;
 
        bfreelist.b_forw = bfreelist.b_back =
            bfreelist.av_forw = bfreelist.av_back = &bfreelist;
 
        bfreelist.b_forw = bfreelist.b_back =
            bfreelist.av_forw = bfreelist.av_back = &bfreelist;
@@ -201,6 +208,19 @@ binit()
                }
                nblkdev++;
        }
                }
                nblkdev++;
        }
+       /*
+        * Count swap devices, and adjust total swap space available.
+        * Some of this space will not be available until a vswapon()
+        * system is issued, usually when the system goes multi-user.
+        */
+       nswdev = 0;
+       for (swp = swdevt; swp->sw_dev; swp++)
+               nswdev++;
+       if (nswdev == 0)
+               panic("binit");
+       nswap *= nswdev;
+       maxpgio *= nswdev;
+       swfree(0);
 }
 
 /*
 }
 
 /*