[36] in Athena Bugs

home help back first fref pref prev next nref lref last post

/lib/c2 breaks VAX i/o register access

daemon@ATHENA.MIT.EDU (Ralph R. Swick)
Mon Mar 14 15:22:19 1988

To: bugs@ATHENA.MIT.EDU
Cc: donn@cs.utah.edu (Donn Seeley)
Date: Mon, 14 Mar 88 15:19:33 EST
From: Ralph R. Swick <swick@ATHENA.MIT.EDU>
Machine:
	VAX

Version:
	4.3bsd

Synopsis:
	When c2 sees a boolean operation that only affects one byte, it
	believes it can substitute a bb{c,s}x instruction for the bi{c,s}{w,l}x
	instruction.  This is usually OK, but if the operand is a device
	register in i/o space, the VAX architecture requires the register
	to be accessed with it's natural length (ref VAX Architecture Handbook,
	1986 edition, page 3-13) or the results are unpredictable.

	The same is true for the sequence cvtwl/cvtlw which in the following
	example is compressed to a single move fetching the initial source
	operand as a longword.

	These optimizations are questionable anyway.  Though I don't profess
	to be an expert on the subject, I would propose that substituting
	branching instructions for non-branching ones would cause pipelined
	processor implementations to hiccup.

	There may be other cases of improper length accesses, but these are
	what I noticed.

	Attached is a shar containing some un-optimized assembly (input to c2),
	the resulting optimized assembly code and the diffs needed to
	actually make the result work.  This code is the result of compiling
	server/ddx/dec/qdss/libtl/tldma.c in the X11R2 distribution.  It
	may be interesting to note that the csr structure pointer was explicitly
	declared as a register variable, which apparently makes the Ultrix
	optimizer behave properly.

#! /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:
#	tldma.s
#	tldma.s.diffs
#	tldma.s.optimized
# This archive created: Mon Mar 14 15:14:34 1988
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'tldma.s'
then
	echo shar: "will not over-write existing file 'tldma.s'"
else
cat << \SHAR_EOF > 'tldma.s'
LL0:
	.data
	.align	2
_sccsid:
	.data	2
L12:
	.ascii	"@(#)tldma.c\11"
	.ascii	"1.4\11"
	.ascii	"8/11/87\0"
	.data
	.long	L12
	.data
_rcsid:
	.long	0x61654824
	.long	0x3a726564
	.long	0x646c7420
	.long	0x632e616d
	.long	0x3120762c
	.long	0x3820322e
	.long	0x33302f38
	.long	0x2039302f
	.long	0x303a3431
	.long	0x37333a37
	.long	0x69777320
	.long	0x4c206b63
	.long	0x656b636f
	.long	0x242064
	.comm	_dmafxns,12
	.data
	.align	1
	.globl	_sg_fifo_func
_sg_fifo_func:
	.long	0x0
	.comm	_DMArequest,4
	.comm	_DMAbuf,4
	.comm	_FIFOrequest,4
	.comm	_SG_Fifo,4
	.comm	_sg_fifo_type,2
	.comm	_fcc_cbcsr,4
	.comm	_dma_word,4
	.comm	_req_buf_max,4
	.comm	_dma_max,4
	.comm	_last_DMAtype,4
	.comm	_req_buf_size,4
	.comm	_total_buf_size,4
	.comm	_AdderPtr,4
	.text
	.align	1
	.globl	_Enable_dma
_Enable_dma:
	.word	L95
	jbr 	L97
L98:
	movl	_Dga,r11
	bicw2	$1792,(r11)
	tstl	_DMAheader
	jneq	L99
	pushl	$_DMAheader
	pushl	$-1073453302
	pushl	_fd_qdss
	calls	$3,_ioctl
	cmpl	r0,$-1
	jneq	L101
	.data	1
L103:
	.ascii	"ioctl() error. errno = %d\12\0"
	.text
	pushl	_errno
	pushl	$L103
	calls	$2,_printf
	pushl	$1
	calls	$1,_exit
L101:
L99:
	movl	_DMAheader,r0
	movl	$3,20(r0)
	movl	_DMAheader,r0
	clrl	28(r0)
	movl	_DMAheader,r1
	movl	28(r0),24(r1)
	movl	_DMAheader,r0
	movl	24(r1),16(r0)
	bisw2	$2,(r11)
	movl	_DMAheader,r0
	subl3	$68,8(r0),r0
	movl	r0,_total_buf_size
	divl3	$3,_total_buf_size,r0
	divl2	$2,r0
	movl	r0,_req_buf_size
	movl	_DMAheader,r0
	addl3	$36,12(r0),r0
	movl	r0,_DMAbuf
	clrl	-4(fp)
L107:
	cmpl	-4(fp),$3
	jgeq	L106
	movl	_DMAheader,r0
	mull3	$12,-4(fp),r1
	addl3	r1,12(r0),r0
	movl	_DMAbuf,4(r0)
	ashl	$1,_req_buf_size,r0
	addl2	r0,_DMAbuf
L105:
	incl	-4(fp)
	jbr 	L107
L106:
	clrl	_DMAbuf
	movl	_req_buf_size,_req_buf_max
	movl	_req_buf_max,r0
	movl	r0,_dma_word
	mnegl	$1,_last_DMAtype
	ret
	.set	L95,0x800
L97:
	subl2	$4,sp
	jbr 	L98
	.data
	.text
	.align	1
	.globl	_Enable_fifo
_Enable_fifo:
	.word	L109
	jbr 	L111
L112:
	movl	_fcc_cbcsr,r11
	movl	$1,_FIFOflag
	tstl	_FIFOheader
	jneq	L113
	pushl	$_FIFOheader
	pushl	$-1073453302
	pushl	_fd_qdss
	calls	$3,_ioctl
L113:
	clrl	(r11)
	clrl	12(r11)
	clrw	8(r11)
	movzwl	2(r11),r0
	bisl2	$64,r0
	ashl	$16,r0,r0
	bisl2	$512,r0
	bisl2	r0,(r11)
	movl	_FIFOheader,r0
	movl	$3,16(r0)
	movl	_FIFOheader,r0
	clrl	24(r0)
	movl	_FIFOheader,r1
	movl	24(r0),20(r1)
	movl	_FIFOheader,r0
	movl	20(r1),12(r0)
	movl	_FIFOheader,r0
	subl3	$72,4(r0),r0
	movl	r0,_total_buf_size
	cvtwl	$1002,_req_buf_size
	clrw	*_sg_next_fifo
	clrl	_DMAbuf
	movl	_req_buf_size,_req_buf_max
	movl	_req_buf_max,r0
	movl	r0,_dma_word
	mnegl	$1,_last_DMAtype
	ret
	.set	L109,0x800
L111:
	subl2	$4,sp
	jbr 	L112
	.data
	.text
	.align	1
	.globl	_Flush_dma
_Flush_dma:
	.word	L115
	jbr 	L117
L118:
	movl	_Dga,r10
	movl	_DMAheader,r9
	movl	_DMArequest,r7
	clrl	-12(fp)
	cvtwl	$17000,-8(fp)
	cmpl	4(ap),$1
	jeql	L99999
	tstl	_DMAbuf
	jeql	L119
L99999:
	cmpl	4(ap),$1
	jneq	L120
	tstl	_DMAbuf
	jneq	L121
	pushl	$1
	calls	$1,_Get_dma
	movl	_DMArequest,r7
	addl3	$6,_dma_word,r0
	movl	r0,_dma_max
	movl	_dma_max,r0
	cmpl	r0,_req_buf_max
	jleq	L123
	pushl	$0
	calls	$1,*_dmafxns+8
	pushl	$2
	calls	$1,*_dmafxns+4
	addl3	$6,_dma_word,r0
	movl	r0,_dma_max
L123:
	movl	_dma_word,r8
	movw	$32769,(r8)+
	cvtlw	$16,(r8)+
	movw	$32768,(r8)+
	movl	r8,_dma_word
	jbr 	L124
L121:
	bisw2	$1,2(r7)
	bicw2	$2,2(r7)
L124:
L120:
	cmpw	(r7),$1
	jneq	L125
	subl3	_DMAbuf,_dma_word,r0
	divl2	$2,r0
	ashl	$1,r0,r0
	movl	r0,8(r7)
L125:
	incl	28(r9)
	cmpl	28(r9),20(r9)
	jlss	L99998
	clrl	28(r9)
	movl	28(r9),r0
	jbr	L99997
L99998:
	clrl	r0
L99997:
	incl	16(r9)
	bitw	$4,4(r9)
	jneq	L126
	tstl	16(r9)
	jeql	L126
	cvtwl	(r7),r0
	cmpl	r0,_last_DMAtype
	jeql	L127
	movl	_AdderPtr,r0
	clrw	2(r0)
	bicw2	$2,*_Dga
	bicw2	$1792,*_Dga
L127:
	bisw2	$4,4(r9)
	bicw2	$2,(r10)
	bisw2	$128,(r10)
	cvtwl	(r7),r0
	jbr 	L129
L130:
	bisw2	$512,(r10)
	bicw2	$1280,(r10)
	movl	_AdderPtr,r0
	cvtlw	$8,2(r0)
	jbr 	L128
L131:
	bitw	$8,2(r7)
	jeql	L132
	bisw2	$1792,(r10)
	jbr 	L133
L132:
	bisw2	$1536,(r10)
	bicw2	$256,(r10)
L133:
	movl	_AdderPtr,r0
	cvtbw	$64,2(r0)
	jbr 	L128
L134:
	bitw	$8,2(r7)
	jeql	L135
	bicw2	$512,(r10)
	bisw2	$1280,(r10)
	jbr 	L136
L135:
	bisw2	$1024,(r10)
	bicw2	$768,(r10)
L136:
	movl	_AdderPtr,r0
	cvtlw	$32,2(r0)
	jbr 	L128
L129:
	cmpl	r0,$1
	jeql	L130
	cmpl	r0,$2
	jeql	L131
	cmpl	r0,$3
	jeql	L134
L128:
	cvtwl	(r7),_last_DMAtype
	bitw	$2,2(r7)
	jeql	L137
	bicw2	$16384,(r10)
	jbr 	L138
L137:
	bitw	$1,2(r7)
	jeql	L139
	bisw2	$16384,(r10)
L139:
L138:
	subl3	r9,_DMAbuf,r0
	addl2	(r9),r0
	movl	r0,-4(fp)
	cvtlw	-4(fp),2(r10)
	ashl	$-16,-4(fp),r0
	cvtlw	r0,4(r10)
	cvtlw	8(r7),6(r10)
	movzwl	8(r7),r0
	extzv	$16,$16,r0,r0
	cvtlw	r0,8(r10)
	bisw2	$2,(r10)
L126:
	cmpl	4(ap),$1
	jneq	L140
L141:
	movl	_DMAheader,r0
	bitw	$4,4(r0)
	jeql	L142
	ashl	_fd_qdss,$1,r0
	movl	r0,-16(fp)
	subl3	$12,fp,r0
	pushl	r0
	pushl	$0
	subl3	$16,fp,r0
	pushl	r0
	pushl	$0
	addl3	$1,_fd_qdss,r0
	pushl	r0
	calls	$5,_select
	jbr 	L141
L142:
L140:
L119:
	cmpl	4(ap),$1
	jneq	L144
L145:
	movl	_AdderPtr,r0
	movzwl	6(r0),r0
	bicl2	$-17,r0
	cmpl	r0,$16
	jeql	L146
	jbr 	L145
L146:
L144:
	clrl	_DMAbuf
	movl	_req_buf_size,_req_buf_max
	movl	_req_buf_max,r0
	movl	r0,_dma_word
	ret
	.set	L115,0xf80
L117:
	subl2	$16,sp
	jbr 	L118
	.data
	.text
	.align	1
	.globl	_Flush_fifo
_Flush_fifo:
	.word	L148
	jbr 	L150
L151:
	movl	_Dga,r10
	movl	_DMAheader,r9
	movl	_FIFOrequest,r6
	clrl	-12(fp)
	cvtwl	$17000,-8(fp)
	movl	_fcc_cbcsr,r7
	cmpl	4(ap),$1
	jeql	L99996
	tstl	_DMAbuf
	jeql	L152
L99996:
	cmpl	4(ap),$1
	jneq	L153
	tstl	_DMAbuf
	jneq	L154
L155:
	tstw	6(r7)
	jeql	L156
	jbr 	L155
L156:
	addl3	$6,_dma_word,r0
	movl	r0,_dma_max
	movl	_dma_max,r0
	cmpl	r0,_req_buf_max
	jleq	L157
	pushl	$0
	calls	$1,*_dmafxns+8
	pushl	$2
	calls	$1,*_dmafxns+4
	addl3	$6,_dma_word,r0
	movl	r0,_dma_max
L157:
	movl	_dma_word,r8
	movw	$32769,(r8)+
	cvtlw	$16,(r8)+
	movw	$32768,(r8)+
	movl	r8,_dma_word
L154:
L153:
	cmpw	_sg_fifo_type,$1
	jneq	L158
	subl3	_DMAbuf,_dma_word,r0
	divl2	$2,r0
	movl	_sg_next_fifo,r1
	movzwl	(r1),r2
	addl2	r0,r2
	cvtlw	r2,(r1)
L158:
	cmpw	*_sg_int_flag,$-1
	jneq	L159
	movzwl	_sg_fifo_type,r0
	cmpl	r0,_last_DMAtype
	jeql	L160
	movl	_AdderPtr,r0
	cvtlw	$8,2(r0)
L160:
	movzwl	(r7),r0
	bicl2	$-4,r0
	cvtlw	r0,-2(fp)
	movzwl	_sg_fifo_type,r0
	jbr 	L162
L163:
	movzwl	_sg_fifo_type,r0
	cmpl	r0,_last_DMAtype
	jeql	L164
	cmpl	_last_DMAtype,$-1
	jeql	L164
	movzwl	(r7),r0
	bicl2	$-57597,r0
	cvtlw	r0,(r7)
	movzwl	-2(fp),r0
	bisl2	$512,r0
	movzwl	(r7),r1
	bisl2	r0,r1
	cvtlw	r1,(r7)
	movl	_AdderPtr,r0
	cvtbw	$64,2(r0)
L164:
	cmpw	*_change_section,$1
	jneq	L165
	jbr 	L161
L165:
	movw	*_sg_next_fifo,12(r7)
	jbr 	L161
L166:
	movzwl	_sg_fifo_type,r0
	cmpl	r0,_last_DMAtype
	jeql	L167
L168:
	tstw	6(r7)
	jeql	L169
	jbr 	L168
L169:
	movzwl	(r7),r0
	bicl2	$-57597,r0
	cvtlw	r0,(r7)
L167:
	movl	_AdderPtr,r0
	cvtbw	$64,2(r0)
	bicw2	$64,2(r7)
	movw	*_sg_next_fifo,12(r7)
	clrw	8(r7)
	cvtwl	_sg_fifo_func,r0
	bisl2	$4194304,r0
	movzwl	-2(fp),r1
	bisl2	r1,r0
	movl	r0,(r7)
	clrw	_sg_fifo_func
	jbr 	L161
L170:
	movzwl	_sg_fifo_type,r0
	cmpl	r0,_last_DMAtype
	jeql	L171
L172:
	tstw	6(r7)
	jeql	L173
	jbr 	L172
L173:
	movzwl	(r7),r0
	bicl2	$-57597,r0
	cvtlw	r0,(r7)
L171:
	movl	_AdderPtr,r0
	cvtlw	$32,2(r0)
	bicw2	$64,2(r7)
	movw	*_sg_next_fifo,14(r7)
	clrw	*_sg_int_flag
	cvtwl	_sg_fifo_func,r0
	bisl2	$4194304,r0
	movzwl	-2(fp),r1
	bisl2	r1,r0
	movl	r0,(r7)
	clrw	_sg_fifo_func
	jbr 	L161
L162:
	cmpl	r0,$1
	jeql	L163
	cmpl	r0,$2
	jeql	L166
	cmpl	r0,$3
	jeql	L170
L161:
	movzwl	_sg_fifo_type,_last_DMAtype
L159:
	cmpl	4(ap),$1
	jneq	L174
L175:
	cmpw	*_sg_int_flag,$-1
	jeql	L176
	jbr 	L175
L176:
L177:
	tstw	6(r7)
	jneq	L99995
	cmpw	*_change_section,$1
	jneq	L178
L99995:
	jbr 	L177
L178:
L179:
	movl	_AdderPtr,r0
	movzwl	6(r0),r0
	bicl2	$-17,r0
	cmpl	r0,$16
	jeql	L180
	jbr 	L179
L180:
L174:
L152:
	clrl	_DMAbuf
	movl	_req_buf_size,_req_buf_max
	movl	_req_buf_max,r0
	movl	r0,_dma_word
	ret
	.set	L148,0xfc0
L150:
	subl2	$16,sp
	jbr 	L151
	.data
	.text
	.align	1
	.globl	_Get_dma
_Get_dma:
	.word	L181
	jbr 	L183
L184:
	movl	$1,-8(fp)
	clrl	-4(fp)
L185:
	movl	_DMAheader,r0
	movl	_DMAheader,r1
	cmpl	16(r0),20(r1)
	jlss	L186
	ashl	_fd_qdss,$1,r0
	movl	r0,-12(fp)
	subl3	$8,fp,r0
	pushl	r0
	pushl	$0
	subl3	$12,fp,r0
	pushl	r0
	pushl	$0
	addl3	$1,_fd_qdss,r0
	pushl	r0
	calls	$5,_select
	jbr 	L185
L186:
	movl	_DMAheader,r0
	movl	_DMAheader,r1
	mull3	$12,28(r1),r1
	addl3	r1,12(r0),r0
	movl	r0,_DMArequest
	cvtlw	$1,*_DMArequest
	movl	_DMArequest,r0
	bicw2	$256,2(r0)
	movl	_DMArequest,r0
	movw	4(ap),2(r0)
	movl	_DMArequest,r0
	movl	4(r0),_DMAbuf
	movl	_DMAbuf,r0
	movl	r0,_dma_word
	ashl	$1,_req_buf_size,r0
	addl2	_DMAbuf,r0
	movl	r0,_req_buf_max
	ret
	.set	L181,0x0
L183:
	subl2	$12,sp
	jbr 	L184
	.data
	.text
	.align	1
	.globl	_Get_fifo
_Get_fifo:
	.word	L188
	jbr 	L190
L191:
	movl	_fcc_cbcsr,r11
	movzwl	*_sg_next_fifo,r0
	extzv	$14,$18,r0,r0
	cvtlw	r0,-2(fp)
	movzwl	*_sg_next_fifo,r0
	addl2	_req_buf_size,r0
	extzv	$14,$18,r0,r0
	cvtlw	r0,-4(fp)
	cmpw	-2(fp),-4(fp)
	jneq	L99994
	cmpw	*_sg_next_fifo,$32767
	jlequ	L192
L99994:
L193:
	cmpw	*_change_section,$1
	jneq	L194
	jbr 	L193
L194:
	cmpw	-4(fp),$2
	jneq	L195
	clrw	*_sg_next_fifo
	jbr 	L196
L195:
	movzwl	-4(fp),r0
	ashl	$14,r0,r0
	cvtlw	r0,*_sg_next_fifo
L196:
	movzwl	(r11),r0
	incl	r0
	bicl2	$-65534,r0
	cvtlw	r0,(r11)
	cvtlw	$1,*_change_section
	clrw	8(r11)
	movzwl	(r11),r0
	bisl2	$4194304,r0
	movl	r0,(r11)
L192:
	cvtlw	$1,_sg_fifo_type
	movzwl	*_sg_next_fifo,r0
	bicl2	$-16384,r0
	ashl	$1,r0,r0
	addl2	_SG_Fifo,r0
	movl	r0,_DMAbuf
	movl	_DMAbuf,r0
	movl	r0,_dma_word
	ashl	$1,_req_buf_size,r0
	addl2	_DMAbuf,r0
	movl	r0,_req_buf_max
	ret
	.set	L188,0x800
L190:
	subl2	$16,sp
	jbr 	L191
	.data
SHAR_EOF
fi
if test -f 'tldma.s.diffs'
then
	echo shar: "will not over-write existing file 'tldma.s.diffs'"
else
cat << \SHAR_EOF > 'tldma.s.diffs'
197c197
< jbss	$7,(r10),L2000008
---
> bisw2	$128,(r10)
206c206
< L2000010:jbcc	$14,(r10),L138
---
> L2000010:bicw2 $16384,(r10)
208c208
< L130:jbss	$9,(r10),L2000007
---
> L130:bisw2 $512,(r10)
217c217
< jbcc	$8,(r10),L133
---
> bicw2 $256,(r10)
222c222
< jbcc	$9,(r10),L2000006
---
> bicw2 $512,(r10)
225c225,226
< L135:jbss	$10,(r10),L2000005
---
> L135:
> bisw2 $1024,(r10)
232c233
< jbss	$14,(r10),L138
---
> bisw2 $16384,(r10)
238c239,240
< cvtlw	8(r7),6(r10)
---
> movzwl 8(r7),r0
> cvtlw	r0,6(r10)
357c359
< jbcc	$6,2(r7),L2000016
---
> bicw2   $64,2(r7)
373c375
< jbcc	$6,2(r7),L2000014
---
> bicw2   $64,2(r7)
426c428
< jbcc	$8,2(r0),L2000022
---
> bicw2   $256,2(r0)
SHAR_EOF
fi
if test -f 'tldma.s.optimized'
then
	echo shar: "will not over-write existing file 'tldma.s.optimized'"
else
cat << \SHAR_EOF > 'tldma.s.optimized'
.data
.align	2
_sccsid:.data	2
L12:.ascii	"@(#)tldma.c\11"
.ascii	"1.4\11"
.ascii	"8/11/87\0"
.data
.long	L12
.data
_rcsid:.long	0x61654824
.long	0x3a726564
.long	0x646c7420
.long	0x632e616d
.long	0x3120762c
.long	0x3820322e
.long	0x33302f38
.long	0x2039302f
.long	0x303a3431
.long	0x37333a37
.long	0x69777320
.long	0x4c206b63
.long	0x656b636f
.long	0x242064
.comm	_dmafxns,12
.data
.align	1
.globl	_sg_fifo_func
_sg_fifo_func:.long	0x0
.comm	_DMArequest,4
.comm	_DMAbuf,4
.comm	_FIFOrequest,4
.comm	_SG_Fifo,4
.comm	_sg_fifo_type,2
.comm	_fcc_cbcsr,4
.comm	_dma_word,4
.comm	_req_buf_max,4
.comm	_dma_max,4
.comm	_last_DMAtype,4
.comm	_req_buf_size,4
.comm	_total_buf_size,4
.comm	_AdderPtr,4
.text
LL0:.align	1
.globl	_Enable_dma
.data	1
L103:.ascii	"ioctl() error. errno = %d\12\0"
.text
.set	L95,0x800
.data
.text
_Enable_dma:.word	L95
subl2	$4,sp
movl	_Dga,r11
bicw2	$1792,(r11)
tstl	_DMAheader
jneq	L99
pushal	_DMAheader
pushl	$-1073453302
pushl	_fd_qdss
calls	$3,_ioctl
incl	r0
jneq	L99
pushl	_errno
pushal	L103
calls	$2,_printf
pushl	$1
calls	$1,_exit
L99:movl	_DMAheader,r0
movl	$3,20(r0)
movl	_DMAheader,r0
clrl	28(r0)
movl	_DMAheader,r1
movl	28(r0),24(r1)
movl	_DMAheader,r0
movl	24(r1),16(r0)
bisw2	$2,(r11)
movl	_DMAheader,r0
subl3	$68,8(r0),_total_buf_size
divl3	$3,_total_buf_size,r0
divl3	$2,r0,_req_buf_size
movl	_DMAheader,r0
addl3	$36,12(r0),_DMAbuf
clrl	-4(fp)
L2000001:movl	_DMAheader,r0
mull3	$12,-4(fp),r1
addl3	r1,12(r0),r0
movl	_DMAbuf,4(r0)
ashl	$1,_req_buf_size,r0
addl2	r0,_DMAbuf
aoblss	$3,-4(fp),L2000001
clrl	_DMAbuf
movl	_req_buf_size,_req_buf_max
movl	_req_buf_max,r0
movl	r0,_dma_word
mnegl	$1,_last_DMAtype
ret
.align	1
.globl	_Enable_fifo
.set	L109,0x800
.data
.text
_Enable_fifo:.word	L109
subl2	$4,sp
movl	_fcc_cbcsr,r11
movl	$1,_FIFOflag
tstl	_FIFOheader
jneq	L113
pushal	_FIFOheader
pushl	$-1073453302
pushl	_fd_qdss
calls	$3,_ioctl
L113:clrl	(r11)
clrl	12(r11)
clrw	8(r11)
movzwl	2(r11),r0
jbss	$6,r0,L2000003
L2000003:ashl	$16,r0,r0
jbss	$9,r0,L2000002
L2000002:bisl2	r0,(r11)
movl	_FIFOheader,r0
movl	$3,16(r0)
movl	_FIFOheader,r0
clrl	24(r0)
movl	_FIFOheader,r1
movl	24(r0),20(r1)
movl	_FIFOheader,r0
movl	20(r1),12(r0)
movl	_FIFOheader,r0
subl3	$72,4(r0),_total_buf_size
cvtwl	$1002,_req_buf_size
clrw	*_sg_next_fifo
clrl	_DMAbuf
movl	_req_buf_size,_req_buf_max
movl	_req_buf_max,r0
movl	r0,_dma_word
mnegl	$1,_last_DMAtype
ret
.align	1
.globl	_Flush_dma
.set	L115,0xf80
.data
.text
_Flush_dma:.word	L115
subl2	$16,sp
movl	_Dga,r10
movl	_DMAheader,r9
movl	_DMArequest,r7
clrl	-12(fp)
cvtwl	$17000,-8(fp)
cmpl	4(ap),$1
jeql	L99999
tstl	_DMAbuf
jeql	L119
L99999:cmpl	4(ap),$1
jneq	L120
tstl	_DMAbuf
jneq	L121
pushl	$1
calls	$1,_Get_dma
movl	_DMArequest,r7
addl3	$6,_dma_word,_dma_max
cmpl	_dma_max,_req_buf_max
jleq	L123
pushl	$0
calls	$1,*_dmafxns+8
pushl	$2
calls	$1,*_dmafxns+4
addl3	$6,_dma_word,_dma_max
L123:movl	_dma_word,r8
movw	$32769,(r8)+
cvtlw	$16,(r8)+
movw	$32768,(r8)+
movl	r8,_dma_word
jbr	L120
L121:bisw2	$1,2(r7)
bicw2	$2,2(r7)
L120:cmpw	(r7),$1
jneq	L125
subl3	_DMAbuf,_dma_word,r0
divl2	$2,r0
addl3	r0,r0,8(r7)
L125:aoblss	20(r9),28(r9),L99997
clrl	28(r9)
L99997:incl	16(r9)
jbs	$2,4(r9),L126
tstl	16(r9)
jeql	L126
cvtwl	(r7),r0
cmpl	r0,_last_DMAtype
jeql	L127
movl	_AdderPtr,r0
clrw	2(r0)
bicw2	$2,*_Dga
bicw2	$1792,*_Dga
L127:bisw2	$4,4(r9)
bicw2	$2,(r10)
jbss	$7,(r10),L2000008
L2000008:cvtwl	(r7),r0
cmpl	r0,$1
jeql	L130
cmpl	r0,$2
jeql	L131
cmpl	r0,$3
jeql	L134
jbr	L128
L2000010:jbcc	$14,(r10),L138
jbr	L138
L130:jbss	$9,(r10),L2000007
L2000007:bicw2	$1280,(r10)
movl	_AdderPtr,r0
cvtlw	$8,2(r0)
jbr	L128
L131:jbc	$3,2(r7),L132
bisw2	$1792,(r10)
jbr	L133
L132:bisw2	$1536,(r10)
jbcc	$8,(r10),L133
L133:movl	_AdderPtr,r0
cvtbw	$64,2(r0)
jbr	L128
L134:jbc	$3,2(r7),L135
jbcc	$9,(r10),L2000006
L2000006:bisw2	$1280,(r10)
jbr	L136
L135:jbss	$10,(r10),L2000005
L2000005:bicw2	$768,(r10)
L136:movl	_AdderPtr,r0
cvtlw	$32,2(r0)
L128:cvtwl	(r7),_last_DMAtype
jbs	$1,2(r7),L2000010
jlbc	2(r7),L138
jbss	$14,(r10),L138
L138:subl3	r9,_DMAbuf,r0
addl3	(r9),r0,-4(fp)
cvtlw	-4(fp),2(r10)
ashl	$-16,-4(fp),r0
cvtlw	r0,4(r10)
cvtlw	8(r7),6(r10)
movzwl	8(r7),r0
extzv	$16,$16,r0,r0
cvtlw	r0,8(r10)
bisw2	$2,(r10)
L126:cmpl	4(ap),$1
jeql	L141
jbr	L119
L2000012:ashl	_fd_qdss,$1,-16(fp)
pushal	-12(fp)
pushl	$0
pushal	-16(fp)
pushl	$0
addl3	$1,_fd_qdss,-(sp)
calls	$5,_select
L141:movl	_DMAheader,r0
jbs	$2,4(r0),L2000012
L119:cmpl	4(ap),$1
jneq	L144
L145:movl	_AdderPtr,r0
movzwl	6(r0),r0
bicl2	$-17,r0
cmpl	r0,$16
jneq	L145
L144:clrl	_DMAbuf
movl	_req_buf_size,_req_buf_max
movl	_req_buf_max,r0
movl	r0,_dma_word
ret
.align	1
.globl	_Flush_fifo
.set	L148,0xfc0
.data
.text
_Flush_fifo:.word	L148
subl2	$16,sp
movl	_Dga,r10
movl	_DMAheader,r9
movl	_FIFOrequest,r6
clrl	-12(fp)
cvtwl	$17000,-8(fp)
movl	_fcc_cbcsr,r7
cmpl	4(ap),$1
jeql	L99996
tstl	_DMAbuf
jeql	L152
L99996:cmpl	4(ap),$1
jneq	L153
tstl	_DMAbuf
jneq	L153
L155:tstw	6(r7)
jneq	L155
addl3	$6,_dma_word,_dma_max
cmpl	_dma_max,_req_buf_max
jleq	L157
pushl	$0
calls	$1,*_dmafxns+8
pushl	$2
calls	$1,*_dmafxns+4
addl3	$6,_dma_word,_dma_max
L157:movl	_dma_word,r8
movw	$32769,(r8)+
cvtlw	$16,(r8)+
movw	$32768,(r8)+
movl	r8,_dma_word
L153:cmpw	_sg_fifo_type,$1
jneq	L158
subl3	_DMAbuf,_dma_word,r0
divl2	$2,r0
movl	_sg_next_fifo,r1
movzwl	(r1),r2
addl2	r0,r2
cvtlw	r2,(r1)
L158:cmpw	*_sg_int_flag,$-1
jneq	L159
movzwl	_sg_fifo_type,r0
cmpl	r0,_last_DMAtype
jeql	L160
movl	_AdderPtr,r0
cvtlw	$8,2(r0)
L160:extzv	$0,$2,(r7),r0
cvtlw	r0,-2(fp)
movzwl	_sg_fifo_type,r0
cmpl	r0,$1
jeql	L163
cmpl	r0,$2
jeql	L166
cmpl	r0,$3
jeql	L170
jbr	L161
L163:movzwl	_sg_fifo_type,r0
cmpl	r0,_last_DMAtype
jeql	L164
cmpl	_last_DMAtype,$-1
jeql	L164
movzwl	(r7),r0
bicl2	$-57597,r0
cvtlw	r0,(r7)
movzwl	-2(fp),r0
jbss	$9,r0,L2000017
L2000017:movzwl	(r7),r1
bisl2	r0,r1
cvtlw	r1,(r7)
movl	_AdderPtr,r0
cvtbw	$64,2(r0)
L164:cmpw	*_change_section,$1
jeql	L161
movw	*_sg_next_fifo,12(r7)
jbr	L161
L166:movzwl	_sg_fifo_type,r0
cmpl	r0,_last_DMAtype
jeql	L167
L168:tstw	6(r7)
jneq	L168
movzwl	(r7),r0
bicl2	$-57597,r0
cvtlw	r0,(r7)
L167:movl	_AdderPtr,r0
cvtbw	$64,2(r0)
jbcc	$6,2(r7),L2000016
L2000016:movw	*_sg_next_fifo,12(r7)
clrw	8(r7)
cvtwl	_sg_fifo_func,r0
jbss	$22,r0,L2000013
jbr	L2000013
L170:movzwl	_sg_fifo_type,r0
cmpl	r0,_last_DMAtype
jeql	L171
L172:tstw	6(r7)
jneq	L172
movzwl	(r7),r0
bicl2	$-57597,r0
cvtlw	r0,(r7)
L171:movl	_AdderPtr,r0
cvtlw	$32,2(r0)
jbcc	$6,2(r7),L2000014
L2000014:movw	*_sg_next_fifo,14(r7)
clrw	*_sg_int_flag
cvtwl	_sg_fifo_func,r0
jbss	$22,r0,L2000013
L2000013:movzwl	-2(fp),r1
bisl3	r1,r0,(r7)
clrw	_sg_fifo_func
L161:movzwl	_sg_fifo_type,_last_DMAtype
L159:cmpl	4(ap),$1
jneq	L152
L175:cmpw	*_sg_int_flag,$-1
jneq	L175
L177:tstw	6(r7)
jneq	L177
cmpw	*_change_section,$1
jeql	L177
L179:movl	_AdderPtr,r0
movzwl	6(r0),r0
bicl2	$-17,r0
cmpl	r0,$16
jneq	L179
L152:clrl	_DMAbuf
movl	_req_buf_size,_req_buf_max
movl	_req_buf_max,r0
movl	r0,_dma_word
ret
.align	1
.globl	_Get_dma
.set	L181,0x0
.data
.text
_Get_dma:.word	L181
subl2	$12,sp
movl	$1,-8(fp)
clrl	-4(fp)
jbr	L185
L2000024:ashl	_fd_qdss,$1,-12(fp)
pushal	-8(fp)
pushl	$0
pushal	-12(fp)
pushl	$0
addl3	$1,_fd_qdss,-(sp)
calls	$5,_select
L185:movl	_DMAheader,r0
movl	r0,r1
cmpl	16(r0),20(r1)
jgeq	L2000024
movl	r1,r0
mull3	$12,28(r1),r1
addl3	r1,12(r0),_DMArequest
cvtlw	$1,*_DMArequest
movl	_DMArequest,r0
jbcc	$8,2(r0),L2000022
L2000022:movl	_DMArequest,r0
movw	4(ap),2(r0)
movl	_DMArequest,r0
movl	4(r0),_DMAbuf
movl	_DMAbuf,_dma_word
ashl	$1,_req_buf_size,r0
addl2	_DMAbuf,r0
movl	r0,_req_buf_max
ret
.align	1
.globl	_Get_fifo
.set	L188,0x800
.data
.text
_Get_fifo:.word	L188
subl2	$16,sp
movl	_fcc_cbcsr,r11
movzwl	*_sg_next_fifo,r0
extzv	$14,$18,r0,r0
cvtlw	r0,-2(fp)
movzwl	*_sg_next_fifo,r0
addl2	_req_buf_size,r0
extzv	$14,$18,r0,r0
cvtlw	r0,-4(fp)
cmpw	-2(fp),-4(fp)
jneq	L193
cmpw	*_sg_next_fifo,$32767
jlequ	L192
L193:cmpw	*_change_section,$1
jeql	L193
cmpw	-4(fp),$2
jneq	L195
clrw	*_sg_next_fifo
jbr	L196
L195:movzwl	-4(fp),r0
ashl	$14,r0,r0
cvtlw	r0,*_sg_next_fifo
L196:movzwl	(r11),r0
incl	r0
bicl2	$-65534,r0
cvtlw	r0,(r11)
cvtlw	$1,*_change_section
clrw	8(r11)
movzwl	(r11),r0
jbss	$22,r0,L2000025
L2000025:movl	r0,(r11)
L192:cvtlw	$1,_sg_fifo_type
extzv	$0,$14,*_sg_next_fifo,r0
addl2	r0,r0
addl3	_SG_Fifo,r0,_DMAbuf
movl	_DMAbuf,_dma_word
ashl	$1,_req_buf_size,r0
addl2	_DMAbuf,r0
movl	r0,_req_buf_max
ret

SHAR_EOF
fi
exit 0
#	End of shell archive

home help back first fref pref prev next nref lref last post