X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/f86df66c1575304c08a6fd0716bcfdba12f5d593..934e4ecf9018991ee10ed5a0a6116db88acb7c42:/usr/src/sys/kern/init_main.c diff --git a/usr/src/sys/kern/init_main.c b/usr/src/sys/kern/init_main.c index 570b58a16e..a3f5660df9 100644 --- a/usr/src/sys/kern/init_main.c +++ b/usr/src/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* init_main.c 3.5 %G% */ +/* init_main.c 4.2 %G% */ #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/text.h" +#include "../h/vlimit.h" /* * Initialization code. @@ -37,6 +39,7 @@ */ main(firstaddr) { + register int i; 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; + 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(); /* @@ -105,6 +121,7 @@ main(firstaddr) proc[0].p_szpt = CLSIZE; if (newproc(0)) { expand(clrnd((int)btoc(szicode)), P0BR); + (void) 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 @@ -130,7 +147,6 @@ iinit() { register struct buf *cp, *bp; register struct filsys *fp; - register unsigned i, j; (*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; - /* 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; } @@ -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. + * + * 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. - * - * SHOULD USE MEMALL HERE!!! */ binit() { @@ -179,6 +190,7 @@ binit() 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; @@ -201,6 +213,19 @@ binit() } 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); } /*