*BSD News Article 56137


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.hawaii.edu!ames!usenet.kornet.nm.kr!news.kreonet.re.kr!europa.chnt.gtegsc.com!wlbr!sms
From: sms@wlv.iipo.gtegsc.com (Steven M. Schultz)
Subject: Standalone support for RX02 added (#282)
Sender: news@wlbr.iipo.gtegsc.com (System Administrator)
Organization: GTE Government Systems, Thousand Oaks CA USA
Message-ID: <DJ5HJG.Lsr@wlbr.iipo.gtegsc.com>
X-Nntp-Posting-Host: wlv.iipo.gtegsc.com
Date: Wed, 6 Dec 1995 05:50:03 GMT
Lines: 1043

Subject: Standalone support for RX02 added (#282)
Index:	pdpstand/rx.c,mdec/rx0{1,2}uboot.s 2.11BSD

Description:
	Support has been added to 'boot' and the rest of the standalone
	utilities for the RX02 (in both single and double density modes).

	Boot blocks have also been created for the RX02 (again in both
	single and double density).

Repeat-By:
	Try to boot from an RX02.

Fix:
	Many thanks go to Tim Shoppa (shoppa@krl.caltech.edu) for the
	latest addition to 2.11BSD - all I did was provide answers to a
	few questions on what a standalone driver and bootblock needs to 
	do.

	The shar archive which follows contains two files:

		1) A shar archive containing new files to be added to the
		   system.  The files which will be added are:

			/usr/src/sys/mdec/rx01uboot.s
			/usr/src/sys/mdec/rx02uboot.s
			/usr/src/sys/pdpstand/rx.c

		2) A patch file.  The following files are modified:

			/etc/disktab
			/VERSION
			/usr/src/sys/mdec/Makefile
			/usr/src/sys/pdpstand/conf.c
			/usr/src/sys/pdpstand/Makefile

	To install this update cut where indicated, saving to a file
	(/tmp/282) and then:

		cd /tmp
		sh 282
		sh 282.shar
		patch -p0 < 282.patch
		cd /sys/mdec
		make
		make install
		make clean
		cd /sys/pdpstand
		make clean
		make
		cp boot /boot

	At this point if you have any RX02 diskettes you wish to make 
	into 'boot media' you can do so by simply:

		newfs /dev/rrx0b
		dd if=/mdec/rx02uboot of=/dev/rrx0b count=1
		mount /dev/rx0b /mnt
		cp boot icheck restor mkfs disklabel /mnt
		umount /dev/rx0b

================================cut here===================
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	282.shar
#	282.patch
# This archive created: Tue Dec  5 21:00:18 1995
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f '282.shar'
then
	echo shar: "will not over-write existing file '282.shar'"
else
sed 's/^Y//' << \SHAR_EOF > '282.shar'
Y#! /bin/sh
Y# This is a shell archive, meaning:
Y# 1. Remove everything above the #! /bin/sh line.
Y# 2. Save the resulting text in a file.
Y# 3. Execute the file with /bin/sh (not csh) to create:
Y#	/usr/src/sys/mdec/rx01uboot.s
Y#	/usr/src/sys/mdec/rx02uboot.s
Y#	/usr/src/sys/pdpstand/rx.c
Y# This archive created: Tue Dec  5 20:54:50 1995
Yexport PATH; PATH=/bin:/usr/bin:$PATH
Yif test -f '/usr/src/sys/mdec/rx01uboot.s'
Ythen
Y	echo shar: "will not over-write existing file '/usr/src/sys/mdec/rx01uboot.s'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > '/usr/src/sys/mdec/rx01uboot.s'
YXMAJOR = 8			/ major # from bdevsw[]
YX
YX/ RX02 single-density bootstrap.
YX/
YX/ 1995/12/02 - Now we have a boot for RX02!
YX/	Based on the RK05 bootstrap.  Only 8 bytes
YX/	to spare, though.  Should prove useful for those
YX/	who have only RX02 boot ROM's and use a MSCP
YX/	or RP/RM type system disk.
YX/	 -Tim(shoppa@altair.krl.caltech.edu)
YX/
YX/ disk boot program to load and transfer
YX/ to a unix entry.
YX/ for use with 1 KB byte blocks, CLSIZE is 8.
YX/ NDIRIN is the number of direct inode addresses (currently 4)
YX/ assembled size must be <= 512; if > 494, the 16-byte a.out header
YX/ must be removed
YX
YX/ options: none.  all options of reading an alternate name or echoing to
YX/		  the keyboard had to be removed to make room for the 
YX/		  code which understands the new directory structure on disc
YX
YX/ constants:
YXBSIZE	= 1024.			/ logical block size
YXDENS	= 0.			/ 1 for double density, 0 for single density
YX				/ This is the only place you should have
YX				/ to change to switch this bootstrap for
YX				/ some other density.  
YXWC	= 64.*[1.+DENS]		/ word count per floppy sector
YXBC	= 2.*WC			/ byte count per floppy sector
YXBCSHFT	= 7.+DENS		/ shift to multiply by BC
YXCLSIZE	= BSIZE\/BC		/ physical floppy sectors per logical block
YXCLSHFT	= 3.-DENS		/ shift to multiply by CLSIZE
YXCLMASK	= CLSIZE-1.		/ mask for getting CLSHFT bits
YX
YXINOSIZ	= 64.			/ size of inode in bytes
YXNDIRIN	= 4.			/ number of direct inode addresses
YXADDROFF	= 12.			/ offset of first address in inode
YXINOPB	= BSIZE\/INOSIZ		/ inodes per logical block
YXINOFF	= 31.			/ inode offset = (INOPB * (SUPERB+1)) - 1
YXPBSHFT	= -4			/ shift to divide by inodes per block
YX
YX/  The boot options and device are placed in the last SZFLAGS bytes
YX/  at the end of core by the kernel for autobooting.
YXENDCORE=	160000		/ end of core, mem. management off
YXSZFLAGS=	6		/ size of boot flags
YXBOOTOPTS=	2		/ location of options, bytes below ENDCORE
YXBOOTDEV=	4
YXCHECKWORD=	6
YX
YX.. = ENDCORE-512.-SZFLAGS	/ save room for boot flags
YX
YX/ entry is made by jsr pc,*$0
YX/ so return can be rts pc
YX
YX/ establish sp, copy
YX/ program up to end of core.
YX
YX	nop			/ These two lines must be present or DEC
YX	br	start		/ boot ROMs will refuse to run boot block!
YXstart:
YX	mov	r0,unit
YX	mov	r1,csr
YX	mov	$..,sp
YX	mov	sp,r1
YX	clr	r0
YX1:
YX	mov	(r0)+,(r1)+
YX	cmp	r1,$end
YX	blo	1b
YX	jmp	*$2f
YX
YX/ On error, restart from here.
YXrestart:
YX	clr	r0
YX/ clear core to make things clean
YX2:
YX	clr	(r0)+
YX	cmp	r0,sp
YX	blo	2b
YX
YX	mov	$bootnm, r1
YX	mov	$2,r0			/ ROOTINO
YX	jsr	pc,iget
YX	clr	r2			/ offset
YXagain:
YX	jsr	pc,readdir
YX	beq	restart			/ error - restart
YX	mov	4(r0),r4		/ dp->d_namlen
YX	cmp	r4,$bootlen		/ if (bootlen == dp->d_namlen)
YX	bne	again			/    nope, go try next entry
YX	mov	r0,r3
YX	add	$6,r3			/ r3 = dp->d_name
YX	mov	r1,r5			/ r5 = filename
YX9:
YX	cmpb	(r3)+,(r5)+
YX	bne	again			/ no match - go read next entry
YX	sob	r4,9b
YX	mov	(r0),r0			/ r0 = dp->d_ino
YX	jsr	pc,iget			/ fetch boot's inode
YX	br	loadfile		/ 'boot'- go read it
YX
YX/ get the inode specified in r0
YXiget:
YX	add	$INOFF,r0
YX	mov	r0,r5
YX	ash	$PBSHFT,r0
YX	bic	$!7777,r0
YX	mov	r0,dno
YX	clr	r0
YX	jsr	pc,rblk
YX	bic	$!17,r5
YX	mov	$INOSIZ,r0
YX	mul	r0,r5
YX	add	$buf,r5
YX	mov	$inod,r4
YX1:
YX	movb	(r5)+,(r4)+
YX	sob	r0,1b
YX	rts	pc
YX
YXreaddir:
YX	bit	$BSIZE-1,r2
YX	bne	1f
YX	jsr	pc,rmblk		/ read mapped block (bno)
YX		br err			/ end of file branch
YX	clr	r2			/ start at beginning of buf
YX1:
YX	mov	$buf,r0
YX	add	r2,r0			/ dp = buf+offset
YX	add	buf+2(r2),r2		/ dp += dp->d_reclen
YX	tst	(r0)			/ dp->d_ino == 0?
YX	beq	readdir			/ yes - go look at next
YX	rts	pc			/ return with r0 = &dp->d_ino
YXerr:
YX	clr	r0			/ return with
YX	rts	pc			/ dp = NULL
YX
YXloadfile:
YX	clr	bno			/ start at block 0 of inode in 'inod'
YX/ read file into core until
YX/ a mapping error, (no disk address)
YX	clr	r1
YX1:
YX	jsr	pc,rmblk
YX		br 1f
YX	mov	$buf,r2
YX2:
YX	mov	(r2)+,(r1)+
YX	cmp	r2,$buf+BSIZE
YX	blo	2b
YX	br	1b
YX/ relocate core around
YX/ assembler header
YX1:
YX	clr	r0
YX	cmp	(r0),$407
YX	bne	2f
YX1:
YX	mov	20(r0),(r0)+
YX	cmp	r0,sp
YX	blo	1b
YX/ enter program and
YX/ restart if return
YX2:
YX	mov	ENDCORE-BOOTOPTS, r4
YX	mov	unit,r3
YX	ash	$3,r3			/ unit # in bits 3-5, partition # is 0
YX	bis	$[MAJOR\<8.+DENS],r3	/ Density bit is partition #.
YX	mov	ENDCORE-CHECKWORD, r2
YX	mov	csr,r1
YX	jsr	pc,*$0
YX	br	restart
YX
YX/ read a mapped block
YX/ offset in file is in bno.
YX/ skip if success, no skip if fail
YX/ the algorithm only handles a single
YX/ indirect block. that means that
YX/ files longer than NDIRIN+256 blocks (260kb) cannot
YX/ be loaded.
YXrmblk:
YX	add	$2,(sp)
YX	mov	bno,r0
YX	cmp	r0,$NDIRIN
YX	blt	1f
YX	mov	$NDIRIN,r0
YX1:
YX	ash	$2,r0
YX	mov	addr+2(r0),dno
YX	mov	addr(r0),r0
YX	bne	1f
YX	tst	dno
YX	beq	2f
YX1:
YX	jsr	pc,rblk
YX	mov	bno,r0
YX	inc	bno
YX	sub	$NDIRIN,r0
YX	blt	1f
YX	ash	$2,r0
YX	mov	buf+2(r0),dno
YX	mov	buf(r0),r0
YX	bne	rblk
YX	tst	dno
YX	bne	rblk
YX2:
YX	sub	$2,(sp)
YX1:
YX	rts	pc
YX
YXdmask	= DENS*0400
YXread	= dmask + 7  /density, read function, and go
YXempty	= dmask + 3  /density, empty function, and go
YX
YX/ rx02 single and double density read block routine.
YX/ low order address in dno.
YX
YXrblk:
YX	mov	r1,-(sp)
YX	mov	r2,-(sp)
YX	mov	r3,-(sp)
YX	mov	r4,-(sp)
YX	mov	r5,-(sp)	/we need a lot of registers for interleave
YX				/ calculations!  Can certainly be improved on!
YX	mov	dno,r5		/count up the CLSIZE physical sectors in here.
YX				/will use lowest CLSHFT bits to look for done
YX				/and to compute position in buffer
YX.if	CLSIZE-1
YX	ash	$CLSHFT,r5		/ multiply by CLSIZE
YX.endif
YX8:	mov	r5,r1
YX	clr	r0
YX	div	$26.,r0
YX	mov	r0,r4
YX	asl	r1
YX	cmp	$26.,r1
YX	bgt	1f
YX	inc	r1
YX1:	mov	r1,r3
YX	mov	r4,r1
YX	mul	$6,r1
YX	add	r3,r1
YX	clr	r0
YX	div	$26.,r0
YX	inc	r1  /physical sector
YX	inc	r4
YX	cmp	$77.,r4
YX	bgt	3f
YX	clr	r4
YX3:			/physical track now in r4
YX	mov	unit,r0
YX	ash	$4.,r0
YX	bis	$read,r0
YX	mov	csr,r3
YX	mov	r3,r2
YX	mov	r0,(r2)+	/now r3 is csr, r2 is db
YX1:	tstb	(r3)
YX	bpl	1b
YX	mov	r1,(r2)
YX1:	tstb	(r3)
YX	bpl	1b
YX	mov	r4,(r2)
YX1:	bit	(r3),$040
YX	beq 	1b
YX	mov	$empty,(r3)
YX1:	tstb	(r3)
YX	bpl	1b
YX	mov	$WC,(r2)
YX1:	tstb	(r3)
YX	bpl 	1b
YX	mov	r5,r0
YX	bic	$!CLMASK,r0	/lowest bits of r5 had the section of buffer
YX	ash	$BCSHFT,r0
YX	add	$buf,r0		
YX	mov	r0,(r2)
YX1:	bit	(r3),$040
YX	beq	1b
YX	inc	r5
YX	bit	r5,$CLMASK
YX	bne	8b
YX	mov	(sp)+,r5
YX	mov	(sp)+,r4
YX	mov	(sp)+,r3
YX	mov	(sp)+,r2
YX	mov	(sp)+,r1
YX	rts	pc
YX
YXbootnm:	<boot\0\0>
YXbootlen = 4			/ strlen(bootnm)
YXunit: 0
YXcsr: 0
YXend:
YX
YXinod = ..-512.-BSIZE		/ room for inod, buf, stack
YXaddr = inod+ADDROFF		/ first address in inod
YXbuf = inod+INOSIZ
YXbno = buf+BSIZE
YXdno = bno+2
YSHAR_EOF
Ychmod 640 '/usr/src/sys/mdec/rx01uboot.s'
Yfi
Yif test -f '/usr/src/sys/mdec/rx02uboot.s'
Ythen
Y	echo shar: "will not over-write existing file '/usr/src/sys/mdec/rx02uboot.s'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > '/usr/src/sys/mdec/rx02uboot.s'
YXMAJOR = 8			/ major # from bdevsw[]
YX
YX/ RX02 bootstrap.
YX/
YX/ 1995/12/02 - Now we have a boot for RX02!
YX/	Based on the RK05 bootstrap.  Only 8 bytes
YX/	to spare, though.  Should prove useful for those
YX/	who have only RX02 boot ROM's and use a MSCP
YX/	or RP/RM type system disk.
YX/	 -Tim(shoppa@altair.krl.caltech.edu)
YX/
YX/ disk boot program to load and transfer
YX/ to a unix entry.
YX/ for use with 1 KB byte blocks, CLSIZE is 4.
YX/ NDIRIN is the number of direct inode addresses (currently 4)
YX/ assembled size must be <= 512; if > 494, the 16-byte a.out header
YX/ must be removed
YX
YX/ options: none.  all options of reading an alternate name or echoing to
YX/		  the keyboard had to be removed to make room for the 
YX/		  code which understands the new directory structure on disc
YX
YX/ constants:
YXBSIZE	= 1024.			/ logical block size
YXDENS	= 1.			/ 1 for double density, 0 for single density
YX				/ This is the only place you should have
YX				/ to change to switch this bootstrap for
YX				/ some other density.  
YXWC	= 64.*[1.+DENS]		/ word count per floppy sector
YXBC	= 2.*WC			/ byte count per floppy sector
YXBCSHFT	= 7.+DENS		/ shift to multiply by BC
YXCLSIZE	= BSIZE\/BC		/ physical floppy sectors per logical block
YXCLSHFT	= 3.-DENS		/ shift to multiply by CLSIZE
YXCLMASK	= CLSIZE-1.		/ mask for getting CLSHFT bits
YX
YXINOSIZ	= 64.			/ size of inode in bytes
YXNDIRIN	= 4.			/ number of direct inode addresses
YXADDROFF	= 12.			/ offset of first address in inode
YXINOPB	= BSIZE\/INOSIZ		/ inodes per logical block
YXINOFF	= 31.			/ inode offset = (INOPB * (SUPERB+1)) - 1
YXPBSHFT	= -4			/ shift to divide by inodes per block
YX
YX/  The boot options and device are placed in the last SZFLAGS bytes
YX/  at the end of core by the kernel for autobooting.
YXENDCORE=	160000		/ end of core, mem. management off
YXSZFLAGS=	6		/ size of boot flags
YXBOOTOPTS=	2		/ location of options, bytes below ENDCORE
YXBOOTDEV=	4
YXCHECKWORD=	6
YX
YX.. = ENDCORE-512.-SZFLAGS	/ save room for boot flags
YX
YX/ entry is made by jsr pc,*$0
YX/ so return can be rts pc
YX
YX/ establish sp, copy
YX/ program up to end of core.
YX
YX	nop			/ These two lines must be present or DEC
YX	br	start		/ boot ROMs will refuse to run boot block!
YXstart:
YX	mov	r0,unit
YX	mov	r1,csr
YX	mov	$..,sp
YX	mov	sp,r1
YX	clr	r0
YX1:
YX	mov	(r0)+,(r1)+
YX	cmp	r1,$end
YX	blo	1b
YX	jmp	*$2f
YX
YX/ On error, restart from here.
YXrestart:
YX	clr	r0
YX/ clear core to make things clean
YX2:
YX	clr	(r0)+
YX	cmp	r0,sp
YX	blo	2b
YX
YX	mov	$bootnm, r1
YX	mov	$2,r0			/ ROOTINO
YX	jsr	pc,iget
YX	clr	r2			/ offset
YXagain:
YX	jsr	pc,readdir
YX	beq	restart			/ error - restart
YX	mov	4(r0),r4		/ dp->d_namlen
YX	cmp	r4,$bootlen		/ if (bootlen == dp->d_namlen)
YX	bne	again			/    nope, go try next entry
YX	mov	r0,r3
YX	add	$6,r3			/ r3 = dp->d_name
YX	mov	r1,r5			/ r5 = filename
YX9:
YX	cmpb	(r3)+,(r5)+
YX	bne	again			/ no match - go read next entry
YX	sob	r4,9b
YX	mov	(r0),r0			/ r0 = dp->d_ino
YX	jsr	pc,iget			/ fetch boot's inode
YX	br	loadfile		/ 'boot'- go read it
YX
YX/ get the inode specified in r0
YXiget:
YX	add	$INOFF,r0
YX	mov	r0,r5
YX	ash	$PBSHFT,r0
YX	bic	$!7777,r0
YX	mov	r0,dno
YX	clr	r0
YX	jsr	pc,rblk
YX	bic	$!17,r5
YX	mov	$INOSIZ,r0
YX	mul	r0,r5
YX	add	$buf,r5
YX	mov	$inod,r4
YX1:
YX	movb	(r5)+,(r4)+
YX	sob	r0,1b
YX	rts	pc
YX
YXreaddir:
YX	bit	$BSIZE-1,r2
YX	bne	1f
YX	jsr	pc,rmblk		/ read mapped block (bno)
YX		br err			/ end of file branch
YX	clr	r2			/ start at beginning of buf
YX1:
YX	mov	$buf,r0
YX	add	r2,r0			/ dp = buf+offset
YX	add	buf+2(r2),r2		/ dp += dp->d_reclen
YX	tst	(r0)			/ dp->d_ino == 0?
YX	beq	readdir			/ yes - go look at next
YX	rts	pc			/ return with r0 = &dp->d_ino
YXerr:
YX	clr	r0			/ return with
YX	rts	pc			/ dp = NULL
YX
YXloadfile:
YX	clr	bno			/ start at block 0 of inode in 'inod'
YX/ read file into core until
YX/ a mapping error, (no disk address)
YX	clr	r1
YX1:
YX	jsr	pc,rmblk
YX		br 1f
YX	mov	$buf,r2
YX2:
YX	mov	(r2)+,(r1)+
YX	cmp	r2,$buf+BSIZE
YX	blo	2b
YX	br	1b
YX/ relocate core around
YX/ assembler header
YX1:
YX	clr	r0
YX	cmp	(r0),$407
YX	bne	2f
YX1:
YX	mov	20(r0),(r0)+
YX	cmp	r0,sp
YX	blo	1b
YX/ enter program and
YX/ restart if return
YX2:
YX	mov	ENDCORE-BOOTOPTS, r4
YX	mov	unit,r3
YX	ash	$3,r3			/ unit # in bits 3-5, partition # is 0
YX	bis	$[MAJOR\<8.+DENS],r3	/ Density bit is partition #.
YX	mov	ENDCORE-CHECKWORD, r2
YX	mov	csr,r1
YX	jsr	pc,*$0
YX	br	restart
YX
YX/ read a mapped block
YX/ offset in file is in bno.
YX/ skip if success, no skip if fail
YX/ the algorithm only handles a single
YX/ indirect block. that means that
YX/ files longer than NDIRIN+256 blocks (260kb) cannot
YX/ be loaded.
YXrmblk:
YX	add	$2,(sp)
YX	mov	bno,r0
YX	cmp	r0,$NDIRIN
YX	blt	1f
YX	mov	$NDIRIN,r0
YX1:
YX	ash	$2,r0
YX	mov	addr+2(r0),dno
YX	mov	addr(r0),r0
YX	bne	1f
YX	tst	dno
YX	beq	2f
YX1:
YX	jsr	pc,rblk
YX	mov	bno,r0
YX	inc	bno
YX	sub	$NDIRIN,r0
YX	blt	1f
YX	ash	$2,r0
YX	mov	buf+2(r0),dno
YX	mov	buf(r0),r0
YX	bne	rblk
YX	tst	dno
YX	bne	rblk
YX2:
YX	sub	$2,(sp)
YX1:
YX	rts	pc
YX
YXdmask	= DENS*0400
YXread	= dmask + 7  /density, read function, and go
YXempty	= dmask + 3  /density, empty function, and go
YX
YX/ rx02 single and double density read block routine.
YX/ low order address in dno.
YX
YXrblk:
YX	mov	r1,-(sp)
YX	mov	r2,-(sp)
YX	mov	r3,-(sp)
YX	mov	r4,-(sp)
YX	mov	r5,-(sp)	/we need a lot of registers for interleave
YX				/ calculations!  Can certainly be improved on!
YX	mov	dno,r5		/count up the CLSIZE physical sectors in here.
YX				/will use lowest CLSHFT bits to look for done
YX				/and to compute position in buffer
YX.if	CLSIZE-1
YX	ash	$CLSHFT,r5		/ multiply by CLSIZE
YX.endif
YX8:	mov	r5,r1
YX	clr	r0
YX	div	$26.,r0
YX	mov	r0,r4
YX	asl	r1
YX	cmp	$26.,r1
YX	bgt	1f
YX	inc	r1
YX1:	mov	r1,r3
YX	mov	r4,r1
YX	mul	$6,r1
YX	add	r3,r1
YX	clr	r0
YX	div	$26.,r0
YX	inc	r1  /physical sector
YX	inc	r4
YX	cmp	$77.,r4
YX	bgt	3f
YX	clr	r4
YX3:			/physical track now in r4
YX	mov	unit,r0
YX	ash	$4.,r0
YX	bis	$read,r0
YX	mov	csr,r3
YX	mov	r3,r2
YX	mov	r0,(r2)+	/now r3 is csr, r2 is db
YX1:	tstb	(r3)
YX	bpl	1b
YX	mov	r1,(r2)
YX1:	tstb	(r3)
YX	bpl	1b
YX	mov	r4,(r2)
YX1:	bit	(r3),$040
YX	beq 	1b
YX	mov	$empty,(r3)
YX1:	tstb	(r3)
YX	bpl	1b
YX	mov	$WC,(r2)
YX1:	tstb	(r3)
YX	bpl 	1b
YX	mov	r5,r0
YX	bic	$!CLMASK,r0	/lowest bits of r5 had the section of buffer
YX	ash	$BCSHFT,r0
YX	add	$buf,r0		
YX	mov	r0,(r2)
YX1:	bit	(r3),$040
YX	beq	1b
YX	inc	r5
YX	bit	r5,$CLMASK
YX	bne	8b
YX	mov	(sp)+,r5
YX	mov	(sp)+,r4
YX	mov	(sp)+,r3
YX	mov	(sp)+,r2
YX	mov	(sp)+,r1
YX	rts	pc
YX
YXbootnm:	<boot\0\0>
YXbootlen = 4			/ strlen(bootnm)
YXunit: 0
YXcsr: 0
YXend:
YX
YXinod = ..-512.-BSIZE		/ room for inod, buf, stack
YXaddr = inod+ADDROFF		/ first address in inod
YXbuf = inod+INOSIZ
YXbno = buf+BSIZE
YXdno = bno+2
YSHAR_EOF
Ychmod 640 '/usr/src/sys/mdec/rx02uboot.s'
Yfi
Yif test -f '/usr/src/sys/pdpstand/rx.c'
Ythen
Y	echo shar: "will not over-write existing file '/usr/src/sys/pdpstand/rx.c'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > '/usr/src/sys/pdpstand/rx.c'
YX/*
YX * RX02 Standalone disk driver.
YX * 95/12/02, Tim Shoppa (shoppa@altair.krl.caltech.edu)
YX *
YX *	Layout of logical devices:
YX *
YX *	name	min dev		unit	density
YX *	----	-------		----	-------
YX *	rx0a	   0		  0	single
YX *	rx1a	   1		  1	single
YX *	rx0b	   2		  0	double
YX *	rx1b	   3		  1	double
YX *
YX *	the following defines use some fundamental
YX *	constants of the RX02.
YX */
YX
YX#define	NSPB	(4-2*(pn))		/* sectors per block */
YX#define	NRXBLKS	(1001-501*(pn))	/* blocks on device */
YX#define	NBPS	(128+128*(pn))	/* bytes per sector */
YX#define	DENSITY	((pn))	/* Density: 0 = single, 1 = double */
YX#define	UNIT	((dn))	/* Unit Number: 0 = left, 1 = right */
YX#define	RXGD	(RX_GO  | (DENSITY << 8))
YX
YX#define	rxwait()	while (((rxaddr->rxcs) & RX_XREQ) == 0)
YX#define rxdone()	while (((rxaddr->rxcs) & RX_DONE) == 0)
YX
YX#include "../h/param.h"
YX#include "../pdpuba/rxreg.h"
YX#include "saio.h"
YX
YX#define	NRX	2
YX
YX	struct	rxdevice *RXcsr[NRX+1]=
YX		{
YX		(struct rxdevice *)0177170,
YX		(struct	rxdevice *)0,
YX		(struct rxdevice *)-1
YX		};
YX
YXrxstrategy(io, func)
YX	register struct iob *io;
YX{
YX	register struct rxdevice *rxaddr;
YX	daddr_t bn;
YX	unsigned int sectno,sector,track,dn,pn,bae,lo16,lotemp,cc;
YX	unsigned int bc,bs,retry;
YX
YX	rxaddr = RXcsr[io->i_ctlr];
YX	bn = io->i_bn;
YX	dn = io->i_unit;
YX	pn = io->i_part;
YX	cc = io->i_cc;
YX	iomapadr(io->i_ma, &bae, &lo16);
YX	bc=0;
YX
YX	for (sectno=0; bc<cc; sectno++) {
YX		rxfactr((int)bn*NSPB+sectno,&sector,&track);
YX		if (func == READ) {
YX	    		retry=0;
YXrxretry:    		rxaddr->rxcs=RX_RSECT|RXGD|(UNIT<<4);
YX	    		rxwait();
YX	    		rxaddr->rxsa=sector;
YX	    		rxwait();
YX	    		rxaddr->rxta=track;
YX	    		rxdone();
YX	    		if (rxaddr->rxcs & RX_ERR) {
YX				if ((retry++) < 10) goto rxretry;
YX	        		goto rxerr;
YX	    		}
YX	  	}
YX	  	bs = ((cc-bc<NBPS) ? (cc-bc) : (NBPS));
YX	  	rxaddr->rxcs=((func==READ)?RX_EMPTY:RX_FILL)|RXGD|(bae<<12);
YX	  	rxwait();
YX	  	rxaddr->rxwc=bs/2;
YX	  	rxwait();
YX	  	rxaddr->rxba=lo16;
YX	  	rxdone();
YX	  	if (rxaddr->rxcs & RX_ERR) goto rxerr;
YX	  	if (func==WRITE) {
YX	  		rxaddr->rxcs=RX_WSECT|RXGD|(UNIT<<4);
YX	  		rxwait();
YX	  		rxaddr->rxsa=sector;
YX	  		rxwait();
YX	  		rxaddr->rxta=track;
YX	  		rxdone();
YX	  		if (rxaddr->rxcs & RX_ERR) goto rxerr;
YX	  	}
YX	lotemp=lo16;
YX	lo16=lo16+NBPS;
YX	if (lo16 < lotemp)
YX		bae=bae+1;
YX	bc=bc+bs;
YX	}
YX	return(io->i_cc);
YX
YXrxerr:	printf("rx error: rxcs %o rxes %o\n",rxaddr->rxcs,rxaddr->rxes);
YX	return(-1);
YX}
YX
YX	
YXrxopen(io)
YX	struct iob *io;
YX{
YX	return(genopen(NRX, io));
YX}
YX
YX/*
YX *	rxfactr -- calculates the physical sector and physical
YX *	track on the disk for a given logical sector.
YX *	call:
YX *		rxfactr(logical_sector,&p_sector,&p_track);
YX *	the logical sector number (0 - 2001) is converted
YX *	to a physical sector number (1 - 26) and a physical
YX *	track number (0 - 76).
YX *	the logical sectors specify physical sectors that
YX *	are interleaved with a factor of 2. thus the sectors
YX *	are read in the following order for increasing
YX *	logical sector numbers (1,3, ... 23,25,2,4, ... 24,26)
YX *	There is also a 6 sector slew between tracks.
YX *	Logical sectors start at track 1, sector 1; go to
YX *	track 76 and then to track 0.  Thus, for example, unix block number
YX *	498 starts at track 0, sector 25 and runs thru track 0, sector 2
YX *	(or 6 depending on density).
YX */
YXstatic
YXrxfactr(sectr, psectr, ptrck)
YX	register int sectr;
YX	int *psectr, *ptrck;
YX{
YX	register int p1, p2;
YX
YX	p1 = sectr / 26;
YX	p2 = sectr % 26;
YX	/* 2 to 1 interleave */
YX	p2 = (2 * p2 + (p2 >= 13 ?  1 : 0)) % 26;
YX	/* 6 sector per track slew */
YX	*psectr = 1 + (p2 + 6 * p1) % 26;
YX	if (++p1 >= 77)
YX		p1 = 0;
YX	*ptrck = p1;
YX}
YSHAR_EOF
Ychmod 644 '/usr/src/sys/pdpstand/rx.c'
Yfi
Yexit 0
Y#	End of shell archive
SHAR_EOF
fi
if test -f '282.patch'
then
	echo shar: "will not over-write existing file '282.patch'"
else
sed 's/^Y//' << \SHAR_EOF > '282.patch'
Y*** /etc/disktab.old	Fri Aug 18 23:13:27 1995
Y--- /etc/disktab	Tue Dec  5 20:25:33 1995
Y***************
Y*** 1,4 ****
Y! #	@(#)disktab	1.2 (2.11BSD) 1995/07/13
Y  #
Y  # Disk geometry and partition layout tables. 
Y  # Key:
Y--- 1,4 ----
Y! #	@(#)disktab	1.3 (2.11BSD) 1995/12/05
Y  #
Y  # Disk geometry and partition layout tables. 
Y  # Key:
Y***************
Y*** 601,610 ****
Y--- 601,612 ----
Y  
Y  rx01|RX01|DEC RX01:\
Y  	:ty=floppy:se#128:ns#13:nt#1:nc#77:\
Y+ 	:b0=/mdec/rx01uboot:\
Y  	:pa#500:ba#1024:fa#1024:\
Y  
Y  rx02|RX02|DEC RX02:\
Y  	:ty=floppy:se#256:ns#13:nt#1:nc#77:\
Y+ 	:b0=/mdec/rx02uboot:\
Y  	:pb#1001:bb#1024:fb#1024:
Y  
Y  #
Y*** /VERSION.old	Mon Nov 27 23:44:49 1995
Y--- /VERSION	Tue Dec  5 20:42:46 1995
Y***************
Y*** 1,4 ****
Y! Current Patch Level: 281
Y  
Y  2.11 BSD
Y  ============
Y--- 1,4 ----
Y! Current Patch Level: 282
Y  
Y  2.11 BSD
Y  ============
Y*** /usr/src/sys/mdec/Makefile.old	Fri Apr  8 23:57:18 1994
Y--- /usr/src/sys/mdec/Makefile	Tue Dec  5 20:38:50 1995
Y***************
Y*** 3,12 ****
Y  # All rights reserved.  The Berkeley software License Agreement
Y  # specifies the terms and conditions for redistribution.
Y  #
Y! #	@(#)Makefile	1.1 (2.11BSD GTE) 4/8/94
Y  #
Y  ALL=	bruboot dvhpuboot hkuboot hpuboot rauboot rkuboot rluboot \
Y! 	rm03uboot rm05uboot si51uboot si94uboot si95uboot
Y  
Y  all: ${ALL}
Y  
Y--- 3,13 ----
Y  # All rights reserved.  The Berkeley software License Agreement
Y  # specifies the terms and conditions for redistribution.
Y  #
Y! #	@(#)Makefile	1.2 (2.11BSD GTE) 1995/12/05
Y  #
Y  ALL=	bruboot dvhpuboot hkuboot hpuboot rauboot rkuboot rluboot \
Y! 	rm03uboot rm05uboot si51uboot si94uboot si95uboot rx02uboot \
Y! 	rx01uboot
Y  
Y  all: ${ALL}
Y  
Y***************
Y*** 30,35 ****
Y--- 31,38 ----
Y  si51uboot:	si51uboot.s
Y  si94uboot:	si94uboot.s
Y  si95uboot:	si95uboot.s
Y+ rx02uboot:	rx02uboot.s
Y+ rx01uboot:	rx01uboot.s
Y  
Y  clean:
Y  	rm -f x.s a.out b.out ${ALL}
Y*** /usr/src/sys/pdpstand/conf.c.old	Mon Jul 17 21:43:26 1995
Y--- /usr/src/sys/pdpstand/conf.c	Tue Dec  5 20:26:35 1995
Y***************
Y*** 3,9 ****
Y   * All rights reserved.  The Berkeley software License Agreement
Y   * specifies the terms and conditions for redistribution.
Y   *
Y!  *	@(#)conf.c	2.4 (2.11BSD) 1995/07/17
Y   */
Y  
Y  #include "../h/param.h"
Y--- 3,9 ----
Y   * All rights reserved.  The Berkeley software License Agreement
Y   * specifies the terms and conditions for redistribution.
Y   *
Y!  *	@(#)conf.c	2.5 (2.11BSD) 1995/12/05
Y   */
Y  
Y  #include "../h/param.h"
Y***************
Y*** 14,19 ****
Y--- 14,20 ----
Y  extern	int	xpstrategy(), xpopen(), xpclose(), xplabel();
Y  extern	int	brstrategy(), bropen();
Y  extern	int	rkstrategy(), rkopen();
Y+ extern  int	rxstrategy(), rxopen();
Y  extern	int	hkstrategy(), hkopen();
Y  extern	int	rlstrategy(), rlopen(), rllabel();
Y  extern	int	sistrategy(), siopen();
Y***************
Y*** 23,29 ****
Y  extern	int	tsstrategy(), tsopen(), tsclose(), tsseek();
Y  extern	int	tmscpstrategy(), tmscpopen(), tmscpclose(), tmscpseek();
Y  
Y! extern	caddr_t	*XPcsr[], *BRcsr[], *RKcsr[], *HKcsr[], *RLcsr[];
Y  extern	caddr_t	*SIcsr[], *RAcsr[], *TMcsr[], *HTcsr[], *TScsr[], *TMScsr[];
Y  
Y  /*
Y--- 24,30 ----
Y  extern	int	tsstrategy(), tsopen(), tsclose(), tsseek();
Y  extern	int	tmscpstrategy(), tmscpopen(), tmscpclose(), tmscpseek();
Y  
Y! extern	caddr_t	*XPcsr[], *BRcsr[], *RKcsr[], *HKcsr[], *RLcsr[], *RXcsr[];
Y  extern	caddr_t	*SIcsr[], *RAcsr[], *TMcsr[], *HTcsr[], *TScsr[], *TMScsr[];
Y  
Y  /*
Y***************
Y*** 48,54 ****
Y  	nullsys, nullsys,
Y  	"rl",	rlstrategy,	rlopen,		nullsys,	RLcsr, /* 7 */
Y  	rllabel, nullsys,
Y! 	"rx",	nullsys,	nullsys,	nullsys,	0,     /* 8 */
Y  	nullsys, nullsys,
Y  	"si",	sistrategy,	siopen,		nullsys,	SIcsr, /* 9 */
Y  	nullsys, nullsys,
Y--- 49,55 ----
Y  	nullsys, nullsys,
Y  	"rl",	rlstrategy,	rlopen,		nullsys,	RLcsr, /* 7 */
Y  	rllabel, nullsys,
Y! 	"rx",	rxstrategy,	rxopen,		nullsys,	RXcsr, /* 8 */
Y  	nullsys, nullsys,
Y  	"si",	sistrategy,	siopen,		nullsys,	SIcsr, /* 9 */
Y  	nullsys, nullsys,
Y*** /usr/src/sys/pdpstand/Makefile.old	Wed Jun  7 21:11:57 1995
Y--- /usr/src/sys/pdpstand/Makefile	Tue Dec  5 20:26:35 1995
Y***************
Y*** 17,22 ****
Y--- 17,23 ----
Y  #	to install /sys/pdpdist/dtab (or /etc/dtab.save) as ${ROOT}/etc/dtab 
Y  #	so that the GENERIC kernel can find the tape device.
Y  #
Y+ # 1995/12/05 - add RX02 driver.
Y  # 1995/06/05 - add disklabel program to Makefile.
Y  # 1995/06/01 - use split I/D for icheck and restor.
Y  # 1995/05/30 - Begin adding disklabel support.
Y***************
Y*** 41,47 ****
Y  BOOT=	M.o boot.o ubmapset.o
Y  DRIVERS=prf.o sys.o label.o \
Y  	ht.o tm.o ts.o tmscp.o \
Y! 	xp.o rk.o rl.o br.o hk.o si.o ra.o
Y  
Y  ALL=	mtboot boot disklabel mkfs restor icheck maketape toyset
Y  
Y--- 42,48 ----
Y  BOOT=	M.o boot.o ubmapset.o
Y  DRIVERS=prf.o sys.o label.o \
Y  	ht.o tm.o ts.o tmscp.o \
Y! 	xp.o rk.o rl.o rx.o br.o hk.o si.o ra.o
Y  
Y  ALL=	mtboot boot disklabel mkfs restor icheck maketape toyset
Y  
Y***************
Y*** 167,172 ****
Y--- 168,174 ----
Y  prf.o:		prf.c
Y  rk.o:		rk.c
Y  rl.o:		rl.c
Y+ rx.c:		rx.c
Y  br.o:		br.c
Y  srt0.o:		srt0.s
Y  srt0-i.o:	srt0.s
SHAR_EOF
fi
exit 0
#	End of shell archive