home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / bugs / 2bsd / 100 next >
Encoding:
Text File  |  1993-01-03  |  22.8 KB  |  816 lines

  1. Newsgroups: comp.bugs.2bsd
  2. Path: sparky!uunet!gatech!europa.asd.contel.com!awds.imsd.contel.com!wlbr!sms
  3. From: sms@WLV.IIPO.GTEGSC.COM (Steven M. Schultz)
  4. Subject: Serious standalone 'restor' bug (+fix) (#88)
  5. Message-ID: <1993Jan3.052355.3193@wlbr.iipo.gtegsc.com>
  6. Sender: news@wlbr.iipo.gtegsc.com (news)
  7. Nntp-Posting-Host: wlv.iipo.gtegsc.com
  8. Organization: GTE Government Systems
  9. Date: Sun, 3 Jan 93 05:23:55 GMT
  10. Lines: 804
  11.  
  12. Subject: Serious standalone 'restor' bug (+fix) (#88)
  13. Index:    sys/pdpstand/sys,ra.c+others 2.11BSD
  14.  
  15. Description:
  16.     There are two major problems in the standalone runtime.
  17.  
  18.     The first problem shows up when using a raw disc as the input 
  19.     file with standalone 'restor'.  It does not work at all.  Also
  20.     not working is the case where a multivolume dump (several floppies 
  21.     for example) is used with standalone restor.
  22.  
  23.     The second problem is specific to the MSCP standalone driver.  When
  24.     both input and output files are drives on the same controller (the
  25.     input file is a RX33 and the disc being restor'd to is an RD54)
  26.     'restor' locks up without an error.
  27.  
  28. Repeat-By:
  29.     The first problem is fairly easy to reproduce.  Use as input to
  30.     standalone restor anything except a tape as the input device.  The
  31.     multivolume part of the problem is also fairly easy, simply attempt
  32.     to use 4 RX33 floppies (to create them tell 'dump' that he is using
  33.     a tape 70 feet long) as input to standalone restor.  After a volume
  34.     change note that restor keeps prompting for the next volume - this is
  35.     because the block number to read was not reset when the diskette was
  36.     changed and the device driver is rejecting the i/o request because
  37.     the block number is out of range.
  38.  
  39.     The second problem is a bit more difficult to duplicate.  The
  40.     scenario in which the problem involved a RX33 [unit 1] and a RD54 
  41.     [unit 0] both attached to the same RQDX3.  The "Tape? " prompt was
  42.     answered "ra(1,0)" (after making sure that the first volume of the
  43.     dump set was in the RX33).  The "Disk? " prompt was answered "ra(0,0)".
  44.     After about a minute both disc drives would cease activity.  Halting
  45.     and single stepping the processor showed an endless loop in the
  46.     'ra.c' driver waiting for an operation to complete.
  47.  
  48. Fix:
  49.     The patches below fix both problems.
  50.  
  51.     Problem 1 was caused by the 'sys.c' module assuming that all
  52.     i/o operations to non-files (raw devices) were 1kb (CLSIZE) in
  53.     length.  The block number to read (or write) next would thus only
  54.     be incremented by 2 even though 'restor' was reading 20 blocks
  55.     (10kb) at a time.  The multivolume part of this problem was caused
  56.     by the block number never being cleared.  Thus reading of the
  57.     second RX33 (~2400 blocks) would start at block number 2400 (the
  58.     end of volume 1).
  59.  
  60.     Problem 2 was fixed by 1) providing the RQDX3 with an interrupt 
  61.     vector in the process of going to step 2 in the initialization 
  62.     sequence and 2) removing the "request interrupt" bit in the 
  63.     request descriptors.  Also added were minor delays before accessing
  64.     the device registers and checks for failure to enter the various
  65.     steps during initialization.
  66.  
  67.     With the fixes above installed the standalone restor program
  68.     exceeded 48kb (max size of a standalone program).  To reduce
  69.     restor's size several small changes were made to other drivers
  70.     (br, rl, si, tmscp).  These changes consist of changing the
  71.     "segflag & 3" statements to simply "segflag".  The "& 3" was
  72.     redundant since 'segflag' is never anything but 1, 2 or 3 anyhow
  73.     (from M.s)!  In sys.c a couple of 'goto' statments were added
  74.     to remove redundant statements and strings.
  75.  
  76.     The last two changes are somewhat cosmetic, removing references
  77.     to UCB_NKB (which is _always_ defined and has been for many years)
  78.     in two of the (unused) NEW/ modules.
  79.  
  80. =============================cut here===================================
  81. *** /sys/pdpstand/sys.c.old    Sun Apr 21 00:18:28 1991
  82. --- /sys/pdpstand/sys.c    Sat Jan  2 15:01:48 1993
  83. ***************
  84. *** 3,9 ****
  85.    * All rights reserved.  The Berkeley software License Agreement
  86.    * specifies the terms and conditions for redistribution.
  87.    *
  88. !  *    @(#)sys.c    2.0 (2.11BSD) 4/20/91
  89.    */
  90.   
  91.   #include "../h/param.h"
  92. --- 3,9 ----
  93.    * All rights reserved.  The Berkeley software License Agreement
  94.    * specifies the terms and conditions for redistribution.
  95.    *
  96. !  *    @(#)sys.c    2.1 (2.11BSD) 1/2/93
  97.    */
  98.   
  99.   #include "../h/param.h"
  100. ***************
  101. *** 140,149 ****
  102.        * fetch the address from the inode
  103.        */
  104.       nb = ip->i_addr[NADDR-j];
  105. !     if (nb == 0) {
  106. !         printf("bn void %D\n", bn);
  107. !         return((daddr_t)0);
  108. !     }
  109.   
  110.       /*
  111.        * fetch through the indirect blocks
  112. --- 140,147 ----
  113.        * fetch the address from the inode
  114.        */
  115.       nb = ip->i_addr[NADDR-j];
  116. !     if (nb == 0)
  117. !         goto bnvoid;
  118.   
  119.       /*
  120.        * fetch through the indirect blocks
  121. ***************
  122. *** 161,166 ****
  123. --- 159,165 ----
  124.           i = (bn>>sh) & NMASK;
  125.           nb = bap[i];
  126.           if (nb == 0) {
  127. + bnvoid:
  128.               printf("bn void %D\n", bn);
  129.               return((daddr_t)0);
  130.           }
  131. ***************
  132. *** 243,249 ****
  133.       register struct iob *io;
  134.   
  135.       if (ptr != 0) {
  136. !         printf("illegal lseek\n");
  137.           return(-1);
  138.       }
  139.       fdesc -= 3;
  140. --- 242,248 ----
  141.       register struct iob *io;
  142.   
  143.       if (ptr != 0) {
  144. !         printf("lseek\n");
  145.           return(-1);
  146.       }
  147.       fdesc -= 3;
  148. ***************
  149. *** 348,354 ****
  150.           file->i_cc = count;
  151.           file->i_ma = buf;
  152.           i = devread(file);
  153. !         file->i_bn += CLSIZE;
  154.           return(i);
  155.       }
  156.       else {
  157. --- 347,353 ----
  158.           file->i_cc = count;
  159.           file->i_ma = buf;
  160.           i = devread(file);
  161. !         file->i_bn += (count / NBPG);
  162.           return(i);
  163.       }
  164.       else {
  165. ***************
  166. *** 385,391 ****
  167.       file->i_cc = count;
  168.       file->i_ma = buf;
  169.       i = devwrite(file);
  170. !     file->i_bn += CLSIZE;
  171.       return(i);
  172.   }
  173.   
  174. --- 384,390 ----
  175.       file->i_cc = count;
  176.       file->i_ma = buf;
  177.       i = devwrite(file);
  178. !     file->i_bn += (count / NBPG);
  179.       return(i);
  180.   }
  181.   
  182. ***************
  183. *** 454,462 ****
  184.           return(-1);
  185.       if (*++cp == '\0') {
  186.           file->i_flgs |= how+1;
  187. !         file->i_cc = 0;
  188. !         file->i_offset = 0;
  189. !         return(fdesc+3);
  190.       }
  191.       if ((i = find(cp, file)) == 0) {
  192.           file->i_flgs = 0;
  193. --- 453,459 ----
  194.           return(-1);
  195.       if (*++cp == '\0') {
  196.           file->i_flgs |= how+1;
  197. !         goto comret;
  198.       }
  199.       if ((i = find(cp, file)) == 0) {
  200.           file->i_flgs = 0;
  201. ***************
  202. *** 468,476 ****
  203.           return(-1);
  204.       }
  205.       openi(i, file);
  206.       file->i_offset = 0;
  207.       file->i_cc = 0;
  208. !     file->i_flgs |= F_FILE | (how+1);
  209.       return(fdesc+3);
  210.   }
  211.   
  212. --- 465,475 ----
  213.           return(-1);
  214.       }
  215.       openi(i, file);
  216. +     file->i_flgs |= F_FILE | (how+1);
  217. + comret:
  218.       file->i_offset = 0;
  219.       file->i_cc = 0;
  220. !     file->i_bn = 0;
  221.       return(fdesc+3);
  222.   }
  223.   
  224. *** /sys/pdpstand/ra.c.old    Thu Dec 26 12:11:36 1991
  225. --- /sys/pdpstand/ra.c    Sat Jan  2 00:29:55 1993
  226. ***************
  227. *** 3,14 ****
  228.    * All rights reserved.  The Berkeley software License Agreement
  229.    * specifies the terms and conditions for redistribution.
  230.    *
  231. !  *    @(#)ra.c    2.0 (2.11BSD) 4/20/91
  232.    */
  233.   
  234.   /*
  235. !  * RAxx disk device driver
  236. !  * RQDX?/UDA50 (rx33, rx50, rd5?, ra??)
  237.    */
  238.   #include "../h/param.h"
  239.   #include "../h/inode.h"
  240. --- 3,13 ----
  241.    * All rights reserved.  The Berkeley software License Agreement
  242.    * specifies the terms and conditions for redistribution.
  243.    *
  244. !  *    @(#)ra.c    2.3 (2.11BSD GTE) 1/1/93
  245.    */
  246.   
  247.   /*
  248. !  * MSCP disk device driver (rx23, rx33, rx50, rd??, ra??, rz??)
  249.    */
  250.   #include "../h/param.h"
  251.   #include "../h/inode.h"
  252. ***************
  253. *** 17,22 ****
  254. --- 16,22 ----
  255.   #include "saio.h"
  256.   
  257.   #define    NRA    2
  258. + #define    RA_SMASK    (RA_STEP4|RA_STEP3|RA_STEP2|RA_STEP1)
  259.   
  260.       struct    radevice *RAcsr[NRA + 1] =
  261.           {
  262. ***************
  263. *** 69,94 ****
  264.       racom = &rd[ctlr];
  265.   
  266.       if (rainit[ctlr] == 0) {
  267. !         raaddr->raip = 0;
  268. !         while ((raaddr->rasa & RA_STEP1) == 0)
  269. !             continue;
  270. !         raaddr->rasa = RA_ERR;
  271. !         while ((raaddr->rasa & RA_STEP2) == 0)
  272. !             continue;
  273.           raaddr->rasa = (short)&racom->ra_ca.ca_ringbase;
  274. !         while ((raaddr->rasa & RA_STEP3) == 0)
  275. !             continue;
  276. !         raaddr->rasa = (short)(segflag & 3);
  277. !         while ((raaddr->rasa & RA_STEP4) == 0)
  278. !             continue;
  279.           raaddr->rasa = RA_GO;
  280.           racom->ra_ca.ca_rspl = (short)&racom->ra_rsp.m_cmdref;
  281. !         racom->ra_ca.ca_rsph = (short)(segflag & 3);
  282.           racom->ra_ca.ca_cmdl = (short)&racom->ra_cmd.m_cmdref;
  283. !         racom->ra_ca.ca_cmdh = (short)(segflag & 3);
  284.           racom->ra_cmd.m_cntflgs = 0;
  285.           if (racmd(M_O_STCON, io->i_unit) < 0) {
  286. !             printf("RA%d ctlr STCON err\n", ctlr);
  287.               return(-1);
  288.           }
  289.           rainit[ctlr] = 1;
  290. --- 69,94 ----
  291.       racom = &rd[ctlr];
  292.   
  293.       if (rainit[ctlr] == 0) {
  294. ! again:        raaddr->raip = 0;
  295. !         if     (ra_step(raaddr, RA_STEP1, 1))
  296. !             goto again;
  297. !         raaddr->rasa = RA_ERR | (0154/4);
  298. !         if    (ra_step(raaddr, RA_STEP2, 2))
  299. !             goto again;
  300.           raaddr->rasa = (short)&racom->ra_ca.ca_ringbase;
  301. !         if    (ra_step(raaddr, RA_STEP3, 3))
  302. !             goto again;
  303. !         raaddr->rasa = segflag;
  304. !         if    (ra_step(raaddr, RA_STEP4, 4))
  305. !             goto again;
  306.           raaddr->rasa = RA_GO;
  307.           racom->ra_ca.ca_rspl = (short)&racom->ra_rsp.m_cmdref;
  308. !         racom->ra_ca.ca_rsph = segflag;
  309.           racom->ra_ca.ca_cmdl = (short)&racom->ra_cmd.m_cmdref;
  310. !         racom->ra_ca.ca_cmdh = segflag;
  311.           racom->ra_cmd.m_cntflgs = 0;
  312.           if (racmd(M_O_STCON, io->i_unit) < 0) {
  313. !             printf("RA%d STCON err\n", ctlr);
  314.               return(-1);
  315.           }
  316.           rainit[ctlr] = 1;
  317. ***************
  318. *** 114,120 ****
  319.       register int unit = UNITn(io->i_unit);
  320.   
  321.       if (racmd(M_O_ONLIN, io->i_unit) < 0) {
  322. !         printf("RA%d,%d: online err\n", ctlr, unit);
  323.           return(-1);
  324.       }
  325.       raonline[ctlr][unit] = rd[ctlr].ra_rsp.m_uslow +  
  326. --- 114,120 ----
  327.       register int unit = UNITn(io->i_unit);
  328.   
  329.       if (racmd(M_O_ONLIN, io->i_unit) < 0) {
  330. !         printf("RA%d: online err\n", io->i_unit);
  331.           return(-1);
  332.       }
  333.       raonline[ctlr][unit] = rd[ctlr].ra_rsp.m_uslow +  
  334. ***************
  335. *** 128,133 ****
  336. --- 128,134 ----
  337.       register struct mscp *mp;
  338.       register int ctlr = CTLRn(unit);
  339.       register struct ra *racom = &rd[ctlr];
  340. +     struct    radevice *csr = RAcsr[ctlr];
  341.       int i;
  342.   
  343.       racom->ra_cmd.m_opcode = op;
  344. ***************
  345. *** 134,157 ****
  346.       racom->ra_cmd.m_unit = UNITn(unit);
  347.       racom->ra_rsp.m_header.ra_msglen = sizeof(struct mscp);
  348.       racom->ra_cmd.m_header.ra_msglen = sizeof(struct mscp);
  349. !     racom->ra_ca.ca_rsph = RA_OWN | RA_INT | (segflag & 3);
  350. !     racom->ra_ca.ca_cmdh = RA_OWN | RA_INT | (segflag & 3);
  351. !     i = RAcsr[ctlr]->raip;
  352.       while (1) {
  353. !         if (racom->ra_ca.ca_cmdint)
  354. !             racom->ra_ca.ca_cmdint = 0;
  355. !         if (racom->ra_ca.ca_rspint)
  356.               break;
  357.       }
  358. !     racom->ra_ca.ca_rspint = 0;
  359. !     mp = &racom->ra_rsp;
  360. !     if ((mp->m_opcode != (op | M_O_END)) ||
  361. !         ((mp->m_status & M_S_MASK) != M_S_SUCC)) {
  362. !         printf("RA%d,%d: cmd err op=%x, sts=%x\n",
  363. !             ctlr, unit, mp->m_opcode, mp->m_status);
  364.           return(-1);
  365.       }
  366.       return(0);
  367.   }
  368.   
  369.   rastrategy(io, func)
  370. --- 135,171 ----
  371.       racom->ra_cmd.m_unit = UNITn(unit);
  372.       racom->ra_rsp.m_header.ra_msglen = sizeof(struct mscp);
  373.       racom->ra_cmd.m_header.ra_msglen = sizeof(struct mscp);
  374. !     racom->ra_ca.ca_rsph = RA_OWN | segflag;
  375. !     racom->ra_ca.ca_cmdh = RA_OWN | segflag;
  376. !     i = csr->raip;
  377. !     mp = &racom->ra_rsp;
  378.       while (1) {
  379. !         while    (racom->ra_ca.ca_cmdh & RA_OWN) {
  380. !             delay(200);        /* SA access delay */
  381. !             if    (csr->rasa & (RA_ERR|RA_SMASK))
  382. !                 goto fail;
  383. !         }
  384. !         while    (racom->ra_ca.ca_rsph & RA_OWN) {
  385. !             delay(200);        /* SA access delay */
  386. !             if    (csr->rasa & (RA_ERR|RA_SMASK))
  387. !                 goto fail;
  388. !         }
  389. !         racom->ra_ca.ca_cmdint = 0;
  390. !         racom->ra_ca.ca_rspint = 0;
  391. !         if (mp->m_opcode == (op | M_O_END))
  392.               break;
  393. +         printf("RA%d: rsp %x op %x ignored\n",
  394. +             unit,mp->m_header.ra_credits & 0xf0, mp->m_opcode);
  395. +         racom->ra_ca.ca_rsph |= RA_OWN;
  396.       }
  397. !     if ((mp->m_status & M_S_MASK) != M_S_SUCC) {
  398. !         printf("RA%d: err op=%x sts=%x\n",unit,
  399. !             mp->m_opcode, mp->m_status);
  400.           return(-1);
  401.       }
  402.       return(0);
  403. + fail:
  404. +     printf("RA%d: rasa=%o\n", ctlr, csr->rasa);
  405.   }
  406.   
  407.   rastrategy(io, func)
  408. ***************
  409. *** 170,177 ****
  410.       mp->m_lbn_h = hiint(io->i_bn);
  411.       mp->m_bytecnt = io->i_cc;
  412.       mp->m_buf_l = (ushort)io->i_ma;
  413. !     mp->m_buf_h = segflag & 3;
  414.       if (racmd(func == READ ? M_O_READ : M_O_WRITE, io->i_unit) < 0)
  415.           return(-1);
  416.       return(io->i_cc);
  417.   }
  418. --- 184,217 ----
  419.       mp->m_lbn_h = hiint(io->i_bn);
  420.       mp->m_bytecnt = io->i_cc;
  421.       mp->m_buf_l = (ushort)io->i_ma;
  422. !     mp->m_buf_h = segflag;
  423.       if (racmd(func == READ ? M_O_READ : M_O_WRITE, io->i_unit) < 0)
  424.           return(-1);
  425.       return(io->i_cc);
  426.   }
  427. + ra_step(csr, mask, step)
  428. +     register struct radevice *csr;
  429. +     int mask, step;
  430. +     {
  431. +     register int    cnt;
  432. +     for    (cnt = 0; (csr->rasa & mask) == 0; )
  433. +         {
  434. +         delay(2000);
  435. +         cnt++;
  436. +         if    (cnt < 10000)
  437. +             continue;
  438. +         printf("RA(%o) failed step %d. retrying\n",csr,step);
  439. +         return(1);
  440. +         }
  441. +     return(0);
  442. +     }
  443. + delay(l)
  444. +     int    l;
  445. +     {
  446. +     while    (l > 0)
  447. +         l--;
  448. +     }
  449. *** /sys/pdpstand/br.c.old    Sun Apr 21 00:05:45 1991
  450. --- /sys/pdpstand/br.c    Sat Jan  2 00:20:10 1993
  451. ***************
  452. *** 3,9 ****
  453.    * All rights reserved.  The Berkeley software License Agreement
  454.    * specifies the terms and conditions for redistribution.
  455.    *
  456. !  *    @(#)br.c    2.0 (2.11BSD) 4/20/91
  457.    */
  458.   
  459.   /*
  460. --- 3,9 ----
  461.    * All rights reserved.  The Berkeley software License Agreement
  462.    * specifies the terms and conditions for redistribution.
  463.    *
  464. !  *    @(#)br.c    2.1 (2.11BSD) 1/2/93
  465.    */
  466.   
  467.   /*
  468. ***************
  469. *** 50,56 ****
  470.           while ((braddr->brcs.w & BR_RDY) == 0 && --ctr)
  471.               continue;
  472.           if (braddr->brcs.w & BR_HE) {
  473. !             printf("br%d,%d not ready\n", ctlr,unit);
  474.               return(-1);
  475.           }
  476.           com = braddr->brae;
  477. --- 50,56 ----
  478.           while ((braddr->brcs.w & BR_RDY) == 0 && --ctr)
  479.               continue;
  480.           if (braddr->brcs.w & BR_HE) {
  481. !             printf("br%d,%d !ready\n", ctlr,unit);
  482.               return(-1);
  483.           }
  484.           com = braddr->brae;
  485. ***************
  486. *** 84,91 ****
  487.       while ((braddr->brcs.w& BR_RDY)==0)
  488.           continue;
  489.       if (braddr->brcs.w < 0) {    /* error bit */
  490. !         printf("br%d,%d err: cy=%d tr=%d sc=%d er=%o ds=%o\n",
  491. !             ctlr, unit, cn, tn, sn, braddr->brer, braddr->brds);
  492.           return(-1);
  493.       }
  494.       return(io->i_cc);
  495. --- 84,91 ----
  496.       while ((braddr->brcs.w& BR_RDY)==0)
  497.           continue;
  498.       if (braddr->brcs.w < 0) {    /* error bit */
  499. !         printf("br%d err: cy=%d tr=%d sc=%d er=%o ds=%o\n",
  500. !             unit, cn, tn, sn, braddr->brer, braddr->brds);
  501.           return(-1);
  502.       }
  503.       return(io->i_cc);
  504. *** /sys/pdpstand/rl.c.old    Sun Apr 21 00:15:03 1991
  505. --- /sys/pdpstand/rl.c    Sat Jan  2 00:31:59 1993
  506. ***************
  507. *** 3,9 ****
  508.    * All rights reserved.  The Berkeley software License Agreement
  509.    * specifies the terms and conditions for redistribution.
  510.    *
  511. !  *    @(#)rl.c    2.0 (2.11BSD) 4/20/91
  512.    */
  513.   
  514.   /*
  515. --- 3,9 ----
  516.    * All rights reserved.  The Berkeley software License Agreement
  517.    * specifies the terms and conditions for redistribution.
  518.    *
  519. !  *    @(#)rl.c    2.1 (2.11BSD) 1/2/93
  520.    */
  521.   
  522.   /*
  523. ***************
  524. *** 117,123 ****
  525.       rlp->chn = io->i_bn/20;
  526.       rlp->sn = (io->i_bn%20) << 1;
  527.       rlp->bleft = io->i_cc;
  528. !     rlp->addr.w[0] = segflag & 3;
  529.       rlp->addr.w[1] = (int)io->i_ma;
  530.       rlp->com = (drive << 8);
  531.       if (func == READ)
  532. --- 117,123 ----
  533.       rlp->chn = io->i_bn/20;
  534.       rlp->sn = (io->i_bn%20) << 1;
  535.       rlp->bleft = io->i_cc;
  536. !     rlp->addr.w[0] = segflag;
  537.       rlp->addr.w[1] = (int)io->i_ma;
  538.       rlp->com = (drive << 8);
  539.       if (func == READ)
  540. *** /sys/pdpstand/si.c.old    Sun Apr 21 00:15:46 1991
  541. --- /sys/pdpstand/si.c    Sat Jan  2 00:32:46 1993
  542. ***************
  543. *** 65,71 ****
  544.       siaddr->sihsr = (tn << 5) + sn;
  545.       siaddr->simar = io->i_ma;
  546.       siaddr->siwcr = io->i_cc >> 1;
  547. !     ii = ((segflag & 03) << 4) | SI_GO;
  548.       if (func == READ)
  549.           ii |= SI_READ;
  550.       else if (func == WRITE)
  551. --- 65,71 ----
  552.       siaddr->sihsr = (tn << 5) + sn;
  553.       siaddr->simar = io->i_ma;
  554.       siaddr->siwcr = io->i_cc >> 1;
  555. !     ii = (segflag << 4) | SI_GO;
  556.       if (func == READ)
  557.           ii |= SI_READ;
  558.       else if (func == WRITE)
  559. *** /sys/pdpstand/tmscp.c.old    Sun Apr 21 00:21:54 1991
  560. --- /sys/pdpstand/tmscp.c    Sat Jan  2 00:33:59 1993
  561. ***************
  562. *** 125,131 ****
  563.   #        define STEP2GOOD (TMSCP_STEP3)
  564.           if ((tmscpaddr->tmscpsa&STEP2MASK) != STEP2GOOD)
  565.               printf(opnmsg, ctlr, 2, tmscpaddr->tmscpsa);
  566. !         tmscpaddr->tmscpsa = (short) (segflag & 3);
  567.    
  568.           while ((tmscpaddr->tmscpsa & TMSCP_STEP4) == 0)
  569.               ;
  570. --- 125,131 ----
  571.   #        define STEP2GOOD (TMSCP_STEP3)
  572.           if ((tmscpaddr->tmscpsa&STEP2MASK) != STEP2GOOD)
  573.               printf(opnmsg, ctlr, 2, tmscpaddr->tmscpsa);
  574. !         tmscpaddr->tmscpsa = segflag;
  575.    
  576.           while ((tmscpaddr->tmscpsa & TMSCP_STEP4) == 0)
  577.               ;
  578. ***************
  579. *** 205,215 ****
  580.        * Init cmd & rsp area
  581.        */
  582.       tms->tmscp_ca.ca_cmddsc[0].lsh = (short)&tms->tmscp_cmd.mscp_cmdref;
  583. !     tms->tmscp_ca.ca_cmddsc[0].hsh = segflag & 3;
  584.       tms->tmscp_cmd.mscp_dscptr = (long *)tms->tmscp_ca.ca_cmddsc;
  585.       tms->tmscp_cmd.mscp_header.tmscp_vcid = 1;    /* for tape */
  586.       tms->tmscp_ca.ca_rspdsc[0].lsh = (short)&tms->tmscp_rsp.mscp_cmdref;
  587. !     tms->tmscp_ca.ca_rspdsc[0].hsh = segflag & 3;
  588.       tms->tmscp_rsp.mscp_dscptr = (long *)tms->tmscp_ca.ca_rspdsc;
  589.       tms->tmscp_cmd.mscp_cntflgs = 0;
  590.   
  591. --- 205,215 ----
  592.        * Init cmd & rsp area
  593.        */
  594.       tms->tmscp_ca.ca_cmddsc[0].lsh = (short)&tms->tmscp_cmd.mscp_cmdref;
  595. !     tms->tmscp_ca.ca_cmddsc[0].hsh = segflag;
  596.       tms->tmscp_cmd.mscp_dscptr = (long *)tms->tmscp_ca.ca_cmddsc;
  597.       tms->tmscp_cmd.mscp_header.tmscp_vcid = 1;    /* for tape */
  598.       tms->tmscp_ca.ca_rspdsc[0].lsh = (short)&tms->tmscp_rsp.mscp_cmdref;
  599. !     tms->tmscp_ca.ca_rspdsc[0].hsh = segflag;
  600.       tms->tmscp_rsp.mscp_dscptr = (long *)tms->tmscp_ca.ca_rspdsc;
  601.       tms->tmscp_cmd.mscp_cntflgs = 0;
  602.   
  603. ***************
  604. *** 280,286 ****
  605.       mp->mscp_unit = UNITn(io->i_unit);
  606.       mp->mscp_bytecnt = io->i_cc;
  607.       mp->mscp_buffer_l = (u_short)io->i_ma;
  608. !     mp->mscp_buffer_h = segflag & 3;
  609.       if (tmscpcmd(ctlr, func == READ ? M_OP_READ : M_OP_WRITE, 0)==0) {
  610.           printf("tms%d,%d: I/O err\n", ctlr, UNITn(io->i_unit));
  611.           return(-1);
  612. --- 280,286 ----
  613.       mp->mscp_unit = UNITn(io->i_unit);
  614.       mp->mscp_bytecnt = io->i_cc;
  615.       mp->mscp_buffer_l = (u_short)io->i_ma;
  616. !     mp->mscp_buffer_h = segflag;
  617.       if (tmscpcmd(ctlr, func == READ ? M_OP_READ : M_OP_WRITE, 0)==0) {
  618.           printf("tms%d,%d: I/O err\n", ctlr, UNITn(io->i_unit));
  619.           return(-1);
  620. *** /sys/pdpstand/boot.c.old    Mon May 27 20:33:44 1991
  621. --- /sys/pdpstand/boot.c    Sat Jan  2 00:18:13 1993
  622. ***************
  623. *** 3,9 ****
  624.    * All rights reserved.  The Berkeley software License Agreement
  625.    * specifies the terms and conditions for redistribution.
  626.    *
  627. !  *    @(#)boot.c    2.1 (2.11BSD) 5/25/91
  628.    */
  629.   #include "../h/param.h"
  630.   #include "../machine/seg.h"
  631. --- 3,9 ----
  632.    * All rights reserved.  The Berkeley software License Agreement
  633.    * specifies the terms and conditions for redistribution.
  634.    *
  635. !  *    @(#)boot.c    2.2 (2.11BSD) 1/1/93
  636.    */
  637.   #include "../h/param.h"
  638.   #include "../machine/seg.h"
  639. ***************
  640. *** 128,137 ****
  641.       char    line[64], defnam[64], *itoa();
  642.   
  643.       maj = major(bootdev);
  644. !     if (maj >= ndevsw) {
  645. !         printf("bootdev: 0%o", bootdev);
  646. !         _stop("bad major");
  647. !     }
  648.       adjcsr = (caddr_t *)((short)bootcsr - ADJcsr[maj]);
  649.       for (i = 0; devsw[maj].dv_csr != (caddr_t) -1; i++) {
  650.           if (adjcsr == devsw[maj].dv_csr[i])
  651. --- 128,135 ----
  652.       char    line[64], defnam[64], *itoa();
  653.   
  654.       maj = major(bootdev);
  655. !     if (maj >= ndevsw)
  656. !         _stop("bad major");        /* can't happen */
  657.       adjcsr = (caddr_t *)((short)bootcsr - ADJcsr[maj]);
  658.       for (i = 0; devsw[maj].dv_csr != (caddr_t) -1; i++) {
  659.           if (adjcsr == devsw[maj].dv_csr[i])
  660. ***************
  661. *** 141,150 ****
  662.               break;
  663.           }
  664.       }
  665. !     if (devsw[maj].dv_csr[i] == (caddr_t *) -1) {
  666. !         printf("bootdev: 0%o", bootdev);
  667.           _stop("no free csr slots");
  668. -     }
  669.       bootdev &= ~(3 << 6);
  670.       bootdev |= (i << 6);    /* controller # to bits 6&7 */
  671.       printf("\n%d%s from %s(%d,0,0%o)\n", cputype, module, 
  672. --- 139,146 ----
  673.               break;
  674.           }
  675.       }
  676. !     if (devsw[maj].dv_csr[i] == (caddr_t *) -1)
  677.           _stop("no free csr slots");
  678.       bootdev &= ~(3 << 6);
  679.       bootdev |= (i << 6);    /* controller # to bits 6&7 */
  680.       printf("\n%d%s from %s(%d,0,0%o)\n", cputype, module, 
  681. ***************
  682. *** 219,225 ****
  683.       for (i = 0; i < sizeof(loadtable) / sizeof(struct loadtable); i++)
  684.           if (loadtable[i].lt_magic == exec.a_magic)
  685.               return(&loadtable[i]);
  686. !     printf("Bad magic number 0%o\n", exec.a_magic);
  687.       return((struct loadtable *) NULL);
  688.   }
  689.   
  690. --- 215,221 ----
  691.       for (i = 0; i < sizeof(loadtable) / sizeof(struct loadtable); i++)
  692.           if (loadtable[i].lt_magic == exec.a_magic)
  693.               return(&loadtable[i]);
  694. !     printf("Bad magic # 0%o\n", exec.a_magic);
  695.       return((struct loadtable *) NULL);
  696.   }
  697.   
  698. ***************
  699. *** 239,245 ****
  700.        */
  701.       if (exec.a_magic == A_MAGIC3 || exec.a_magic == A_MAGIC6)
  702.           if (!sep_id) {
  703. !             printf("Cannot load separate I & D object files\n");
  704.               return(-1);
  705.           } else
  706.               setsep();
  707. --- 235,241 ----
  708.        */
  709.       if (exec.a_magic == A_MAGIC3 || exec.a_magic == A_MAGIC6)
  710.           if (!sep_id) {
  711. !             printf("Can't load split I&D files\n");
  712.               return(-1);
  713.           } else
  714.               setsep();
  715. ***************
  716. *** 291,297 ****
  717.                   /*
  718.                    * This ``cannot happen.''
  719.                    */
  720. !                 printf("Unknown segment type in load table:  %d\n", segtype);
  721.                   return(-1);
  722.                   /*NOTREACHED*/
  723.           }
  724. --- 287,293 ----
  725.                   /*
  726.                    * This ``cannot happen.''
  727.                    */
  728. !                 printf("seg type botch: %d\n", segtype);
  729.                   return(-1);
  730.                   /*NOTREACHED*/
  731.           }
  732. ***************
  733. *** 299,307 ****
  734.           seglen = ctob(btoc(seglen));
  735.           if (((long) seglen) > lm->seg_len) {
  736.               if (segtype == SEG_OVLY)
  737. !                 printf("%s %d too large by %D bytes", segname, ovseg, lm->seg_len -((long) seglen));
  738.               else
  739. !                 printf("%s too large by %D bytes", segname, lm->seg_len -((long) seglen));
  740.               return(-1);
  741.           }
  742.           if (segtype == SEG_TEXT)
  743. --- 295,303 ----
  744.           seglen = ctob(btoc(seglen));
  745.           if (((long) seglen) > lm->seg_len) {
  746.               if (segtype == SEG_OVLY)
  747. !                 printf("%s %d over by %D bytes", segname, ovseg, lm->seg_len -((long) seglen));
  748.               else
  749. !                 printf("%s over by %D bytes", segname, lm->seg_len -((long) seglen));
  750.               return(-1);
  751.           }
  752.           if (segtype == SEG_TEXT)
  753. ***************
  754. *** 308,320 ****
  755.               switch (exec.a_magic) {
  756.               case A_MAGIC5:
  757.                   if (seglen <= 8 KB) {
  758. !                 printf("Base segment too small, 8K minimum\n");
  759.                   return(-1);
  760.                   }
  761.                   break;
  762.               case A_MAGIC6:
  763.                   if (seglen <= 48 KB) {
  764. !                 printf("Base segment too small, 48K minimum\n");
  765.                   return(-1);
  766.                   }
  767.                   break;
  768. --- 304,316 ----
  769.               switch (exec.a_magic) {
  770.               case A_MAGIC5:
  771.                   if (seglen <= 8 KB) {
  772. !                 printf("Base too small, 8K min\n");
  773.                   return(-1);
  774.                   }
  775.                   break;
  776.               case A_MAGIC6:
  777.                   if (seglen <= 48 KB) {
  778. !                 printf("Base too small, 48K min\n");
  779.                   return(-1);
  780.                   }
  781.                   break;
  782. *** /sys/pdpstand/NEW/dskinit.c.old    Thu Jan  5 21:52:31 1989
  783. --- /sys/pdpstand/NEW/dskinit.c    Wed Dec 23 23:30:48 1992
  784. ***************
  785. *** 57,66 ****
  786.    * Must use 512 instead of BSIZE (1024 for new file system).
  787.    * Fred Canter 6/12/85
  788.    */
  789. - #ifdef    UCB_NKB
  790.   #undef    BSIZE
  791.   #define    BSIZE    512
  792. - #endif    UCB_NKB
  793.   
  794.   #define READ 1
  795.   #define WRITE 0
  796. --- 57,64 ----
  797. *** /sys/pdpstand/NEW/bads.c.old    Thu Jan  5 21:50:49 1989
  798. --- /sys/pdpstand/NEW/bads.c    Wed Dec 23 23:30:58 1992
  799. ***************
  800. *** 49,58 ****
  801.    * Must use 512 instead of BSIZE (1024 for new file system).
  802.    * Fred Canter 6/12/85
  803.    */
  804. - #ifdef    UCB_NKB
  805.   #undef    BSIZE
  806.   #define    BSIZE    512
  807. - #endif    UCB_NKB
  808.   
  809.   /*
  810.    *    BAD144 info for disk bad blocking. A zero entry in
  811. --- 49,56 ----
  812.