rmalloc and related stuff
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Sun, 1 Mar 1981 09:37:16 +0000 (01:37 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Sun, 1 Mar 1981 09:37:16 +0000 (01:37 -0800)
SCCS-vsn: sys/vax/mba/hp.c 4.17
SCCS-vsn: sys/vax/mba/mba.c 4.11
SCCS-vsn: sys/vax/vax/conf.c 4.21
SCCS-vsn: sys/vax/uba/uba.c 4.18
SCCS-vsn: sys/vax/uba/up.c 4.27
SCCS-vsn: sys/vax/vax/autoconf.c 4.19
SCCS-vsn: sys/vax/uba/rk.c 4.17
SCCS-vsn: sys/vm/vm_swap.c 4.3

usr/src/sys/vax/mba/hp.c
usr/src/sys/vax/mba/mba.c
usr/src/sys/vax/uba/rk.c
usr/src/sys/vax/uba/uba.c
usr/src/sys/vax/uba/up.c
usr/src/sys/vax/vax/autoconf.c
usr/src/sys/vax/vax/conf.c
usr/src/sys/vm/vm_swap.c

index 1ace854..8646b85 100644 (file)
@@ -1,4 +1,4 @@
-/*     hp.c    4.16    81/02/27        */
+/*     hp.c    4.17    81/02/28        */
 
 #include "hp.h"
 #if NHP > 0
 
 #include "hp.h"
 #if NHP > 0
@@ -226,8 +226,8 @@ hpdtint(mi, mbasr)
 
        while ((hpaddr->hpds & HP_DRY) == 0)    /* shouldn't happen */
                printf("hp dry not set\n");
 
        while ((hpaddr->hpds & HP_DRY) == 0)    /* shouldn't happen */
                printf("hp dry not set\n");
-       if (hpaddr->hpds & HP_ERR || mbasr & MBAEBITS)
-               if (++mi->mi_tab.b_errcnt < 28 && (hpaddr->hper1&HP_WLE) == 0) {
+       if (hpaddr->hpds&HP_ERR || mbasr&MBAEBITS)
+               if (++mi->mi_tab.b_errcnt < 28 && (hpaddr->hper1&HP_WLE)==0) {
                        if ((hpaddr->hper1&0xffff) != HP_DCK) {
                                hpaddr->hpcs1 = HP_DCLR|HP_GO;
                                if ((mi->mi_tab.b_errcnt&07) == 4) {
                        if ((hpaddr->hper1&0xffff) != HP_DCK) {
                                hpaddr->hpcs1 = HP_DCLR|HP_GO;
                                if ((mi->mi_tab.b_errcnt&07) == 4) {
@@ -308,10 +308,6 @@ hpecc(mi)
        printf("%D ", bp->b_blkno + npf);
        prdev("ECC", bp->b_dev);
        mask = rp->hpec2&0xffff;
        printf("%D ", bp->b_blkno + npf);
        prdev("ECC", bp->b_dev);
        mask = rp->hpec2&0xffff;
-       if (mask == 0) {
-               rp->hpof = HP_FMT22;
-               return (0);
-       }
 
        i = (rp->hpec1&0xffff) - 1;             /* -1 makes 0 origin */
        bit = i&07;
 
        i = (rp->hpec1&0xffff) - 1;             /* -1 makes 0 origin */
        bit = i&07;
index c23150f..0bb35cc 100644 (file)
@@ -1,4 +1,4 @@
-/*     mba.c   4.10    81/02/26        */
+/*     mba.c   4.11    81/02/28        */
 
 #include "mba.h"
 #if NMBA > 0
 
 #include "mba.h"
 #if NMBA > 0
index 56e9b9c..b5a936c 100644 (file)
@@ -1,8 +1,7 @@
-/*     rk.c    4.16    %G%     */
+/*     rk.c    4.17    %G%     */
 
 #include "rk.h"
 #if NHK > 0
 
 #include "rk.h"
 #if NHK > 0
-int    rkflags,rkerrs;         /* GROT */
 /*
  * RK11/RK07 disk driver
  *
 /*
  * RK11/RK07 disk driver
  *
@@ -35,8 +34,7 @@ struct        rk_softc {
 } rk_softc[NHK];
 
 /* THIS SHOULD BE READ OFF THE PACK, PER DRIVE */
 } rk_softc[NHK];
 
 /* THIS SHOULD BE READ OFF THE PACK, PER DRIVE */
-struct size
-{
+struct size {
        daddr_t nblocks;
        int     cyloff;
 } rk7_sizes[] ={
        daddr_t nblocks;
        int     cyloff;
 } rk7_sizes[] ={
@@ -320,7 +318,6 @@ rkintr(rk11)
                        u_short er = rkaddr->rker;
                        if (sc->sc_recal)
                                printf("recal CERR\n");
                        u_short er = rkaddr->rker;
                        if (sc->sc_recal)
                                printf("recal CERR\n");
-                       rkerrs++;
 #ifdef notdef
 /* THIS ATTEMPTED TO FIND OUT IF THE DRIVE IS SPUN */
 /* DOWN BUT IT DOESN'T SEEM TO WORK... THE DRIVE SEEMS TO */
 #ifdef notdef
 /* THIS ATTEMPTED TO FIND OUT IF THE DRIVE IS SPUN */
 /* DOWN BUT IT DOESN'T SEEM TO WORK... THE DRIVE SEEMS TO */
@@ -347,7 +344,7 @@ rkintr(rk11)
                            ds&RKDS_HARD || er&RKER_HARD || cs2&RKCS2_HARD) {
                                bp->b_flags |= B_ERROR;
                                harderr(bp);
                            ds&RKDS_HARD || er&RKER_HARD || cs2&RKCS2_HARD) {
                                bp->b_flags |= B_ERROR;
                                harderr(bp);
-                               printf("rk%d cs2 %b ds %b er %b\n",
+                               printf("rk%d cs2=%b ds=%b er=%b\n",
                                    dkunit(bp), cs2, RKCS2_BITS, ds, 
                                    RKDS_BITS, er, RKER_BITS);
                        } else
                                    dkunit(bp), cs2, RKCS2_BITS, ds, 
                                    RKDS_BITS, er, RKER_BITS);
                        } else
@@ -457,10 +454,6 @@ rkecc(ui)
        printf("%D ", bp->b_blkno+npf);
        prdev("ECC", bp->b_dev);
        mask = rk->rkec2;
        printf("%D ", bp->b_blkno+npf);
        prdev("ECC", bp->b_dev);
        mask = rk->rkec2;
-       if (mask == 0) {
-               rk->rkatt = 0;
-               return (0);
-       }
        ubapurge(um);
        i = rk->rkec1 - 1;              /* -1 makes 0 origin */
        bit = i&07;
        ubapurge(um);
        i = rk->rkec1 - 1;              /* -1 makes 0 origin */
        bit = i&07;
index 9f69a66..93e1531 100644 (file)
@@ -1,4 +1,4 @@
-/*     uba.c   4.17    %G%     */
+/*     uba.c   4.18    %G%     */
 
 #define        DELAY(N)        { register int d; d = N; while (--d > 0); }
 
 
 #define        DELAY(N)        { register int d; d = N; while (--d > 0); }
 
@@ -112,7 +112,7 @@ ubasetup(uban, bp, flags)
        o = (int)bp->b_un.b_addr & PGOFSET;
        npf = btoc(bp->b_bcount + o) + 1;
        a = spl6();
        o = (int)bp->b_un.b_addr & PGOFSET;
        npf = btoc(bp->b_bcount + o) + 1;
        a = spl6();
-       while ((reg = malloc(uh->uh_map, npf)) == 0) {
+       while ((reg = rmalloc(uh->uh_map, npf)) == 0) {
                if (flags & UBA_CANTWAIT)
                        return (0);
                uh->uh_mrwant++;
                if (flags & UBA_CANTWAIT)
                        return (0);
                uh->uh_mrwant++;
@@ -122,7 +122,7 @@ ubasetup(uban, bp, flags)
        if (flags & UBA_NEEDBDP) {
                while ((bdp = ffs(uh->uh_bdpfree)) == 0) {
                        if (flags & UBA_CANTWAIT) {
        if (flags & UBA_NEEDBDP) {
                while ((bdp = ffs(uh->uh_bdpfree)) == 0) {
                        if (flags & UBA_CANTWAIT) {
-                               mfree(uh->uh_map, npf, reg);
+                               rmfree(uh->uh_map, npf, reg);
                                return (0);
                        }
                        uh->uh_bdpwant++;
                                return (0);
                        }
                        uh->uh_bdpwant++;
@@ -235,7 +235,7 @@ ubarelse(uban, amr)
        npf = (mr >> 18) & 0x3ff;
        reg = ((mr >> 9) & 0x1ff) + 1;
        s = spl6();
        npf = (mr >> 18) & 0x3ff;
        reg = ((mr >> 9) & 0x1ff) + 1;
        s = spl6();
-       mfree(uh->uh_map, npf, reg);
+       rmfree(uh->uh_map, npf, reg);
        splx(s);
 
        /*
        splx(s);
 
        /*
@@ -368,6 +368,8 @@ ubawatch()
        register struct uba_hd *uh;
        register int uban;
 
        register struct uba_hd *uh;
        register int uban;
 
+       if (panicstr)
+               return;
        for (uban = 0; uban < numuba; uban++) {
                uh = &uba_hd[uban];
                if (uh->uh_hangcnt)
        for (uban = 0; uban < numuba; uban++) {
                uh = &uba_hd[uban];
                if (uh->uh_hangcnt)
index 38548bd..087c3bd 100644 (file)
@@ -1,4 +1,4 @@
-/*     up.c    4.26    81/02/27        */
+/*     up.c    4.27    81/02/28        */
 
 #include "up.h"
 #if NSC > 0
 
 #include "up.h"
 #if NSC > 0
@@ -507,9 +507,10 @@ upintr(sc21)
                                return;
                        }
                        harderr(bp);
                                return;
                        }
                        harderr(bp);
-                       printf("up%d cs2 %b er1 %b er2 %b\n",
-                           dkunit(bp), upaddr->upcs2, UPCS2_BITS, upaddr->uper1,
-                           UPER1_BITS, upaddr->uper2, UPER2_BITS);
+                       printf("up%d cs2=%b er1=%b er2=%b\n", dkunit(bp),
+                           upaddr->upcs2, UPCS2_BITS,
+                           upaddr->uper1, UPER1_BITS,
+                           upaddr->uper2, UPER2_BITS);
                        bp->b_flags |= B_ERROR;
                } else {
                        /*
                        bp->b_flags |= B_ERROR;
                } else {
                        /*
@@ -658,10 +659,6 @@ upecc(ui)
        printf("%D ", bp->b_blkno+npf);
        prdev("ECC", bp->b_dev);
        mask = up->upec2;
        printf("%D ", bp->b_blkno+npf);
        prdev("ECC", bp->b_dev);
        mask = up->upec2;
-       if (mask == 0) {
-               up->upof = UP_FMT22;            /* == RTC ???? */
-               return (0);
-       }
        /*
         * Flush the buffered data path, and compute the
         * byte and bit position of the error.  The variable i
        /*
         * Flush the buffered data path, and compute the
         * byte and bit position of the error.  The variable i
index 73182be..56e8bb1 100644 (file)
@@ -1,4 +1,4 @@
-/*     autoconf.c      4.18    81/02/27        */
+/*     autoconf.c      4.19    81/02/28        */
 
 /*
  * Configure the system for the current machine.
 
 /*
  * Configure the system for the current machine.
@@ -348,7 +348,7 @@ unifind(vubp, pubp, vumem, pumem)
         */
        uhp = &uba_hd[numuba];
        uhp->uh_map = (struct map *)calloc(UAMSIZ * sizeof (struct map));
         */
        uhp = &uba_hd[numuba];
        uhp->uh_map = (struct map *)calloc(UAMSIZ * sizeof (struct map));
-       mfree(uhp->uh_map, NUBMREG, 1);
+       rminit(uhp->uh_map, NUBMREG, 1, "uba", UAMSIZ);
        switch (cpu) {
 #if VAX780
        case VAX_780:
        switch (cpu) {
 #if VAX780
        case VAX_780:
index 5e3e83e..51d2f34 100644 (file)
@@ -1,4 +1,4 @@
-/*     conf.c  4.20    %G%     */
+/*     conf.c  4.21    %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -266,7 +266,12 @@ struct cdevsw      cdevsw[] =
 int    ttyopen(),ttread(),nullioctl(),ttstart();
 char   *ttwrite();
 int    ttyinput(),ttyrend();
 int    ttyopen(),ttread(),nullioctl(),ttstart();
 char   *ttwrite();
 int    ttyinput(),ttyrend();
+
+#include "bk.h"
+#if NBK > 0
 int    bkopen(),bkclose(),bkread(),bkinput(),bkioctl();
 int    bkopen(),bkclose(),bkread(),bkinput(),bkioctl();
+#endif
+
 int    ntyopen(),ntyclose(),ntread();
 char   *ntwrite();
 int    ntyinput(),ntyrend();
 int    ntyopen(),ntyclose(),ntread();
 char   *ntwrite();
 int    ntyinput(),ntyrend();
@@ -275,8 +280,13 @@ struct     linesw linesw[] =
 {
        ttyopen, nulldev, ttread, ttwrite, nullioctl,
        ttyinput, ttyrend, nulldev, nulldev, nulldev,           /* 0 */
 {
        ttyopen, nulldev, ttread, ttwrite, nullioctl,
        ttyinput, ttyrend, nulldev, nulldev, nulldev,           /* 0 */
+#if NBK > 0
        bkopen, bkclose, bkread, ttwrite, bkioctl,
        bkinput, nodev, nulldev, ttstart, nulldev,              /* 1 */
        bkopen, bkclose, bkread, ttwrite, bkioctl,
        bkinput, nodev, nulldev, ttstart, nulldev,              /* 1 */
+#else
+       nodev, nodev, nodev, nodev, nodev,
+       nodev, nodev, nodev, nodev, nodev,
+#endif
        ntyopen, ntyclose, ntread, ntwrite, nullioctl,
        ntyinput, ntyrend, nulldev, ttstart, nulldev,           /* 2 */
        mxopen, mxclose, mcread, mcwrite, mxioctl,
        ntyopen, ntyclose, ntread, ntwrite, nullioctl,
        ntyinput, ntyrend, nulldev, ttstart, nulldev,           /* 2 */
        mxopen, mxclose, mcread, mcwrite, mxioctl,
index a0c70ee..befcde0 100644 (file)
@@ -1,4 +1,4 @@
-/*     vm_swap.c       4.2     %G%     */
+/*     vm_swap.c       4.3     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -109,12 +109,18 @@ swfree(index)
                if (vsbase == 0) {
                        /*
                         * Can't free a block starting at 0 in the swapmap
                if (vsbase == 0) {
                        /*
                         * Can't free a block starting at 0 in the swapmap
-                        * but need some space for argmap so use this
+                        * but need some space for argmap so use 1/2 this
                         * hunk which needs special treatment anyways.
                         */
                        argdev = swdevt[0].sw_dev;
                         * hunk which needs special treatment anyways.
                         */
                        argdev = swdevt[0].sw_dev;
-                       mfree(argmap, blk-CLSIZE, vsbase+CLSIZE);
+                       rminit(argmap, blk/2-CLSIZE, CLSIZE,
+                           "argmap", ARGMAPSIZE);
+                       /*
+                        * First of all chunks... initialize the swapmap
+                        * the second half of the hunk.
+                        */
+                       rminit(swapmap, blk/2, blk/2, "swap", nswapmap);
                } else
                } else
-                       mfree(swapmap, blk, vsbase);
+                       rmfree(swapmap, blk, vsbase);
        }
 }
        }
 }