home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / 4BSD / Distributions / tips / SMS_plain43_recipe < prev   
Encoding:
Internet Message Format  |  1998-09-25  |  37.7 KB

  1. From: "Steven M. Schultz" <sms@moe.2bsd.com>
  2. Date: Tue, 22 Sep 1998 17:43:44 -0700 (PDT)
  3.  
  4. 4.3 CAN run on a uVax. But, in true chicken-and-egg fashion, you must
  5. have access to a working TK50 tape drive so that you may build a TK50
  6. boot tape for that medium.
  7.  
  8. Check out the README in the shar file. It is assumed that you have installed
  9. previous fixes in /sys/vax regarding uVaxen. But just in case you haven't,
  10. another article has been posted with those fixes.
  11.  
  12. Rick
  13.  
  14. #!/bin/sh
  15. #
  16. # This is a shell archive.  Remove anything before the above #! line,
  17. # then unpack it by saving it in a file and typing "sh file".  (Files
  18. # unpacked will be owned by you and have default permissions.)
  19. #
  20. # This archive contains:
  21. #    README
  22. #    mdec.Makefile.diff
  23. #    mdec.rdboot.s
  24. #    mdec.tmscpboot.s
  25. #    stand.Makefile.diff
  26. #    stand.autoconf.c.diff
  27. #    stand.conf.c.diff
  28. #    stand.srt0.c.diff
  29. #    stand.tmscp.c.diff
  30. #    stand.uda.c.diff
  31.  
  32. echo x - README
  33. cat > "README" << '//E*O*F README//'
  34. THE RECIPE
  35.  
  36. or, how to make a tk50 boot tape and/or boot a uVax.
  37.  
  38. These are really two separate problems. They are only related if all
  39. you have is a tk50 drive on your uVax.
  40.  
  41. These are not idiot-proof instructions, but I've tried to make them
  42. as complete as possible. All these instructions (and some of the
  43. code; see srt0.c) assume root on the uVax will be ra0.
  44.  
  45. YOU MUST ALREADY HAVE A WORKING VAX! These instructions are useless on
  46. a cold machine. You must have a 4.3 machine and a working uVax (probably
  47. Ultrix!) with a tk50 drive.
  48.  
  49. The enterprising person can also make a 9-track boot tape, if your
  50. uVax is so equipped. However, I've not examined what changes or values
  51. may be necessary for those standalone drivers, so I won't speculate.
  52. To the ambitious: autoconf.c probably contains the magic you need, and
  53. /sys/dist (and Installing and Operating 4.3bsd -- Appendix A) contains
  54. the programs and instructions on how to build a boot tape.
  55.  
  56. You will also require a spare, root-size partition on the working 4.3
  57. machine. This is primarily to build the miniroot.
  58.  
  59. I. Install the patches. Note that you MUST have installed the uVax
  60.     instruction emulation fix posted some time ago to the net. Because
  61.     it was posted some time ago, I've not included it as part of the
  62.     diffs. However, because it was posted some time ago :) I've posted
  63.     it again as a second shar file for those who didn't grab it the
  64.     first time.
  65.  
  66.     These diffs should be applied to copies of the source on the
  67.     working 4.3 machine. (Copies, in case you or "patch" make some
  68.     terrible error.)
  69.  
  70. II. The format of a TK50 boot tape.
  71.  
  72.     The basic format of the tape should be:
  73.  
  74.     tape 1:
  75.     file 1: tmscpboot, and tp file containing boot and copy
  76.     file 2: miniroot
  77.     file 3: dump of /
  78.     file 4: tar image of /usr
  79.     file 5: tar image of /sys
  80.     file 6: tar image of /usr/src
  81.     file 7: tar image of /usr/lib/vfont
  82.  
  83.     tape 2:
  84.     file 1: tar image of /usr/src/new
  85.     file 2: tar image of /usr/ingres
  86.  
  87.     Now mostly because tk50's take so darn long to write, I suggest the
  88.     following shorter tape:
  89.  
  90.     file 1: as before
  91.     file 2: as before
  92.     file 3: as before
  93.     file 4: as before
  94.     file 5: as before
  95.  
  96.     You can pull in the other stuff later if you want via tk50 or (more
  97.     likely) the network; this will be enough for you to come up multi-user.
  98.  
  99. III. Building the tape.
  100.     I assume below that /dev/rmt8 is the tk50 tape drive to which you
  101.     are writing, and nrmt8 is the non-rewind drive (also known as rmt12).
  102.     References to /sys/... here actually refer to your copy of the
  103.     sources, wherever you may have chosen for them to live.
  104.  
  105.     Persons familiar with building boot tapes may be able to shorten this
  106.     procedure by taking any file after #3 directly from the distribution
  107.     tape instead of doing what is listed here.  Since this shortcut can
  108.     be difficult to explain for all the various commands involved, it
  109.     is not gone into here. Shortcuts will be briefly mentioned in [].
  110.     Where possible, methods of moving things from one machine to another
  111.     via rsh are mentioned. This will require a /.rhosts to do this as root.
  112.     It's not the *only* method, just a suggested one.
  113.  
  114.     How to build file 1:
  115.  
  116.     cd mdec
  117.     make tmscpboot
  118.     cd /sys/stand
  119.     make tpboot tpcopy
  120.     mv tpboot boot; mv tpcopy copy
  121.     tp cmf tp.file boot copy
  122.     cat /sys/mdec/tmscpboot tp.file | dd of=/dev/nrmt8 bs=512 conv=sync
  123.         (or, remotely)
  124.     cat /sys/mdec/tmscpboot tp.file | rsh uVax dd of=/dev/nrmt8 bs=512 conv=sync
  125.  
  126.     How to build file 2:
  127.  
  128.     Here you will need that spare partition. I'll call it, rather
  129.     generically, /dev/rraXX here.
  130.  
  131.     You must remake the GENERIC kernel. Alter /sys/conf/GENERIC and add
  132.     the line
  133.  
  134.     cpu    "VAX630"
  135.     
  136.     Then make the directory /sys/GENERIC, if it doesn't exist, and
  137.  
  138.     cd /sys/conf
  139.     config GENERIC
  140.     cd ../GENERIC
  141.     make depend
  142.     make vmunix
  143.     
  144.     The last two will take some time, the last one taking longest.
  145.  
  146.     After this is finished, you will use that spare partition.
  147.     Now you must build the miniroot and add the new GENERIC kernel.
  148.     [You can also retrieve the miniroot from the original
  149.     distribution tape, move your new GENERIC kernel onto the
  150.     miniroot, and put the miniroot to the tk50 tape.]
  151.  
  152.     You will need to investigate /sys/dist/buildmini.
  153.     It is a simple shell script, but it will need to be tailored to
  154.     fit your setup. Change "miniroot" and "minitype" at the top to
  155.     reflect the disk you are using.
  156.  
  157.     mv /genvmunix /genvmunix.old
  158.     cp /sys/GENERIC/vmunix /genvmunix
  159.     /sys/dist/buildmini
  160.     mount /dev/raXX /mnt
  161.     cp /sys/GENERIC/vmunix /mnt/vmunix
  162.     ln /mnt/vmunix /mnt/genvmunix
  163.     umount /dev/raXX
  164.     dd if=/dev/rraXX of=/dev/nrmt8 bs=10k conv=sync
  165.         (or, remotely)
  166.     rsh uVax dd of=/dev/nrmt8 bs=10k conv=sync < /dev/rraXX
  167.  
  168.     How to make file 3:
  169.     
  170.     This is a simple dump.  Just make a dump of your own /.
  171.     [ Or, you may copy the one from the distribution tape. In
  172.       this case, be sure to copy the generic kernel to your
  173.       new root partition after "copy"ing in the Installation,
  174.       or your kernel won't know about uVaxen.]
  175.  
  176.     dump 0f /dev/nrmt8 /
  177.         (or, remotely)
  178.     rdump 0f uVax:/dev/nrmt8 /
  179.     
  180.     How to make file 4:
  181.     
  182.     You only want *some* directories from /usr. The following minimal
  183.     set is suggested. You can retrieve others later from the working
  184.     4.3 vax via the network (or more laborious tk50 tapes):
  185.  
  186.     cd /usr
  187.     tar cf /dev/nrmt8 adm bin include lib man mdec ucb
  188.     
  189.     [ or copy the one on the distribution. More directories there,
  190.       but certainly easier. ]
  191.  
  192.     How to make file 5:
  193.  
  194.     MAKE SURE YOU ARE USING YOUR CHANGED SET OF SYS SOURCES HERE!!
  195.  
  196.     cd /sys;
  197.     tar cf /dev/nrmt8 .
  198.  
  199. IV. Booting from tape.
  200.  
  201.     Once you have the TK50 tape built, you should be able to insert it on
  202.     your cold machine and issue the command "b mu0" in response to the >>>
  203.     prompt. It will take between 1 and 2 minutes to load and issue a '='
  204.     prompt. Then you proceed as directed in "Installing and Operating",
  205.     except when booting, use "genvmunix" rather than "vmunix" until
  206.     you have made a machine-specific kernel.
  207.  
  208. V. Booting from disk.
  209.     
  210.     Once you have a running Unix system, you will quickly tire of having
  211.     to boot from tape every time. It is easy to boot from disk (and thus
  212.     have autoboot work.)
  213.  
  214.     Rdboot.s is the key. You want your root disk to have rdboot in its
  215.     boot block (first sector) and bootra in the next 15 sectors. First,
  216.     recompile them.
  217.     
  218.     cd /sys/stand; make bootra
  219.     cd /sys/mdec; make rdboot
  220.     
  221.     Then install them on the root disk:
  222.  
  223.     cd /usr/mdec
  224.     installboot rdboot bootra /dev/ra0a
  225.     
  226.     You will also need a new /boot:
  227.  
  228.     cd /sys/stand; make boot
  229.     cp boot /boot
  230.     
  231.     Anytime you newfs your root partition, you will need to do this,
  232.     because newfs will, by default, copy rdboot and bootrd or raboot
  233.     and bootra. In fact, you may need to link bootra to bootrd to
  234.     keep newfs happy.
  235.  
  236. //E*O*F README//
  237.  
  238. echo x - mdec.Makefile.diff
  239. cat > "mdec.Makefile.diff" << '//E*O*F mdec.Makefile.diff//'
  240. *** /tmp/Makefile    Thu Dec 10 09:28:12 1987
  241. --- Makefile    Thu Dec 10 09:27:46 1987
  242. ***************
  243. *** 60,65 ****
  244. --- 60,79 ----
  245.     dd if=a.out of=b.out bs=32 skip=1
  246.     dd if=b.out of=tmboot conv=sync
  247.   
  248. + rdboot: rdboot.s
  249. +     as rdboot.s
  250. +     nm -u a.out
  251. +     strip a.out
  252. +     dd if=a.out of=b.out bs=32 skip=1
  253. +     dd if=b.out of=rdboot conv=sync
  254. + tmscpboot: tmscpboot.s
  255. +     as tmscpboot.s
  256. +     nm -u a.out
  257. +     strip a.out
  258. +     dd if=a.out of=b.out bs=32 skip=1
  259. +     dd if=b.out of=tmscpboot conv=sync
  260.   tsboot: tsboot.s
  261.     as tsboot.s
  262.     nm -u a.out
  263. //E*O*F mdec.Makefile.diff//
  264.  
  265. echo x - mdec.rdboot.s
  266. cat > "mdec.rdboot.s" << '//E*O*F mdec.rdboot.s//'
  267. /*
  268. ** This is a VMB boot block for microvax.  For more info, see
  269. ** the KA-630 User's manual.
  270. */
  271.  
  272. /*
  273. **          ---------------------------------------------------
  274. ** BB + 0: |      1     |      N     |      any value          |
  275. **          ---------------------------------------------------
  276. */
  277. xxx:    .long    0x001040000
  278. /*
  279. **          ---------------------------------------------------
  280. **      4: |        low  lbn         |      high lbn           |
  281. **          ---------------------------------------------------
  282. */
  283.     .long    0x000010000
  284. /*
  285. ** BB + 2*N
  286. **          ---------------------------------------------------
  287. **    + 0: | check byte |      K     |     0     |   18 (HEX)  |
  288. **          ---------------------------------------------------
  289. */
  290.     .long    0x0e7000018
  291. /*
  292. **          ---------------------------------------------------
  293. **    + 4: |     any  value          |  1 or 81  |      0      |
  294. **          ---------------------------------------------------
  295. */
  296.     .long    0x000008100
  297. /*
  298. **          ---------------------------------------------------
  299. **    + 8: |     size in blocks of the image                   |
  300. **          ---------------------------------------------------
  301. */
  302.     .long    0x00000000f
  303. /*
  304. **          ---------------------------------------------------
  305. **    +12: |     load offset from default load address         |
  306. **          ---------------------------------------------------
  307. */
  308.     .long    0x000000000
  309. /*
  310. **          ---------------------------------------------------
  311. **    +16: |     offset into image to start execution          |
  312. **          ---------------------------------------------------
  313. */
  314.     .long    0x000000002
  315. /*
  316. **          ---------------------------------------------------
  317. **    +20: |     sum of previous three longwords               |
  318. **          ---------------------------------------------------
  319. */
  320.     .long    0x000000011
  321. /*
  322. **
  323. ** BB +0:    These two bytes can have any value
  324. **
  325. ** BB+2:    This value is the word offset from the start of the
  326. **        bootblock to the identification area described below.
  327. **
  328. ** BB+3:    This byte must be one.
  329. **
  330. ** BB+4:    This longword contains the logical block number
  331. **        (word swapped) of the secondary image.
  332. **
  333. ** BB+(2*n)+0:    This byte defines the expected instruction set.
  334. **        18(hex) means VAX.
  335. **
  336. ** BB+(2*n)+1:    This byte defines the expected controller type, 0
  337. **        means unknown.
  338. **
  339. ** BB+(2*n)+2:    This byte defines the file structure on the volume,
  340. **        it may be any value.
  341. **
  342. ** BB+(2*n)+3:    This byte must be the ones complement of the sum of
  343. **        the previous three bytes.
  344. **
  345. ** BB+(2*n)+4:    This byte must be zero.
  346. **
  347. ** BB+(2*n)+5:    This byte must be 1 or 81 (hex).  This byte defines
  348. **        the version number of the format standard and the
  349. **        type of disk.  The version is one, the high bit is 0
  350. **        for single sided, 1 for double sided.
  351. **
  352. ** BB+(2*n)+6:    These two bytes may be any value, but generally they
  353. **        are zero.
  354. **
  355. ** BB+(2*n)+8:    This entry is a longword containing the size in
  356. **        blocks of the secondary bootstrap image.
  357. **
  358. ** BB+(2*n)+12:    This entry is a longword containing a load offset
  359. **        (usually zero) from the default load address of the
  360. **        secondary bootstrap.
  361. **
  362. ** BB+(2*n)+16:    This entry is a longword containing the byte offset
  363. **        into the secondary bootstrap where execution is to
  364. **        begin.
  365. **
  366. ** BB+(2*n)+20:    This entry is a longword containing the sum of the
  367. **        previous three longwords.
  368. */
  369. //E*O*F mdec.rdboot.s//
  370.  
  371. echo x - mdec.tmscpboot.s
  372. cat > "mdec.tmscpboot.s" << '//E*O*F mdec.tmscpboot.s//'
  373. #
  374. # TK50 tape boot block for distribution tapes
  375. # works on Q-bus tk50 drive on uVaxen
  376. #
  377. # reads a program from a tp directory on a tape and executes it
  378. # program must be stripped of the header and is loaded ``bits as is''
  379. # you can return to this loader via ``ret'' as you are called ``calls $0,ent''
  380. #
  381.     .set    RELOC,0x70000
  382. /*  tp directory definitions */
  383.     .set    FILSIZ,38    # tp direc offset for file size
  384.     .set    BNUM,44        # tp dir offset for start block no.
  385.     .set    ENTSIZ,64    # size of 1 TP dir entry, bytes
  386.     .set    PTHSIZ,32    # size of TP path name, bytes
  387.     .set    BLKSIZ,512    # tape block size, bytes
  388.     .set    NUMDIR,24    # no. of dir blocks on tape
  389.     .set    ENTBLK,8    # no. of dir entries per tape block
  390. /* processor registers and bits */
  391.     .set    RXCS,32
  392.     .set    RXDB,33
  393.     .set    TXCS,34
  394.     .set    TXDB,35
  395.     .set    RXCS_DONE,0x80
  396.     .set    TXCS_RDY,0x80
  397.     .set    TXCS_pr,7    /* bit position of TXCS ready bit */
  398.     .set    RXCS_pd,7    /* bit position of RXCS done bit */
  399. /* UBA registers */
  400.     .set    MAPSTART,0x20088000    # for a uVax, anyway
  401.     .set    UBAMEM,0x1ffc2000    # again, for a uVax
  402.     .set    MRV,0x80000000        # map register valid bit
  403. /* TMSCP UBA registers */
  404.     .set    TMSCP_CSR, 0774500    # CSR of tk50
  405.     .set    TMSCPip,0        # initialization and polling
  406.     .set    TMSCPsa,2        # status and address
  407. /* handy values for tmscp communication area */
  408.     .set    TMSCP_OWN,0x80000000
  409.     .set    TMSCP_ERR,0x8000
  410.     .set    TMSCP_STEP4,0x4000
  411.     .set    TMSCP_STEP3,0x2000
  412.     .set    TMSCP_STEP2,0x1000
  413.     .set    TMSCP_STEP1,0x800
  414.     .set    TMSCP_IE,0x80
  415.     .set    TMSCP_GO,1
  416. /* handy offsets into tmscp communication area (from tmscpca) */
  417.     .set    cmdint,4
  418.     .set    rspint,6
  419.     .set    rspdsc,8
  420.     .set    cmddsc,12
  421. /* handy offsets into mscp packets (from %rCMD or %rRSP) */
  422.     .set    msglen,0
  423.     .set    vcid,3
  424.     .set    unit,8
  425.     .set    op,12
  426.     .set    status,14
  427.     .set    modifier,14
  428.     .set    bytecnt,16
  429.     .set    cntflgs,18
  430.     .set    buffer,20
  431.     .set    tmkcnt,20
  432.     .set    lbn,32
  433.     .set    dscptr,40
  434. /* TMSCP commands and modifiers */
  435.     .set    M_OP_STCON,4
  436.     .set    M_OP_ONLIN,9
  437.     .set    M_OP_READ,33
  438.     .set    M_OP_REPOS,37
  439.     .set    M_MD_REWND,2
  440.     .set    M_MD_IMMED,0x80
  441.     .set    M_MD_CLSEX,0x200
  442.     .set    M_ST_MASK,0x1f
  443.     .set    M_ST_TAPEM,14
  444. /* miscellaneous */
  445.     .set    IUR, 0x37
  446.     .set    SID, 0x3e
  447.     .set    VAX_630,8
  448. /* local stack variables */
  449.     .set    tmscpca,-240-PTHSIZ-26    # struct tmscpca (see tmscpreg.h)
  450.     .set    rsp,-240-PTHSIZ-10    # tmscp response area
  451.     .set    cmd,-120-PTHSIZ-10    # tmscp command area
  452.     .set    name,-PTHSIZ-10        # operator-typed file name
  453.     .set    dirread,-10        # is the tape directory incore already?
  454.     .set    mtapa,-8        # cur tape addr (last blk we read)
  455.     .set    tapa,-4            # desired tape addr (inclusive)
  456. /* register usage */
  457.     .set    rCMD,r7
  458.     .set    rRSP,r8
  459.     .set    rUBADDR,r9
  460.     .set    rMAPREGS,r10
  461.     .set    rCSR,r11
  462. /* ===== */
  463.  
  464. /* initialization */
  465. init:
  466.     /*
  467.      * if on a uVax, we were loaded by VMB from tape. We also have
  468.      * only one unibus, at 0x1fffc2000 (see above). Elstwise, this
  469.      * boot program will almost certainly need help.
  470.      */
  471.     mfpr    $SID,r0
  472.     cmpzv    $24,$8,r0,$VAX_630
  473.     beql    1f
  474.     halt
  475.     /*
  476.      * We must have been loaded by VMB, and thus we are at a non-zero
  477.      * location.  sp will contain the base address of the area at which
  478.      * we were loaded. So we add sp to $end to get the true end-of-program
  479.      * address.
  480.      */
  481. 1:    movl    sp,r6        # r6 - beginning of program
  482.     movl    $RELOC,fp    # core loc to which to move this program
  483.     addl3    $-512,fp,sp    # set stack pointer; leave room for locals
  484.     addl3    $-512,fp,r0    # zero our destination mem .. we start here
  485.     addl3    $end,fp,r1    # and end here
  486. clr:
  487.     clrl    (r0)+
  488.     cmpl    r0,r1
  489.     jlss    clr
  490.  
  491.     movc3    $end,(r6),(fp)    # copy to relocated position
  492. #    movzbl    $'a,r0
  493. #    bsbw    putc
  494.     addl3    $reginit,$RELOC,r0
  495.     jmp    (r0)        # and go there
  496. reginit:
  497.     /* initialize our registers. Should need to do this only once */
  498. #    movzbl    $'b,r0
  499. #    bsbw    putc
  500.     addl3    $UBAMEM, $TMSCP_CSR, %rCSR    # set up CSR register
  501.     movl    $MAPSTART, %rMAPREGS    # locate map registers
  502.  
  503.     moval    tmscpca(fp), %rUBADDR    # set unibus address for comm area
  504.     extzv    $0,$9,%rUBADDR,%rUBADDR    # format: (MR# << 9) | (&comm & 0x1ff)
  505.     ashl    $-9,$RELOC-512,r0    # setting up map register for our stack
  506.     bisl3    $MRV,r0,(%rMAPREGS)    # mark our stack valid (MR #0)
  507.  
  508.     moval    cmd(fp),%rCMD        # location of cmd mscp packet
  509.     moval    rsp(fp),%rRSP        # location of rsp mscp packet
  510.     bsbw    inittmscp        # init the unit
  511.     bsbw    onlin            # set tape online
  512.     bsbw    rew            # rewind tape
  513.  
  514. start:
  515. #    movzbl    $11,r0            # newline
  516. #    bsbw    putc
  517. #    movzbl    $13,r0            # return
  518. #    bsbw    putc
  519.     movzbl    $'=,r0            # prompt
  520.     bsbw    putc            
  521.     bsbw    getname
  522.  
  523.     # desired TP filename is in name(fp).  Now read in entire tp directory
  524.     # contents into low core, starting at loc 0
  525.  
  526.     tstw    dirread(fp)    # if directory needs to be read in, do so
  527.     bneq    1f
  528.     bsbw    readdir
  529. 1:
  530.  
  531.     # all of directory is now in locore, @ 0.
  532.     # search for filename; return to start if it isn't there.
  533.  
  534.     clrl    r0            # start at location 0
  535. nxtdir:    moval    name(fp),r2
  536.     movl    r0,r1
  537. 1:    cmpb    (r1),(r2)
  538.     bneq    2f
  539.     tstb    (r1)
  540.     beql    found
  541.     incl    r1
  542.     incl    r2
  543.     brb    1b
  544. 2:    acbl    $NUMDIR*BLKSIZ-1,$ENTSIZ,r0,nxtdir
  545.     brw    start            # entry not in directory; start over
  546.  
  547.     # entry IS here; read it in from tape
  548.  
  549. found:    movzwl    BNUM(r0),tapa(fp)    # start block no., 2 bytes
  550.     addl2    $2-1,tapa(fp)        # skip over this program (2 blocks)
  551.                     # minus 1 because we will read THROUGH
  552.                     # this block; so we want to stop just
  553.                     # before it
  554.     movzwl    FILSIZ(r0),r4        # low 2 bytes file size
  555.     insv    FILSIZ-1(r0),$16,$8,r4  # file size, high byte
  556.     cmpl    r4,$RELOC-512        # check if file fits below stack
  557.     bgeq    start             # file too large
  558.  
  559.     # Now advance to proper place on tape. tapa has our
  560.     # desired address
  561.  
  562.     clrw    dirread(fp)    # we are about to obliterate our incore copy
  563.                 # of the directory
  564. 2:    clrl    r3    # rrec expects r3 to point to a buffer. 0 will do ...
  565.     bsbw    rrec
  566.     cmpl    mtapa(fp),tapa(fp)
  567.     blss    2b
  568.  
  569.     # tape now positioned correctly. Read in program. Number of bytes
  570.     # to read is in r4. We must round up to an even BLKSIZ boundary.
  571.     # Clear the area we are putting it at; unix expects zeroes in its
  572.     # data and bss section.
  573.  
  574.     addl2    $BLKSIZ-1,r4        # round up
  575.     bicl2    $BLKSIZ-1,r4        # mask out
  576.     movl    r4,r5            # use r5; need to save r4 for later
  577. 1:    clrl    (r5)
  578.     sobgtr    r5,1b
  579.  
  580.     # now read in file.
  581.  
  582.     clrl    r3            # read into page 0 (incremented by rrec)
  583.     ashl    $-9,r4,r5        # r5 now holds # blks to read
  584.     addl2    r5,tapa(fp)        # compute desired tape blk #
  585. 1:    bsbw    rrec
  586.     cmpl    mtapa(fp),tapa(fp)    # got it yet?
  587.     blss    1b
  588.  
  589.     # begin execution. Call as a function.
  590.     clrl    r5
  591.     calls    $0,(r5)
  592.  
  593.     # now, since the called function has reset the tape drive for
  594.     # us (!) we must reinit it again ourselves.
  595.  
  596.     ashl    $-9,$RELOC-512,r0    # set up map register for our stack
  597.     bisl3    $MRV,r0,(%rMAPREGS)    # mark our stack valid (MR #0)
  598.     bsbw    inittmscp        # re-init drive
  599.     bsbw    onlin            # re-online it
  600.     brw    start
  601.  
  602.     # getname will set name(fp) and leave len(name(fp)) in r6
  603. getname:moval    name(fp),r1        # mov to register for ease of access
  604. nxtc:    bsbw    getc
  605.     cmpb    r0,$012            # end of line?
  606.     beql    nullc
  607.     movb    r0,(r1)+
  608.     brb    nxtc
  609. nullc:    moval    name(fp),r0
  610.     subl3    r0,r1,r6        # length of path name
  611.     jeql    start            # just hit return; nothing useful here
  612.     clrb    (r1)+            # add null at end
  613.     incl    r6            # add null to length
  614.     rsb
  615.  
  616. getc:    mfpr    $RXCS,r0
  617.     bbc    $RXCS_pd,r0,getc    /* receiver ready ? */
  618.     mfpr    $RXDB,r0
  619.     extzv    $0,$7,r0,r0
  620.     cmpb    r0,$015
  621.     bneq    putc
  622.     bsbw    putc
  623.     movb    $0,r0
  624.     bsbw    putc
  625.     movb    $012,r0
  626.  
  627. putc:    mfpr    $TXCS,r2
  628.     bbc    $TXCS_pr,r2,putc    /* transmitter ready ? */
  629.     extzv    $0,$7,r0,r0
  630.     mtpr    r0,$TXDB
  631.     rsb
  632.  
  633. inittmscp:
  634.     movw    $0,TMSCPip(%rCSR)        # start step 1
  635. 1:    bitw    $TMSCP_STEP1,TMSCPsa(%rCSR)
  636.     beql    1b
  637. #    movzbl    $'1,r0
  638. #    bsbw    putc
  639. init2:    movw    $TMSCP_ERR,TMSCPsa(%rCSR)    # start step 2
  640. 2:    bitw    $TMSCP_STEP2,TMSCPsa(%rCSR)
  641.     beql    2b
  642. #    movzbl    $'2,r0
  643. #    bsbw    putc
  644. init3:    addl3    $8,%rUBADDR,r0            # start step 3
  645.     cvtlw    r0,TMSCPsa(%rCSR)
  646. 3:    bitw    $TMSCP_STEP3,TMSCPsa(%rCSR)
  647.     beql    3b
  648. #    movzbl    $'3,r0
  649. #    bsbw    putc
  650. init4:    addl3    $8,%rUBADDR,r0            # start step 4
  651.     ashl    $-16,r0,r0
  652.     cvtlw    r0,TMSCPsa(%rCSR)
  653. 4:    bitw    $TMSCP_STEP4,TMSCPsa(%rCSR)
  654.     beql    4b
  655. #    movzbl    $'4,r0
  656. #    bsbw    putc
  657. setchar:
  658.     movw    $TMSCP_GO,TMSCPsa(%rCSR)
  659.     moval    140(%rUBADDR),tmscpca+cmddsc(fp)
  660.     moval    tmscpca+cmddsc(fp),dscptr(%rCMD)
  661.     movb    $1,vcid(%rCMD)
  662.     moval    20(%rUBADDR),tmscpca+rspdsc(fp)
  663.     moval    tmscpca+rspdsc(fp),dscptr(%rRSP)
  664.     clrw    cntflgs(%rCMD)
  665.  
  666.     movb    $M_OP_STCON,op(%rCMD)
  667.     clrw    modifier(%rCMD)
  668.     clrl    buffer(%rCMD)
  669.     clrl    bytecnt(%rCMD)
  670.     bsbw    tmscpcmd    
  671. #    movzbl    $'S,r0
  672. #    bsbw    putc
  673.  
  674.     rsb
  675.  
  676. tmscpcmd:
  677.     movw    $116,msglen(%rCMD)        # 116 -- size of an mscp packet
  678.     bisl2    $TMSCP_OWN,tmscpca+cmddsc(fp)
  679.     movw    $116,msglen(%rRSP)
  680.     bisl2    $TMSCP_OWN,tmscpca+rspdsc(fp)
  681.     movw    TMSCPip(%rCSR),r0        # start polling
  682. wait:    cvtwl    TMSCPsa(%rCSR),r0
  683.     bitl    $TMSCP_ERR,r0
  684.     beql    1f
  685.     movw    modifier(%rRSP),r1    # so we can read status easily
  686.     halt                # some error or other
  687. 1:    tstl    tmscpca+4(fp)
  688.     beql    2f
  689.     clrw    tmscpca+4(fp)
  690. 2:    bitl    $TMSCP_OWN,tmscpca+rspdsc(fp)
  691.     bneq    wait
  692.  
  693.     # cmd done
  694.  
  695.     clrw    tmscpca+rspint(fp)
  696.     extzv    $0,$5,status(%rRSP),r0
  697.     tstl    r0
  698.     beql    ok            # no errors
  699.     cmpl    $M_ST_TAPEM, r0
  700.     beql    ok            # not an error, just a tape mark
  701.     halt                # some unknown error
  702. ok:    rsb
  703.  
  704. rew:    movb    $M_OP_REPOS,op(%rCMD)
  705.     movw    $M_MD_REWND|M_MD_IMMED,modifier(%rCMD)
  706.     clrl    buffer(%rCMD)
  707.     clrl    bytecnt(%rCMD)
  708.     bsbw    tmscpcmd
  709. #    movzbl    $'r,r0            # to indicate r)ewind
  710. #    bsbw    putc
  711.     movl    $-1,mtapa(fp)        # no blocks read yet
  712.     rsb
  713.     
  714. onlin:    movb    $M_OP_ONLIN,op(%rCMD)
  715.     clrw    modifier(%rCMD)
  716.     clrl    buffer(%rCMD)
  717.     clrl    bytecnt(%rCMD)
  718.     bsbw    tmscpcmd
  719. #    movzbl    $'O,r0            # to indicate O)nline
  720. #    bsbw    putc
  721.     rsb
  722.     
  723.     # Read the tp directory. Number of blocks to read is in tapa(fp),
  724.     # and will be read into memory starting at location 0.
  725. readdir:bsbw    rew            # beginning of tape
  726.     addl3    $2,$NUMDIR,tapa(fp)    # blocks to read (skip this 1k program)
  727.     clrl    r3            # using mem starting at 0 as free space
  728.     bsbw    rrec; bsbw rrec        # read and discard first two blocks --
  729.                     # those are this program
  730.     bsbw    rrec            # read and discard first tp block
  731.     clrl    r3            # reset starting place
  732.     incw    dirread(fp)        # show that directory is incore
  733. 1:    bsbw    rrec
  734.     cmpl    mtapa(fp),tapa(fp)    # done yet?
  735.     blss    1b
  736.     rsb
  737.  
  738.     # read 1 block from mag tape into page indicated by r3, which will
  739.     # automatically be incremented here. mtapa is also advanced.
  740.  
  741. rrec:    bisl3    $MRV,r3,4(%rMAPREGS)    # using map register #1
  742.     movl    $BLKSIZ,bytecnt(%rCMD)    # how much to read
  743.     ashl    $9,$1,buffer(%rCMD)    # indicating mr #1. We just happen to
  744.                     # be on a page boundary, so filling in
  745.                     # the low 9 bits is not necessary.
  746.     movb    $M_OP_READ,op(%rCMD)
  747.     clrw    modifier(%rCMD)
  748.     bsbw    tmscpcmd
  749. #    movzbl    $'R,r0            # to indicate R)ead a record
  750. #    bsbw    putc
  751.     incl    mtapa(fp)
  752.     incl    r3
  753.     rsb
  754. end:
  755. //E*O*F mdec.tmscpboot.s//
  756.  
  757. echo x - stand.Makefile.diff
  758. cat > "stand.Makefile.diff" << '//E*O*F stand.Makefile.diff//'
  759. *** /sys/stand/Makefile    Thu Jun  5 01:48:32 1986
  760. --- Makefile    Wed Dec  9 14:31:56 1987
  761. ***************
  762. *** 8,25 ****
  763.   DESTDIR=/
  764.   INCPATH=-I. -I../h
  765.   CFLAGS=    -O ${INCPATH} -DSTANDALONE ${COPTS} 
  766. ! COPTS=    -DVAX780 -DVAX750 -DVAX730 -DVAX8600
  767.   730OPTS=-O ${INCPATH} -DSTANDALONE -DVAX730
  768.   RELOC=    70000
  769.   
  770. ! SRCS=    sys.c conf.c prf.c machdep.c \
  771.     autoconf.c hp.c hpmaptype.c ht.c idc.c mba.c mt.c rk.c \
  772. !     rl.c tm.c ts.c up.c upmaptype.c uba.c uda.c ut.c \
  773.     drtest.c format.c up.old.c hp.old.c ../vax/dkbad.c
  774.   DUMMIES= bootxx.c confxx.c
  775.   DRIVERS=autoconf.o hp.o hpmaptype.o ht.o idc.o mba.o mt.o \
  776.     rk.o rl.o tm.o ts.o \
  777. !     up.o upmaptype.o uba.o uda.o ut.o
  778.   # These drivers don't have ecc correction and bad sector forwarding;
  779.   # they are placed in the file system boot area for 750's.  If your
  780.   # root has bad sectors you can try and squeeze the newer drivers in...
  781. --- 8,25 ----
  782.   DESTDIR=/
  783.   INCPATH=-I. -I../h
  784.   CFLAGS=    -O ${INCPATH} -DSTANDALONE ${COPTS} 
  785. ! COPTS=    -DVAX780 -DVAX750 -DVAX730 -DVAX8600 -DVAX630
  786.   730OPTS=-O ${INCPATH} -DSTANDALONE -DVAX730
  787.   RELOC=    70000
  788.   
  789. ! SRCS=    sys.c conf.c prf.c machdep.c strings.c \
  790.     autoconf.c hp.c hpmaptype.c ht.c idc.c mba.c mt.c rk.c \
  791. !     rl.c tm.c ts.c up.c upmaptype.c uba.c uda.c ut.c tmscp.c \
  792.     drtest.c format.c up.old.c hp.old.c ../vax/dkbad.c
  793.   DUMMIES= bootxx.c confxx.c
  794.   DRIVERS=autoconf.o hp.o hpmaptype.o ht.o idc.o mba.o mt.o \
  795.     rk.o rl.o tm.o ts.o \
  796. !     up.o upmaptype.o uba.o uda.o ut.o tmscp.o
  797.   # These drivers don't have ecc correction and bad sector forwarding;
  798.   # they are placed in the file system boot area for 750's.  If your
  799.   # root has bad sectors you can try and squeeze the newer drivers in...
  800. ***************
  801. *** 32,38 ****
  802.   
  803.   all: ${ALL}
  804.   
  805. ! ${LIBSA}: sys.o conf.o ${DRIVERS} prf.o machdep.o dkbad.o
  806.     ar crv ${LIBSA} $?
  807.     ranlib ${LIBSA}
  808.   
  809. --- 32,38 ----
  810.   
  811.   all: ${ALL}
  812.   
  813. ! ${LIBSA}: sys.o conf.o ${DRIVERS} prf.o machdep.o dkbad.o strings.o
  814.     ar crv ${LIBSA} $?
  815.     ranlib ${LIBSA}
  816.   
  817. //E*O*F stand.Makefile.diff//
  818.  
  819. echo x - stand.autoconf.c.diff
  820. cat > "stand.autoconf.c.diff" << '//E*O*F stand.autoconf.c.diff//'
  821. *** /usr/tmp/autoconf.c    Wed Dec  9 14:38:25 1987
  822. --- autoconf.c    Wed Dec  9 14:31:56 1987
  823. ***************
  824. *** 51,56 ****
  825. --- 51,70 ----
  826.   #undef    UTR
  827.   #undef    UMA
  828.   
  829. +     /*
  830. +      * The map registers start right at 20088000 on the
  831. +      * ka630, so we have to subtract out the 2k offset to make
  832. +      * the pointers work ...
  833. +      */
  834. + #define    UTR(i)    ((struct uba_regs *)((caddr_t) (NEX630+(i))-0x800))
  835. + #define    UMA    ((caddr_t)UMEM630)
  836. + struct    uba_regs *ubaddr630[] = { UTR(0) };
  837. + caddr_t    umaddr630[] = { UMA };
  838. + #undef    UTR
  839. + #undef    UMA
  840.   configure()
  841.   {
  842.     union cpusid cpusid;
  843. ***************
  844. *** 82,87 ****
  845. --- 96,107 ----
  846.         umaddr = umaddr730;
  847.         nmba = nuba = 0;
  848.         break;
  849. +     
  850. +     case VAX_630:
  851. +         ubaddr = ubaddr630;
  852. +         umaddr = umaddr630;
  853. +         nmba = nuba = 0;
  854. +         break;
  855.     }
  856.     /*
  857.      * Forward into the past...
  858. ***************
  859. *** 96,101 ****
  860. --- 116,128 ----
  861.             ubaddr[i]->uba_cr = UBACR_ADINIT;
  862.     if ((cpu != VAX_780) && (cpu != VAX_8600))
  863.         mtpr(IUR, 0);
  864. +     /* 
  865. +      * enable external access to local memory
  866. +      * - aka the interprocessor doorbell
  867. +      * cf Emulex QD01/D disk controller technical manual, p 6-9
  868. +      */
  869. +     if (cpu == VAX_630)
  870. +         *(ubamem(0,017777500)) = 0x20;
  871.     /* give unibus devices a chance to recover... */
  872.     if (nuba > 0)
  873.         DELAY(2000000);
  874. //E*O*F stand.autoconf.c.diff//
  875.  
  876. echo x - stand.conf.c.diff
  877. cat > "stand.conf.c.diff" << '//E*O*F stand.conf.c.diff//'
  878. *** /usr/tmp/conf.c    Wed Dec  9 14:38:26 1987
  879. --- conf.c    Wed Dec  9 14:31:57 1987
  880. ***************
  881. *** 94,99 ****
  882. --- 94,102 ----
  883.   int    idcstrategy(), idcopen(), idcioctl();
  884.   #endif
  885.   int    rlstrategy(), rlopen(), rlioctl();
  886. + #if defined(VAX630)
  887. + int    tmscpstrategy(), tmscpopen(), tmscpclose();
  888. + #endif
  889.   #ifndef BOOT
  890.   int    tmstrategy(), tmopen(), tmclose();
  891.   int    tsstrategy(), tsopen(), tsclose();
  892. ***************
  893. *** 117,122 ****
  894. --- 120,128 ----
  895.     { "rb",    idcstrategy,    idcopen,    nullsys,    idcioctl },
  896.   #endif
  897.     { "rl",    rlstrategy,    rlopen,        nullsys,    rlioctl },
  898. + #if defined(VAX630)
  899. +     { "tk",    tmscpstrategy,    tmscpopen,    tmscpclose,    nullioctl },
  900. + #endif
  901.   #ifndef BOOT
  902.     { "ts",    tsstrategy,    tsopen,        tsclose,    nullioctl },
  903.   #if defined(VAX780) || defined(VAX750) || defined(VAX8600)
  904. //E*O*F stand.conf.c.diff//
  905.  
  906. echo x - stand.srt0.c.diff
  907. cat > "stand.srt0.c.diff" << '//E*O*F stand.srt0.c.diff//'
  908. *** /tmp/,RCSt1a19865    Tue Mar 22 17:22:57 1988
  909. --- srt0.c    Tue Mar 22 17:12:22 1988
  910. ***************
  911. *** 3,9
  912.    * All rights reserved.  The Berkeley software License Agreement
  913.    * specifies the terms and conditions for redistribution.
  914.    *
  915. !  *    @(#)srt0.c    7.1 (Berkeley) 6/5/86
  916.    */
  917.   
  918.   #include "../vax/mtpr.h"
  919.  
  920. --- 3,9 -----
  921.    * All rights reserved.  The Berkeley software License Agreement
  922.    * specifies the terms and conditions for redistribution.
  923.    *
  924. !  *    @(#)srt0.c    7.3 (Berkeley) 4/2/87
  925.    */
  926.   
  927.   #include "../vax/mtpr.h"
  928. ***************
  929. *** 23,28
  930.     .globl    _configure
  931.     .globl    _cpu
  932.     .globl    _openfirst
  933.   
  934.     .set    HIGH,31        # mask for total disable
  935.   
  936.  
  937. --- 23,30 -----
  938.     .globl    _configure
  939.     .globl    _cpu
  940.     .globl    _openfirst
  941. +     .globl    _boothowto
  942. +     .globl    _bootdev
  943.   
  944.     .set    HIGH,31        # mask for total disable
  945.   
  946. ***************
  947. *** 27,33
  948.     .set    HIGH,31        # mask for total disable
  949.   
  950.   entry:    .globl    entry
  951. !     .word    0x0
  952.     mtpr    $HIGH,$IPL        # just in case
  953.   #ifdef REL
  954.     movl    $RELOC,sp
  955.  
  956. --- 29,35 -----
  957.     .set    HIGH,31        # mask for total disable
  958.   
  959.   entry:    .globl    entry
  960. !     nop; nop            # .word    0x0101
  961.     mtpr    $HIGH,$IPL        # just in case
  962.   
  963.   #ifdef REL
  964. ***************
  965. *** 29,34
  966.   entry:    .globl    entry
  967.     .word    0x0
  968.     mtpr    $HIGH,$IPL        # just in case
  969.   #ifdef REL
  970.     movl    $RELOC,sp
  971.   #else
  972.  
  973. --- 31,37 -----
  974.   entry:    .globl    entry
  975.     nop; nop            # .word    0x0101
  976.     mtpr    $HIGH,$IPL        # just in case
  977.   #ifdef REL
  978.     # we need to do special stuff on microvax II
  979.     mfpr    $SID,r0
  980. ***************
  981. *** 30,35
  982.     .word    0x0
  983.     mtpr    $HIGH,$IPL        # just in case
  984.   #ifdef REL
  985.     movl    $RELOC,sp
  986.   #else
  987.     movl    $RELOC-0x2400,sp
  988.  
  989. --- 33,65 -----
  990.     mtpr    $HIGH,$IPL        # just in case
  991.   
  992.   #ifdef REL
  993. +     # we need to do special stuff on microvax II
  994. +     mfpr    $SID,r0
  995. +     cmpzv    $24,$8,r0,$VAX_630
  996. +     bneq    1f
  997. +     /*
  998. +      * Were we booted by VMB?  If so, r11 is not boothowto,
  999. +      * but rather the address of the `Extended RPB' (see KA630
  1000. +      * User's Manual, pp 3-21).  These tests were devised by
  1001. +      * richl@tektronix, 11/10/87.
  1002. +      */
  1003. +     cmpl    (r11),r11        # if boothowto, r11 will be small
  1004. +     bneq    1f            # and these will not fault
  1005. +     cmpl    4(r11),$0
  1006. +     bneq    1f
  1007. +     cmpl    8(r11),$-1
  1008. +     bneq    1f
  1009. +     tstl    0xc(r11)
  1010. +     bneq    1f
  1011. +     /*
  1012. +      * Booted by VMB: get flags from extended rpb.
  1013. +      * We can only guess at the boot device (here ra(0,0)).
  1014. +      */
  1015. +     movl    0x30(r11),r11
  1016. +     movl    $9,r10            # device = ra(0,0)
  1017. + 1:
  1018.     movl    $RELOC,sp
  1019.   #else
  1020.     movl    $RELOC-0x2400,sp
  1021. ***************
  1022. *** 35,40
  1023.     movl    $RELOC-0x2400,sp
  1024.   #endif
  1025.   start:
  1026.     movl    aedata,r0
  1027.   clr:
  1028.     clrl    (r0)+
  1029.  
  1030. --- 65,74 -----
  1031.     movl    $RELOC-0x2400,sp
  1032.   #endif
  1033.   start:
  1034. + #ifndef REL
  1035. +     /*
  1036. +      * Clear bss segment
  1037. +      */
  1038.     movl    aedata,r0
  1039.   clr:
  1040.     clrl    (r0)+
  1041. ***************
  1042. *** 40,51
  1043.     clrl    (r0)+
  1044.     cmpl    r0,sp
  1045.     jlss    clr
  1046. ! #ifdef REL
  1047. !     movc3    aedata,*$0,(sp)
  1048. ! /*
  1049. !  * Reclear bss segment separately from text and data
  1050. !  * since movc3 can't move more than 64K bytes
  1051. !  */
  1052.   dclr:
  1053.     clrl    (r3)+
  1054.     cmpl    r3,$_end
  1055.  
  1056. --- 74,86 -----
  1057.     clrl    (r0)+
  1058.     cmpl    r0,sp
  1059.     jlss    clr
  1060. ! #else
  1061. !     /*
  1062. !      * `entry' below generates a pc-relative reference to the
  1063. !      * code, so this works no matter where we are now.
  1064. !      * Clear bss segment *after* moving text and data.
  1065. !      */
  1066. !     movc3    aedata,entry,(sp)
  1067.   dclr:
  1068.     clrl    (r3)+
  1069.     cmpl    r3,$_end
  1070. ***************
  1071. *** 58,63
  1072.     jmp    *abegin
  1073.   begin:
  1074.   #endif
  1075.     mtpr    $0,$SCBB
  1076.     calls    $0,_configure
  1077.     movl    $1,_openfirst
  1078.  
  1079. --- 93,101 -----
  1080.     jmp    *abegin
  1081.   begin:
  1082.   #endif
  1083. +     movl    r11,_boothowto
  1084. +     movl    r10,_bootdev
  1085. + again:
  1086.     mtpr    $0,$SCBB
  1087.     calls    $0,_configure
  1088.     movl    $1,_openfirst
  1089. ***************
  1090. *** 62,69
  1091.     calls    $0,_configure
  1092.     movl    $1,_openfirst
  1093.     calls    $0,_main
  1094. ! #ifndef TP
  1095. !     jmp    start
  1096.   #else
  1097.     ret
  1098.   #endif
  1099.  
  1100. --- 100,107 -----
  1101.     calls    $0,_configure
  1102.     movl    $1,_openfirst
  1103.     calls    $0,_main
  1104. ! #ifdef REL
  1105. !     jmp    again
  1106.   #else
  1107.     ret
  1108.   #endif
  1109. ***************
  1110. *** 75,80
  1111.   #else
  1112.   aedata:    .long    _edata
  1113.   #endif
  1114.   
  1115.   __rtt:
  1116.     .word    0x0
  1117.  
  1118. --- 113,121 -----
  1119.   #else
  1120.   aedata:    .long    _edata
  1121.   #endif
  1122. + _bootdev:    .long    0
  1123. + _boothowto:    .long    0
  1124. +     .text
  1125.   
  1126.   __rtt:
  1127.     .word    0x0
  1128. ***************
  1129. *** 84,89
  1130.     jmp    start
  1131.   #endif
  1132.   
  1133.     .globl    _badloc
  1134.   _badloc:
  1135.     .word    0
  1136.  
  1137. --- 125,131 -----
  1138.     jmp    start
  1139.   #endif
  1140.   
  1141. +     .globl    _badaddr
  1142.     .globl    _badloc
  1143.   _badloc:
  1144.   _badaddr:
  1145. ***************
  1146. *** 86,91
  1147.   
  1148.     .globl    _badloc
  1149.   _badloc:
  1150.     .word    0
  1151.     movl    $1,r0
  1152.     movl    4(ap),r3
  1153.  
  1154. --- 128,134 -----
  1155.     .globl    _badaddr
  1156.     .globl    _badloc
  1157.   _badloc:
  1158. + _badaddr:
  1159.     .word    0
  1160.     movl    $1,r0
  1161.     movl    4(ap),r3
  1162. ***************
  1163. *** 89,94
  1164.     .word    0
  1165.     movl    $1,r0
  1166.     movl    4(ap),r3
  1167.     movl    $4,r2
  1168.     movab    9f,(r2)
  1169.     tstl    (r3)
  1170.  
  1171. --- 132,138 -----
  1172.     .word    0
  1173.     movl    $1,r0
  1174.     movl    4(ap),r3
  1175. +     movl    8(ap),r4
  1176.     movl    $4,r2
  1177.     movab    9f,(r2)
  1178.     bbc    $0,r4,1f; tstb    (r3)
  1179. ***************
  1180. *** 91,97
  1181.     movl    4(ap),r3
  1182.     movl    $4,r2
  1183.     movab    9f,(r2)
  1184. !     tstl    (r3)
  1185.   1:    clrl    r0            # made it w/o machine checks
  1186.   2:    movl    $4,r2
  1187.     clrl    (r2)
  1188.  
  1189. --- 135,143 -----
  1190.     movl    8(ap),r4
  1191.     movl    $4,r2
  1192.     movab    9f,(r2)
  1193. !     bbc    $0,r4,1f; tstb    (r3)
  1194. ! 1:    bbc    $1,r4,1f; tstw    (r3)
  1195. ! 1:    bbc    $2,r4,1f; tstl    (r3)
  1196.   1:    clrl    r0            # made it w/o machine checks
  1197.   2:    movl    $4,r2
  1198.     clrl    (r2)
  1199. ***************
  1200. *** 104,109
  1201.     .word    5f-0b        # 2 is 750
  1202.     .word    5f-0b        # 3 is 730
  1203.     .word    6f-0b        # 4 is 8600
  1204.   5:
  1205.     mtpr    $0xf,$MCESR
  1206.     brb    1f
  1207.  
  1208. --- 150,159 -----
  1209.     .word    5f-0b        # 2 is 750
  1210.     .word    5f-0b        # 3 is 730
  1211.     .word    6f-0b        # 4 is 8600
  1212. +     .word    5f-0b        # 5 is 8200
  1213. +     .word    1f-0b        # 6 is 8800
  1214. +     .word    1f-0b        # 7 is 610
  1215. +     .word    5f-0b        # 8 is 630
  1216.   5:
  1217.     mtpr    $0xf,$MCESR
  1218.     brb    1f
  1219. ***************
  1220. *** 116,118
  1221.     addl2    (sp)+,sp        # discard mchchk trash
  1222.     movab    2b,(sp)
  1223.     rei
  1224.  
  1225. --- 166,206 -----
  1226.     addl2    (sp)+,sp        # discard mchchk trash
  1227.     movab    2b,(sp)
  1228.     rei
  1229. + /*
  1230. +  * Short assembly versions of strcmp, strcpy, and strlen
  1231. +  * that do not use special instructions.
  1232. +  */
  1233. +     .globl    _strcmp
  1234. + _strcmp:
  1235. +     .word    0
  1236. +     movq    4(ap),r0
  1237. + 0:    cmpb    (r0),(r1)+
  1238. +     bneq    1f
  1239. +     tstb    (r0)+
  1240. +     bneq    0b
  1241. +     clrl    r0
  1242. +     ret
  1243. + 1:    cvtbl    (r0),r0
  1244. +     cvtbl    -(r1),r1
  1245. +     subl2    r1,r0
  1246. +     ret
  1247. +     .globl    _strcpy
  1248. + _strcpy:
  1249. +     .word    0
  1250. +     movq    4(ap),r0
  1251. + 0:    movb    (r1)+,(r0)+
  1252. +     bneq    0b
  1253. +     movl    4(ap),r0
  1254. +     ret
  1255. +     .globl    _strlen
  1256. + _strlen:
  1257. +     .word    0
  1258. +     movl    4(ap),r0
  1259. + 0:    tstb    (r0)+
  1260. +     bneq    0b
  1261. +     decl    r0
  1262. +     subl2    4(ap),r0
  1263. +     ret
  1264. //E*O*F stand.srt0.c.diff//
  1265.  
  1266. echo x - stand.tmscp.c.diff
  1267. cat > "stand.tmscp.c.diff" << '//E*O*F stand.tmscp.c.diff//'
  1268. *** /usr/tmp/tmscp.c    Wed Dec  9 14:38:32 1987
  1269. --- tmscp.c    Wed Dec  9 14:31:58 1987
  1270. ***************
  1271. *** 46,53 ****
  1272.   #include "../machine/pte.h"
  1273.    
  1274.   #include "../h/param.h"
  1275. ! #include "../h/gnode.h"
  1276. ! #include "../h/devio.h"
  1277.    
  1278.   #include "savax.h"
  1279.    
  1280. --- 46,53 ----
  1281.   #include "../machine/pte.h"
  1282.    
  1283.   #include "../h/param.h"
  1284. ! #include "../h/inode.h"
  1285. ! #include "../h/fs.h"
  1286.    
  1287.   #include "savax.h"
  1288.    
  1289. ***************
  1290. *** 177,182 ****
  1291. --- 177,188 ----
  1292.         _stop("tms: bad offset");
  1293.     else if (io->i_boff > 0)
  1294.         /*
  1295. +          * rewind tape -- incidentally clears serious exception,
  1296. +          * if present
  1297. +          */
  1298. +         tmscprew(io);
  1299. +         /*
  1300.          * Skip forward the appropriate number of files on the tape.
  1301.          */
  1302.         {
  1303. ***************
  1304. *** 193,202 ****
  1305.   tmscpclose(io)
  1306.     register struct iob *io;
  1307.   {
  1308. !     tmscpcmd(M_OP_REPOS, M_MD_REWND);
  1309.   }
  1310.    
  1311. -  
  1312.   /*
  1313.    * Set up tmscp command packet.  Cause the controller to poll to pick up
  1314.    * the command.
  1315. --- 199,224 ----
  1316.   tmscpclose(io)
  1317.     register struct iob *io;
  1318.   {
  1319. !     tmscprew(io);
  1320.   }
  1321. + /*
  1322. +  * rewind the tape. Clear the serious exception that may have occured if we
  1323. +  * hit EOF previously.
  1324. +  */
  1325. + tmscprew(io)
  1326. +     register struct iob *io;
  1327. + {
  1328. +     tmscp.tmscp_cmd.mscp_unit = io->i_unit;
  1329. +     tmscp.tmscp_cmd.mscp_buffer = 0;
  1330. +     tmscp.tmscp_cmd.mscp_bytecnt = 0;
  1331. +     if (tmscpcmd(M_OP_REPOS, M_MD_REWND|M_MD_CLSEX) == 0) {
  1332. +         printf("tms: rewind failed\n");
  1333. +         return(1);
  1334. +         }
  1335. +     return(0);
  1336. + }
  1337.    
  1338.   /*
  1339.    * Set up tmscp command packet.  Cause the controller to poll to pick up
  1340.    * the command.
  1341. ***************
  1342. *** 281,291 ****
  1343.     ubafree(io, ubinfo);
  1344.     /*
  1345.      * Detect hitting tape mark so we do it gracefully and return a
  1346. !      * character count of 0 to signify end of copy.  Rewind the tape
  1347. !      * before returning.
  1348.      */
  1349. !     if ((mp->mscp_status & M_ST_MASK) == M_ST_TAPEM)
  1350.         return(0);
  1351.     return(io->i_cc);
  1352.   }
  1353.    
  1354. --- 303,315 ----
  1355.     ubafree(io, ubinfo);
  1356.     /*
  1357.      * Detect hitting tape mark so we do it gracefully and return a
  1358. !      * character count of 0 to signify end of copy. Clear the exception
  1359. !      * and rewind before returning.
  1360.      */
  1361. !     if ((mp->mscp_status & M_ST_MASK) == M_ST_TAPEM) {
  1362. !         tmscprew(io);
  1363.         return(0);
  1364. +         }
  1365.     return(io->i_cc);
  1366.   }
  1367.    
  1368. //E*O*F stand.tmscp.c.diff//
  1369.  
  1370. echo x - stand.uda.c.diff
  1371. cat > "stand.uda.c.diff" << '//E*O*F stand.uda.c.diff//'
  1372. *** /usr/tmp/uda.c    Wed Dec  9 14:38:34 1987
  1373. --- uda.c    Wed Dec  9 14:31:59 1987
  1374. ***************
  1375. *** 7,12 ****
  1376. --- 7,20 ----
  1377.    */
  1378.   
  1379.   /*
  1380. +  * decided NOT to put an RCS header into standalone code -- don't know how
  1381. +  * critical space may be ...
  1382. +  *
  1383. +  *  $Header: uda.c,v 1.1 87/03/27 16:26:37 richl Exp $
  1384. +  *
  1385. +  */
  1386. + /*
  1387.    * UDA50/RAxx disk device driver
  1388.    */
  1389.   #include "../machine/pte.h"
  1390. ***************
  1391. *** 48,62 ****
  1392.   int ra25_off[] = { 0, 15884, 0, -1, -1, -1, 25916, -1 };
  1393.   int ra60_off[] = { 0, 15884, 0, 49324, 131404, 49324, 242606, 49324 };
  1394.   int ra80_off[] = { 0, 15884, 0, -1, 49324, 49324, 49910, 131404 };
  1395. - #ifndef    UCBRA
  1396. - #ifdef RA_COMPAT
  1397. - int ra81_off[] = { 0, 16422, 0, 49324, 131404, 412490, 375564, 83538 };
  1398. - #else
  1399. - int ra81_off[] = { 0, 16422, 0, 375564, 391986, 699720, 375564, 83538 };
  1400. - #endif
  1401. - #else
  1402.   int ra81_off[] = { 0, 15884, 0, 242606, 258490, 565690, 242606, 49324 };
  1403. ! #endif
  1404.   
  1405.   struct mscp *udcmd();
  1406.   static int ratype[NRA];
  1407. --- 56,64 ----
  1408.   int ra25_off[] = { 0, 15884, 0, -1, -1, -1, 25916, -1 };
  1409.   int ra60_off[] = { 0, 15884, 0, 49324, 131404, 49324, 242606, 49324 };
  1410.   int ra80_off[] = { 0, 15884, 0, -1, 49324, 49324, 49910, 131404 };
  1411.   int ra81_off[] = { 0, 15884, 0, 242606, 258490, 565690, 242606, 49324 };
  1412. ! int rd52_off[] = { 0, 15884, 0, -1, -1, -1, 25650, -1 };
  1413. ! int rd53_off[] = { 0, 15884, 0, -1, 0, 33440, 49324, 15884 };
  1414.   
  1415.   struct mscp *udcmd();
  1416.   static int ratype[NRA];
  1417. ***************
  1418. *** 128,133 ****
  1419. --- 130,141 ----
  1420.         break;
  1421.     case    81:
  1422.         off = ra81_off[io->i_boff];
  1423. +         break;
  1424. +     case    52:
  1425. +         off = rd52_off[io->i_boff];
  1426. +         break;
  1427. +     case    53:
  1428. +         off = rd53_off[io->i_boff];
  1429.         break;
  1430.     default:
  1431.         printf("uda%d: don't support ra%d's\n", i, ratype[i]);
  1432. //E*O*F stand.uda.c.diff//
  1433.  
  1434. exit 0
  1435.