From c84ff1f9adeecac23cd1c7ef74cb535103339800 Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Sun, 1 Mar 1981 01:37:16 -0800 Subject: [PATCH] rmalloc and related stuff 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 | 10 +++------- usr/src/sys/vax/mba/mba.c | 2 +- usr/src/sys/vax/uba/rk.c | 13 +++---------- usr/src/sys/vax/uba/uba.c | 10 ++++++---- usr/src/sys/vax/uba/up.c | 13 +++++-------- usr/src/sys/vax/vax/autoconf.c | 4 ++-- usr/src/sys/vax/vax/conf.c | 12 +++++++++++- usr/src/sys/vm/vm_swap.c | 14 ++++++++++---- 8 files changed, 41 insertions(+), 37 deletions(-) diff --git a/usr/src/sys/vax/mba/hp.c b/usr/src/sys/vax/mba/hp.c index 1ace854498..8646b85449 100644 --- a/usr/src/sys/vax/mba/hp.c +++ b/usr/src/sys/vax/mba/hp.c @@ -1,4 +1,4 @@ -/* hp.c 4.16 81/02/27 */ +/* hp.c 4.17 81/02/28 */ #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"); - 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) { @@ -308,10 +308,6 @@ hpecc(mi) 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; diff --git a/usr/src/sys/vax/mba/mba.c b/usr/src/sys/vax/mba/mba.c index c23150fedb..0bb35ccaf5 100644 --- a/usr/src/sys/vax/mba/mba.c +++ b/usr/src/sys/vax/mba/mba.c @@ -1,4 +1,4 @@ -/* mba.c 4.10 81/02/26 */ +/* mba.c 4.11 81/02/28 */ #include "mba.h" #if NMBA > 0 diff --git a/usr/src/sys/vax/uba/rk.c b/usr/src/sys/vax/uba/rk.c index 56e9b9cda9..b5a936c744 100644 --- a/usr/src/sys/vax/uba/rk.c +++ b/usr/src/sys/vax/uba/rk.c @@ -1,8 +1,7 @@ -/* rk.c 4.16 %G% */ +/* rk.c 4.17 %G% */ #include "rk.h" #if NHK > 0 -int rkflags,rkerrs; /* GROT */ /* * RK11/RK07 disk driver * @@ -35,8 +34,7 @@ struct rk_softc { } rk_softc[NHK]; /* THIS SHOULD BE READ OFF THE PACK, PER DRIVE */ -struct size -{ +struct size { 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"); - 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 */ @@ -347,7 +344,7 @@ rkintr(rk11) 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 @@ -457,10 +454,6 @@ rkecc(ui) 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; diff --git a/usr/src/sys/vax/uba/uba.c b/usr/src/sys/vax/uba/uba.c index 9f69a66a46..93e15316ae 100644 --- a/usr/src/sys/vax/uba/uba.c +++ b/usr/src/sys/vax/uba/uba.c @@ -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); } @@ -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(); - 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++; @@ -122,7 +122,7 @@ ubasetup(uban, bp, flags) 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++; @@ -235,7 +235,7 @@ ubarelse(uban, amr) 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); /* @@ -368,6 +368,8 @@ ubawatch() 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) diff --git a/usr/src/sys/vax/uba/up.c b/usr/src/sys/vax/uba/up.c index 38548bd5a6..087c3bd1ac 100644 --- a/usr/src/sys/vax/uba/up.c +++ b/usr/src/sys/vax/uba/up.c @@ -1,4 +1,4 @@ -/* up.c 4.26 81/02/27 */ +/* up.c 4.27 81/02/28 */ #include "up.h" #if NSC > 0 @@ -507,9 +507,10 @@ upintr(sc21) 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 { /* @@ -658,10 +659,6 @@ upecc(ui) 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 diff --git a/usr/src/sys/vax/vax/autoconf.c b/usr/src/sys/vax/vax/autoconf.c index 73182be2a7..56e8bb18de 100644 --- a/usr/src/sys/vax/vax/autoconf.c +++ b/usr/src/sys/vax/vax/autoconf.c @@ -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. @@ -348,7 +348,7 @@ unifind(vubp, pubp, vumem, pumem) */ 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: diff --git a/usr/src/sys/vax/vax/conf.c b/usr/src/sys/vax/vax/conf.c index 5e3e83ee1c..51d2f34757 100644 --- a/usr/src/sys/vax/vax/conf.c +++ b/usr/src/sys/vax/vax/conf.c @@ -1,4 +1,4 @@ -/* conf.c 4.20 %G% */ +/* conf.c 4.21 %G% */ #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(); + +#include "bk.h" +#if NBK > 0 int bkopen(),bkclose(),bkread(),bkinput(),bkioctl(); +#endif + 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 */ +#if NBK > 0 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, diff --git a/usr/src/sys/vm/vm_swap.c b/usr/src/sys/vm/vm_swap.c index a0c70ee5d5..befcde09ce 100644 --- a/usr/src/sys/vm/vm_swap.c +++ b/usr/src/sys/vm/vm_swap.c @@ -1,4 +1,4 @@ -/* vm_swap.c 4.2 %G% */ +/* vm_swap.c 4.3 %G% */ #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 - * 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; - 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 - mfree(swapmap, blk, vsbase); + rmfree(swapmap, blk, vsbase); } } -- 2.20.1