before compiling dynamic version
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Fri, 27 Feb 1981 18:39:36 +0000 (10:39 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Fri, 27 Feb 1981 18:39:36 +0000 (10:39 -0800)
SCCS-vsn: sys/vax/vax/Locore.c 4.6
SCCS-vsn: sys/vax/vax/machdep.c 4.18
SCCS-vsn: sys/kern/init_main.c 4.9
SCCS-vsn: sys/vax/vax/locore.s 4.31

usr/src/sys/kern/init_main.c
usr/src/sys/vax/vax/Locore.c
usr/src/sys/vax/vax/locore.s
usr/src/sys/vax/vax/machdep.c

index d9fb558..987be48 100644 (file)
@@ -1,4 +1,4 @@
-/*     init_main.c     4.8     %G%     */
+/*     init_main.c     4.9     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -96,17 +96,17 @@ main(firstaddr)
 
        /*
         * make page-out daemon (process 2)
 
        /*
         * make page-out daemon (process 2)
-        * the daemon has ctopt(NSWBUF*CLSIZE*KLMAX) pages of page
+        * 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;
         * 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[0].p_szpt = clrnd(ctopt(nswbuf*CLSIZE*KLMAX + UPAGES));
        proc[1].p_stat = SZOMB;         /* force it to be in proc slot 2 */
        if (newproc(0)) {
                proc[2].p_flag |= SLOAD|SSYS;
        proc[1].p_stat = SZOMB;         /* force it to be in proc slot 2 */
        if (newproc(0)) {
                proc[2].p_flag |= SLOAD|SSYS;
-               proc[2].p_dsize = u.u_dsize = NSWBUF*CLSIZE*KLMAX; 
+               proc[2].p_dsize = u.u_dsize = nswbuf*CLSIZE*KLMAX; 
                pageout();
        }
 
                pageout();
        }
 
@@ -232,11 +232,12 @@ binit()
 bswinit()
 {
        register int i;
 bswinit()
 {
        register int i;
+       register struct buf *sp
 
 
-       bswlist.av_forw = &swbuf[0];
-       for (i=0; i<NSWBUF-1; i++)
-               swbuf[i].av_forw = &swbuf[i+1];
-       swbuf[NSWBUF-1].av_forw = NULL;
+       bswlist.av_forw = sp;
+       for (i=0; i<NSWBUF-1; i++, sp++)
+               sp->av_forw = sp+1;
+       sp->av_forw = NULL;
 }
 
 /*
 }
 
 /*
index ede7527..d929d63 100644 (file)
@@ -1,4 +1,4 @@
-/*     Locore.c        4.5     %G%     */
+/*     Locore.c        4.6     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -7,7 +7,6 @@
 #include "../h/pte.h"
 #include "../h/vm.h"
 #include "../h/tty.h"
 #include "../h/pte.h"
 #include "../h/vm.h"
 #include "../h/tty.h"
-#include "../h/cmap.h"
 #include "../h/proc.h"
 #include "../h/buf.h"
 #include "../h/uba.h"
 #include "../h/proc.h"
 #include "../h/buf.h"
 #include "../h/uba.h"
@@ -15,8 +14,6 @@
 /*
  * Pseudo file for lint to show what is used/defined in locore.s.
  */
 /*
  * Pseudo file for lint to show what is used/defined in locore.s.
  */
-struct cmap *cmap;
-struct cmap *ecmap;
 
 struct scb scb;
 int    (*UNIvec[128])();
 
 struct scb scb;
 int    (*UNIvec[128])();
@@ -104,8 +101,6 @@ struct      pte CMAP2;
 char   CADDR2;
 struct pte mmap[1];
 char   vmmap[NBPG];
 char   CADDR2;
 struct pte mmap[1];
 char   vmmap[NBPG];
-struct pte bufmap[NBUF];
-char   buffers[NBUF][BSIZE];
 struct pte msgbufmap[CLSIZE];
 char   msgbuf[CLSIZE*NBPG];
 struct pte camap[32];
 struct pte msgbufmap[CLSIZE];
 char   msgbuf[CLSIZE*NBPG];
 struct pte camap[32];
index bed7222..97863bd 100644 (file)
@@ -1,10 +1,12 @@
-/*     locore.s        4.30    81/02/26        */
+/*     locore.s        4.31    81/02/27        */
 
 #include "../h/mtpr.h"
 #include "../h/trap.h"
 #include "../h/psl.h"
 #include "../h/pte.h"
 #include "../h/cpu.h"
 
 #include "../h/mtpr.h"
 #include "../h/trap.h"
 #include "../h/psl.h"
 #include "../h/pte.h"
 #include "../h/cpu.h"
+#include "../h/nexus.h"
+#include "../h/uba.h"
 #include "mba.h"
 
        .set    HIGH,0x1f       # mask for total disable
 #include "mba.h"
 
        .set    HIGH,0x1f       # mask for total disable
@@ -12,7 +14,6 @@
        .set    NBPG,512
        .set    PGSHIFT,9
 
        .set    NBPG,512
        .set    PGSHIFT,9
 
-       .set    BSIZE,NBPG*CLSIZE
        .set    NISP,3          # number of interrupt stack pages
 
 /*
        .set    NISP,3          # number of interrupt stack pages
 
 /*
@@ -220,10 +221,6 @@ _catcher:
 
        .globl  _cold
 _cold: .long   1
 
        .globl  _cold
 _cold: .long   1
-       .globl  _cmap
-_cmap: .long   0
-       .globl  _ecmap
-_ecmap:        .long   0
        .data
 
        .text
        .data
 
        .text
@@ -306,12 +303,12 @@ _/**/mname:       .globl  _/**/mname;             \
 
        .data
        .align  2
 
        .data
        .align  2
-       SYSMAP(Sysmap   ,Sysbase        ,6*NBPG/4       )
+       SYSMAP(Sysmap   ,Sysbase        ,SYSPTSIZE/4    )
        SYSMAP(UMBAbeg  ,umbabeg        ,0              )
        SYSMAP(UMBAbeg  ,umbabeg        ,0              )
-       SYSMAP(Nexmap   ,nexus          ,16*16          )
-       SYSMAP(UMEMmap  ,umem           ,16*4           )
+       SYSMAP(Nexmap   ,nexus          ,16*NNEXUS      )
+       SYSMAP(UMEMmap  ,umem           ,16*MAXNUBA     )
        SYSMAP(UMBAend  ,umbaend        ,0              )
        SYSMAP(UMBAend  ,umbaend        ,0              )
-       SYSMAP(Usrptmap ,usrpt          ,2*NBPG         )
+       SYSMAP(Usrptmap ,usrpt          ,USRPTSIZE/4    )
        SYSMAP(Forkmap  ,forkutl        ,UPAGES         )
        SYSMAP(Xswapmap ,xswaputl       ,UPAGES         )
        SYSMAP(Xswap2map,xswap2utl      ,UPAGES         )
        SYSMAP(Forkmap  ,forkutl        ,UPAGES         )
        SYSMAP(Xswapmap ,xswaputl       ,UPAGES         )
        SYSMAP(Xswap2map,xswap2utl      ,UPAGES         )
@@ -322,9 +319,8 @@ _/**/mname: .globl  _/**/mname;             \
        SYSMAP(CMAP2    ,CADDR2         ,1              )
        SYSMAP(mcrmap   ,mcr            ,1              )
        SYSMAP(mmap     ,vmmap          ,1              )
        SYSMAP(CMAP2    ,CADDR2         ,1              )
        SYSMAP(mcrmap   ,mcr            ,1              )
        SYSMAP(mmap     ,vmmap          ,1              )
-       SYSMAP(bufmap   ,buffers        ,MAXNBUF*CLSIZE )
        SYSMAP(msgbufmap,msgbuf         ,CLSIZE         )
        SYSMAP(msgbufmap,msgbuf         ,CLSIZE         )
-       SYSMAP(camap    ,cabase         ,32*CLSIZE      )
+       SYSMAP(camap    ,cabase         ,16*CLSIZE      )
        SYSMAP(ecamap   ,calimit        ,0              )
 
 eSysmap:
        SYSMAP(ecamap   ,calimit        ,0              )
 
 eSysmap:
@@ -366,16 +362,9 @@ start:
 1:     pushl   $4; pushl r7; calls $2,_badaddr; tstl r0; bneq 9f
        acbl    $8096*1024-1,$64*1024,r7,1b
 9:
 1:     pushl   $4; pushl r7; calls $2,_badaddr; tstl r0; bneq 9f
        acbl    $8096*1024-1,$64*1024,r7,1b
 9:
-/* allocate space for cmap[] */
-       movab   _end,r5
-       movl    r5,_cmap; bbss $31,_cmap,0f; 0:
-       subl3   r5,r7,r1
-       divl2   $(NBPG*CLSIZE)+CMSIZE,r1
-       mull2   $CMSIZE,r1
-       addl3   _cmap,r1,_ecmap
 /* clear memory from kernel bss and pages for proc 0 u. and page table */
        movab   _edata,r6
 /* clear memory from kernel bss and pages for proc 0 u. and page table */
        movab   _edata,r6
-       movl    _ecmap,r5               # clear to end of cmap[]
+       movab   _end,r5
        bbcc    $31,r5,0f; 0:
        addl2   $(UPAGES*NBPG)+NBPG+NBPG,r5
 1:     clrq    (r6); acbl r5,$8,r6,1b
        bbcc    $31,r5,0f; 0:
        addl2   $(UPAGES*NBPG)+NBPG+NBPG,r5
 1:     clrq    (r6); acbl r5,$8,r6,1b
@@ -393,8 +382,8 @@ start:
 /* make kernel text space read-only */
        movab   _etext+NBPG-1,r1; bbcc $31,r1,0f; 0: ashl $-PGSHIFT,r1,r1
 1:     bisl3   $PG_V|PG_KR,r2,_Sysmap[r2]; aoblss r1,r2,1b
 /* make kernel text space read-only */
        movab   _etext+NBPG-1,r1; bbcc $31,r1,0f; 0: ashl $-PGSHIFT,r1,r1
 1:     bisl3   $PG_V|PG_KR,r2,_Sysmap[r2]; aoblss r1,r2,1b
-/* make kernel data, bss, core map read-write */
-       addl3   _ecmap,$NBPG-1,r1; bbcc $31,r1,0f; 0:; ashl $-PGSHIFT,r1,r1
+/* make kernel data, bss */
+       movab   _end+NBPG-1,r1; bbcc    $31,r1,0f; 0:; ashl $-PGSHIFT,r1,r1
 1:     bisl3   $PG_V|PG_KW,r2,_Sysmap[r2]; aoblss r1,r2,1b
 /* now go to mapped mode */
        mtpr    $1,$TBIA; mtpr $1,$MAPEN; jmp *$0f; 0:
 1:     bisl3   $PG_V|PG_KW,r2,_Sysmap[r2]; aoblss r1,r2,1b
 /* now go to mapped mode */
        mtpr    $1,$TBIA; mtpr $1,$MAPEN; jmp *$0f; 0:
@@ -403,7 +392,7 @@ start:
        movl    _maxmem,_physmem
        movl    _maxmem,_freemem
 /* setup context for proc[0] == Scheduler */
        movl    _maxmem,_physmem
        movl    _maxmem,_freemem
 /* setup context for proc[0] == Scheduler */
-       addl3   _ecmap,$NBPG-1,r6
+       movab   _end+NBPG-1,r6
        bicl2   $NBPG-1,r6              # make page boundary
 /* setup page table for proc[0] */
        bbcc    $31,r6,0f; 0:
        bicl2   $NBPG-1,r6              # make page boundary
 /* setup page table for proc[0] */
        bbcc    $31,r6,0f; 0:
@@ -452,8 +441,8 @@ start:
 1:     movab   _u,r0
        movc3   $12,sigcode,PCB_SIGC(r0)
 /* calculate firstaddr, and call main() */
 1:     movab   _u,r0
        movc3   $12,sigcode,PCB_SIGC(r0)
 /* calculate firstaddr, and call main() */
-       addl3   _ecmap,$NBPG-1,r0; bbcc $31,r0,0f; 0:; ashl $-PGSHIFT,r0,-(sp)
-       calls   $1,_main
+       movab   _end+NBPG-1,r0; bbcc $31,r0,0f; 0:; ashl $-PGSHIFT,r0,-(sp)
+       addl2   $UPAGES+1,(sp); calls $1,_main
 /* proc[1] == /etc/init now running here; run icode */
        pushl   $PSL_CURMOD|PSL_PRVMOD
        pushl   $0
 /* proc[1] == /etc/init now running here; run icode */
        pushl   $PSL_CURMOD|PSL_PRVMOD
        pushl   $0
index 1d363ab..968ced9 100644 (file)
@@ -1,4 +1,4 @@
-/*     machdep.c       4.17    81/02/26        */
+/*     machdep.c       4.18    81/02/27        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/conf.h"
 #include "../h/mem.h"
 #include "../h/cpu.h"
 #include "../h/conf.h"
 #include "../h/mem.h"
 #include "../h/cpu.h"
+#include "../h/inode.h"
+#include "../h/file.h"
+#include "../h/text.h"
+#include "../h/clist.h"
+#include "../h/callout.h"
+#include "../h/cmap.h"
 #include <frame.h>
 
 int    coresw = 0;
 int    printsw = 0;
 
 #include <frame.h>
 
 int    coresw = 0;
 int    printsw = 0;
 
-char   version[] = "VM/UNIX (Berkeley Version 4.17) 81/02/26 21:56:22 \n";
+char   version[] = "VM/UNIX (Berkeley Version 4.18) 81/02/27 02:39:23 \n";
 int    icode[] =
 {
        0x9f19af9f,     /* pushab [&"init",0]; pushab */
 int    icode[] =
 {
        0x9f19af9f,     /* pushab [&"init",0]; pushab */
@@ -44,10 +50,12 @@ int memchk();
  * Machine-dependent startup code
  */
 startup(firstaddr)
  * Machine-dependent startup code
  */
 startup(firstaddr)
+       int firstaddr;
 {
        register int unixsize;
        register int i;
        register struct pte *pte;
 {
        register int unixsize;
        register int i;
        register struct pte *pte;
+       register caddr_t v;
 
        /*
         * Initialize error message buffer (at end of core).
 
        /*
         * Initialize error message buffer (at end of core).
@@ -65,21 +73,58 @@ startup(firstaddr)
        printf("real mem  = %d\n", ctob(maxmem));
        
        /*
        printf("real mem  = %d\n", ctob(maxmem));
        
        /*
-        * Allow for the u. area of process 0 and its (single)
-        * page of page tables.
+        * First determine how many buffers are reasonable.
+        * Current alg is 32 per megabyte, with min of 32.
+        * We allocate 1/2 as many swap buffer headers as file i/o buffers.
         */
         */
-       unixsize = (firstaddr+UPAGES+1);
+       nbuf = (32 * physmem) / btoc(1024*1024); if (nbuf < 32) nbuf = 32;
+       nswbuf = nbuf / 2;
 
        /*
 
        /*
-        * Initialze buffers
+        * Allocate space for system data structures.
         */
         */
-       pte = bufmap;
-       for (i = 0; i < NBUF * CLSIZE; i++)
-               *(int *)pte++ = PG_V | PG_KW | unixsize++;
+       v = (caddr_t)(0x80000000 | (firstaddr * NBPG));
+#define        valloc(name, type, num) \
+           (name) = (type *)(v); (v) = (caddr_t)((name)+(num))
+#define        valloclim(name, type, num, lim) \
+           (name) = (type *)(v); (v) = (caddr_t)((lim) = ((name)+(num)))
+       valloc(buffers, char, BSIZE*nbuf);
+       valloc(buf, struct buf, nbuf);
+       valloc(swbuf, struct buf, nswbuf);
+       valloclim(inode, struct inode, ninode, inodeNINODE);
+       valloclim(file, struct file, nfile, fileNFILE);
+       valloclim(proc, struct proc, nproc, procNPROC);
+       valloclim(text, struct text, ntext, textNTEXT);
+       valloc(cfree, struct cblock, nclist);
+       valloc(callout, struct callout, ncallout);
+       valloc(swapmap, struct map, nproc * 4);
+       valloc(argmap, struct map, 25);
+       valloc(kernelmap, struct map, nproc);
+
+       /*
+        * Now allocate space for core map
+        */
+       ncmap = (physmem*NBPG - ((int)v &~ 0x80000000)) /
+                   (NBPG*CLSIZE + sizeof (struct cmap));
+       valloclim(cmap, struct cmap, ncmap, ecmap);
+
+       /*
+        * Clear allocated space, and make r/w entries
+        * for the space in the kernel map.
+        */
+       unixsize = btoc((int)ecmap);
+       if (unixsize >= physmem - 8*UPAGES)
+               panic("no memory");
+       pte = &Sysmap[firstaddr];
+       for (i = firstaddr; i < unixsize; i++) {
+               *(int *)(&Sysmap[i]) = PG_V | PG_KW | i;
+               clearseg(i);
+       }
        mtpr(TBIA, 1);
 
        /*
        mtpr(TBIA, 1);
 
        /*
-        * Initialize maps.
+        * Initialize memory allocator and
+        * related maps.
         */
        meminit(unixsize, maxmem);
        maxmem = freemem;
         */
        meminit(unixsize, maxmem);
        maxmem = freemem;
@@ -97,7 +142,7 @@ startup(firstaddr)
        tocons(TXDB_CWSI);
        tocons(TXDB_CCSI);
 
        tocons(TXDB_CWSI);
        tocons(TXDB_CCSI);
 
-       timeout(memchk, (caddr_t)0, HZ);        /* it will pick its own intvl */
+       timeout(memchk, (caddr_t)0, hz);        /* it will pick its own intvl */
 }
 
 /*
 }
 
 /*