[comp.bugs.4bsd] Unemulated instructions on uVax

richl@penguin.USS.TEK.COM (Rick Lindsley) (03/23/88)

This is old news, but necessary news for those installing the previously
posted diffs to be able to use 4.3 on a uVax. Some instructions are not
provided in the uVax instruction set, and emulations need to be provided
for them. Others claim to be emulated when, in fact, they aren't.

Rick

#!/bin/sh
#
# This is a shell archive.  Remove anything before the above #! line,
# then unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
#	vax.emulate.s.diff
#	vax.locore.s.diff
#	vax.mtpr.h.diff

echo x - vax.emulate.s.diff
cat > "vax.emulate.s.diff" << '//E*O*F vax.emulate.s.diff//'
*** /tmp/,RCSt1010377	Wed Dec  9 14:25:53 1987
--- emulate.s	Tue Dec  8 14:10:02 1987
***************
*** 3,8
   */
  
  #ifdef VAX630
  /*
   * String instruction emulation - MicroVAX only.  These routines are called
   * from locore.s when an "emulate" fault occurs on the MicroVAX.  They are

--- 3,11 -----
   */
  
  #ifdef VAX630
+ .data
+ .asciz	"$Header: emulate.s,v 1.3 87/12/08 14:08:36 russ Exp $"
+ .text
  /*
   * String instruction emulation - MicroVAX only.  These routines are called
   * from locore.s when an "emulate" fault occurs on the MicroVAX.  They are
***************
*** 55,64
  _EMcrc:
  	argl(1,r11)		# (1) table address == r11
  	argl(2,r0)		# (2) initial crc == r0
! 	toarg(r8,1)		# save r8 in arg1 spot
! 	argl(4,r8)		# (4) source address == r8
! 	toarg(r1,4)		# save r1 in arg4 spot
! 	tstl	arg3		# (3) source length == "arg3"
  	jeql	Lcrc_out
  Lcrc_loop:
  	xorb2	(r8)+,r0

--- 58,65 -----
  _EMcrc:
  	argl(1,r11)		# (1) table address == r11
  	argl(2,r0)		# (2) initial crc == r0
! 	argl(4,r3)		# (4) source address == r3
! 	arguw(3,r2)		# (3) source length == r2
  	jeql	Lcrc_out
  Lcrc_loop:
  	xorb2	(r3)+,r0
***************
*** 61,67
  	tstl	arg3		# (3) source length == "arg3"
  	jeql	Lcrc_out
  Lcrc_loop:
! 	xorb2	(r8)+,r0
  	extzv	$0,$4,r0,r10
  	extzv	$4,$28,r0,r1
  	xorl3	r1,(r11)[r10],r0

--- 62,68 -----
  	arguw(3,r2)		# (3) source length == r2
  	jeql	Lcrc_out
  Lcrc_loop:
! 	xorb2	(r3)+,r0
  	extzv	$0,$4,r0,r10
  	extzv	$4,$28,r0,r1
  	xorl3	r1,(r11)[r10],r0
***************
*** 68,75
  	extzv	$0,$4,r0,r10
  	extzv	$4,$28,r0,r1
  	xorl3	r1,(r11)[r10],r0
! 	decl	arg3
! 	jneq	Lcrc_loop
  	tstl	r0
  Lcrc_out:
  	savepsl

--- 69,75 -----
  	extzv	$0,$4,r0,r10
  	extzv	$4,$28,r0,r1
  	xorl3	r1,(r11)[r10],r0
! 	sobgtr	r2,Lcrc_loop
  	tstl	r0
  Lcrc_out:
  	savepsl
***************
*** 73,80
  	tstl	r0
  Lcrc_out:
  	savepsl
! 	argl(1,r8)
! 	argl(4,r1)
  	return
  
  

--- 73,79 -----
  	tstl	r0
  Lcrc_out:
  	savepsl
! 	clrl	r1
  	return
  
  
***************
*** 94,102
  	movzbl	(r1)+,r2
  	movb	(r3)[r2],(r5)+
  	decl	r0
! 	decl	r4
! 	jeql	Lmovtc_out
! 	jbr	Lmovtc_loop
  Lmovtc_2loop:
  	movb	r11,(r5)+
  	decl	r4

--- 93,100 -----
  	movzbl	(r1)+,r2
  	movb	(r3)[r2],(r5)+
  	decl	r0
! 	sobgtr	r4,Lmovtc_loop
! 	jbr	Lmovtc_out
  Lmovtc_2loop:
  	movb	r11,(r5)+
  	sobgtr	r4,Lmovtc_2loop
***************
*** 99,106
  	jbr	Lmovtc_loop
  Lmovtc_2loop:
  	movb	r11,(r5)+
! 	decl	r4
! 	jneq	Lmovtc_2loop
  Lmovtc_out:
  	cmpl	r4,r0
  	savepsl

--- 97,103 -----
  	jbr	Lmovtc_out
  Lmovtc_2loop:
  	movb	r11,(r5)+
! 	sobgtr	r4,Lmovtc_2loop
  Lmovtc_out:
  	cmpl	r4,r0
  	savepsl
***************
*** 128,135
  	movzbl	(r1)+,r2
  	movb	(r3)[r2],(r5)+
  	decl	r0
! 	decl	r4
! 	jneq	Lmovtuc_loop
  Lmovtuc_out:
  	cmpl	r4,r0
  	savepsl

--- 125,131 -----
  	movzbl	(r1)+,r2
  	movb	(r3)[r2],(r5)+
  	decl	r0
! 	sobgtr	r4,Lmovtuc_loop
  Lmovtuc_out:
  	cmpl	r4,r0
  	savepsl
***************
*** 160,167
  	jeql	Lmatchc_2loop
  Lmatchc_fail:
  	incl	r3
! 	decl	r2
! 	jneq	Lmatchc_loop
  	movl	r10,r1
  	subl3	r10,r11,r0
  	jbr	Lmatchc_out

--- 156,162 -----
  	jeql	Lmatchc_2loop
  Lmatchc_fail:
  	incl	r3
! 	sobgtr	r2,Lmatchc_loop
  	movl	r10,r1
  	subl3	r10,r11,r0
  	jbr	Lmatchc_out
***************
*** 166,171
  	subl3	r10,r11,r0
  	jbr	Lmatchc_out
  Lmatchc_succ:	
  	movl	r11,r1
  	clrl	r0
  Lmatchc_out:

--- 161,167 -----
  	subl3	r10,r11,r0
  	jbr	Lmatchc_out
  Lmatchc_succ:	
+ 	movl	r1,r3
  	movl	r11,r1
  	clrl	r0
  Lmatchc_out:
***************
*** 177,183
  	.globl	_EMspanc
  _EMspanc:
  	argl(2,r1)		# (2) string address == r1
- 	argl(3,r3)		# (3) table address == r3
  	argub(4,r2)		# (4) character-mask == r2
  	arguw(1,r0)		# (1) string length == r0
  	jeql	Lspanc_out

--- 173,178 -----
  	.globl	_EMspanc
  _EMspanc:
  	argl(2,r1)		# (2) string address == r1
  	argub(4,r2)		# (4) character-mask == r2
  	argl(3,r3)		# (3) table address == r3
  	arguw(1,r0)		# (1) string length == r0
***************
*** 179,184
  	argl(2,r1)		# (2) string address == r1
  	argl(3,r3)		# (3) table address == r3
  	argub(4,r2)		# (4) character-mask == r2
  	arguw(1,r0)		# (1) string length == r0
  	jeql	Lspanc_out
  Lspanc_loop:

--- 174,180 -----
  _EMspanc:
  	argl(2,r1)		# (2) string address == r1
  	argub(4,r2)		# (4) character-mask == r2
+ 	argl(3,r3)		# (3) table address == r3
  	arguw(1,r0)		# (1) string length == r0
  	jeql	Lspanc_out
  Lspanc_loop:
***************
*** 187,194
  	bicb3	r11,r2,r11
  	jeql	Lspanc_out
  	incl	r1
! 	decl	r0
! 	jneq	Lspanc_loop
  Lspanc_out:
  	savepsl
  	clrl	r2

--- 183,189 -----
  	bicb3	r11,r2,r11
  	jeql	Lspanc_out
  	incl	r1
! 	sobgtr	r0,Lspanc_loop
  Lspanc_out:
  	savepsl
  	clrl	r2
***************
*** 199,205
  	.globl	_EMscanc
  _EMscanc:
  	argl(2,r1)		# (2) string address == r1
- 	argl(3,r3)		# (3) table address == r3
  	argub(4,r2)		# (4) character-mask == r2
  	arguw(1,r0)		# (1) string length == r0
  	jeql	Lscanc_out

--- 194,199 -----
  	.globl	_EMscanc
  _EMscanc:
  	argl(2,r1)		# (2) string address == r1
  	argub(4,r2)		# (4) character-mask == r2
  	argl(3,r3)		# (3) table address == r3
  	arguw(1,r0)		# (1) string length == r0
***************
*** 201,206
  	argl(2,r1)		# (2) string address == r1
  	argl(3,r3)		# (3) table address == r3
  	argub(4,r2)		# (4) character-mask == r2
  	arguw(1,r0)		# (1) string length == r0
  	jeql	Lscanc_out
  Lscanc_loop:

--- 195,201 -----
  _EMscanc:
  	argl(2,r1)		# (2) string address == r1
  	argub(4,r2)		# (4) character-mask == r2
+ 	argl(3,r3)		# (3) table address == r3
  	arguw(1,r0)		# (1) string length == r0
  	jeql	Lscanc_out
  Lscanc_loop:
***************
*** 209,216
  	bicb3	r11,r2,r11
  	jneq	Lscanc_out
  	incl	r1
! 	decl	r0
! 	jneq	Lscanc_loop
  Lscanc_out:
  	savepsl
  	clrl	r2

--- 204,210 -----
  	bicb3	r11,r2,r11
  	jneq	Lscanc_out
  	incl	r1
! 	sobgtr	r0,Lscanc_loop
  Lscanc_out:
  	savepsl
  	clrl	r2
***************
*** 223,229
  	argub(1,r11)		# (1) character == r11
  	argl(3,r1)		# (3) string address == r1
  	arguw(2,r0)		# (2) string length == r0
! 	incl	r0
  Lskpc_loop:
  	decl	r0
  	jeql	Lskpc_out

--- 217,223 -----
  	argub(1,r11)		# (1) character == r11
  	argl(3,r1)		# (3) string address == r1
  	arguw(2,r0)		# (2) string length == r0
! 	jeql	Lskpc_out	# forget zero length strings
  Lskpc_loop:
  	cmpb	(r1),r11
  	jneq	Lskpc_out
***************
*** 225,236
  	arguw(2,r0)		# (2) string length == r0
  	incl	r0
  Lskpc_loop:
! 	decl	r0
! 	jeql	Lskpc_out
! 	cmpb	(r1)+,r11
! 	jeql	Lskpc_loop
! 	decl	r1
! 	tstl	r0
  Lskpc_out:
  	savepsl
  	return

--- 219,228 -----
  	arguw(2,r0)		# (2) string length == r0
  	jeql	Lskpc_out	# forget zero length strings
  Lskpc_loop:
! 	cmpb	(r1),r11
! 	jneq	Lskpc_out
! 	incl	r1
! 	sobgtr	r0,Lskpc_loop
  Lskpc_out:
  	tstl	r0		# be sure of condition codes
  	savepsl
***************
*** 232,237
  	decl	r1
  	tstl	r0
  Lskpc_out:
  	savepsl
  	return
  

--- 224,230 -----
  	incl	r1
  	sobgtr	r0,Lskpc_loop
  Lskpc_out:
+ 	tstl	r0		# be sure of condition codes
  	savepsl
  	return
  
***************
*** 242,248
  	argub(1,r11)		# (1) character == r11
  	argl(3,r1)		# (3) string address == r1
  	arguw(2,r0)		# (2) string length == r0
! 	incl	r0
  Llocc_loop:
  	decl	r0
  	jeql	Llocc_out

--- 235,241 -----
  	argub(1,r11)		# (1) character == r11
  	argl(3,r1)		# (3) string address == r1
  	arguw(2,r0)		# (2) string length == r0
! 	jeql	Lskpc_out	# forget zero length strings
  Llocc_loop:
  	cmpb	(r1),r11
  	jeql	Llocc_out
***************
*** 244,250
  	arguw(2,r0)		# (2) string length == r0
  	incl	r0
  Llocc_loop:
! 	decl	r0
  	jeql	Llocc_out
  	cmpb	(r1)+,r11
  	jneq	Llocc_loop

--- 237,243 -----
  	arguw(2,r0)		# (2) string length == r0
  	jeql	Lskpc_out	# forget zero length strings
  Llocc_loop:
! 	cmpb	(r1),r11
  	jeql	Llocc_out
  	incl	r1
  	sobgtr  r0,Llocc_loop
***************
*** 246,255
  Llocc_loop:
  	decl	r0
  	jeql	Llocc_out
! 	cmpb	(r1)+,r11
! 	jneq	Llocc_loop
! 	decl	r1
! 	tstl	r0
  Llocc_out:
  	savepsl
  	return

--- 239,246 -----
  Llocc_loop:
  	cmpb	(r1),r11
  	jeql	Llocc_out
! 	incl	r1
! 	sobgtr  r0,Llocc_loop
  Llocc_out:
  	tstl	r0		# be sure of condition codes
  	savepsl
***************
*** 251,256
  	decl	r1
  	tstl	r0
  Llocc_out:
  	savepsl
  	return
  

--- 242,248 -----
  	incl	r1
  	sobgtr  r0,Llocc_loop
  Llocc_out:
+ 	tstl	r0		# be sure of condition codes
  	savepsl
  	return
  
***************
*** 267,274
  	jneq	Lcmpc3_out
  	incl	r1
  	incl	r3
! 	decl	r0
! 	jneq	Lcmpc3_loop
  Lcmpc3_out:
  	savepsl
  	movl	r0,r2

--- 259,265 -----
  	jneq	Lcmpc3_out
  	incl	r1
  	incl	r3
! 	sobgtr	r0,Lcmpc3_loop
  Lcmpc3_out:
  	savepsl
  	movl	r0,r2
***************
*** 292,299
  	incl	r1
  	incl	r3
  	decl	r2
! 	decl	r0
! 	jneq	Lcmpc5_loop
  Lcmpc5_str2:
  	tstl	r2
  	jeql	Lcmpc5_out

--- 283,289 -----
  	incl	r1
  	incl	r3
  	decl	r2
! 	sobgtr	r0,Lcmpc5_loop
  Lcmpc5_str2:
  	tstl	r2
  	jeql	Lcmpc5_out
***************
*** 301,308
  	cmpb	r11,(r3)
  	jneq	Lcmpc5_out
  	incl	r3
! 	decl	r2
! 	jneq	Lcmpc5_str2loop
  	jbr	Lcmpc5_out
  Lcmpc5_str1loop:
  	cmpb	(r1),r11

--- 291,297 -----
  	cmpb	r11,(r3)
  	jneq	Lcmpc5_out
  	incl	r3
! 	sobgtr	r2,Lcmpc5_str2loop
  	jbr	Lcmpc5_out
  Lcmpc5_str1loop:
  	cmpb	(r1),r11
***************
*** 308,315
  	cmpb	(r1),r11
  	jneq	Lcmpc5_out
  	incl	r1
! 	decl	r0
! 	jneq	Lcmpc5_str1loop
  Lcmpc5_out:
  	savepsl
  	return

--- 297,303 -----
  	cmpb	(r1),r11
  	jneq	Lcmpc5_out
  	incl	r1
! 	sobgtr	r0,Lcmpc5_str1loop
  Lcmpc5_out:
  	savepsl
  	return
***************
*** 511,518
  L144:
  	insv	r9,$4,$4,(r3)
  	bisl2	r9,r2
! 	decl	r11		# while (--source length)
! 	jneq	Laddp4_same_loop
  	argl(4,r10)		# r10 = destination address of MSNibble
  	jbr	Laddp4_same_carry
  Laddp4_same_cloop:

--- 499,505 -----
  L144:
  	insv	r9,$4,$4,(r3)
  	bisl2	r9,r2
! 	sobgtr	r11,Laddp4_same_loop	# while (--source length)
  	argl(4,r10)		# r10 = destination address of MSNibble
  	jbr	Laddp4_same_carry
  Laddp4_same_cloop:
***************
*** 580,587
  Lmovp_copy:
  	bisb2	(r10),r2	# keep track of non-zero source
  	movb	(r10)+,(r3)+	# move two nibbles
! 	decl	r11		# loop for length of source
! 	jneq	Lmovp_copy
  Lmovp_zlen:
  	extzv	$4,$4,(r10),r0	# look at least significant nibble
  	bisl2	r0,r2

--- 567,573 -----
  Lmovp_copy:
  	bisb2	(r10),r2	# keep track of non-zero source
  	movb	(r10)+,(r3)+	# move two nibbles
! 	sobgtr	r11,Lmovp_copy	# loop for length of source
  Lmovp_zlen:
  	extzv	$4,$4,(r10),r0	# look at least significant nibble
  	bisl2	r0,r2
***************
*** 794,801
  	subl2	r11,r5			# to back up over output and replace
  L200:
  	putfill				# with fill character
! 	decl	r11
! 	jneq	L200
  	jbr	Ledit_case
  
  Le_adjust_input:

--- 780,786 -----
  	subl2	r11,r5			# to back up over output and replace
  L200:
  	putfill				# with fill character
! 	sobgtr	r11,L200
  	jbr	Ledit_case
  
  Le_adjust_input:
***************
*** 827,834
  	jeql	Ledit_case
  Le_fill_loop:
  	putfill
! 	decl	r1
! 	jneq	Le_fill_loop
  	jbr	Ledit_case
  
  Le_move:

--- 812,818 -----
  	jeql	Ledit_case
  Le_fill_loop:
  	putfill
! 	sobgtr	r1,Le_fill_loop
  	jbr	Ledit_case
  
  Le_move:
***************
*** 853,860
  L219:					# else put fill character
  	putfill
  L220:
! 	decl	r1
! 	jneq	L214
  	jbr	Ledit_case
  
  Le_float:				# move with floating sign character

--- 837,843 -----
  L219:					# else put fill character
  	putfill
  L220:
! 	sobgtr	r1,L214
  	jbr	Ledit_case
  
  Le_float:				# move with floating sign character
***************
*** 882,889
  L227:
  	putfill
  L228:
! 	decl	r1
! 	jneq	L221
  	jbr	Ledit_case
  
  

--- 865,871 -----
  L227:
  	putfill
  L228:
! 	sobgtr	r1,L221
  	jbr	Ledit_case
  
  
***************
*** 899,904
  	argl(6,r6)		# (6) destination address == r6
  			# we need arg6 for later
  			# arg1 is used for temporary storage
  			# arg4 is used as general storage
  			# arg5 is used as general storage
  	ashl	$-1,r3,r0	# destination length is number of bytes

--- 881,887 -----
  	argl(6,r6)		# (6) destination address == r6
  			# we need arg6 for later
  			# arg1 is used for temporary storage
+ 			# arg2 holds "even or odd" destination length
  			# arg4 is used as general storage
  			# arg5 is used as general storage
  	ashl	$-1,r3,r0	# destination length is number of bytes
***************
*** 915,922
  	jbr	L245
  Lashp_neg:
  	movb	NEGATIVE,(r6)
! L245:				# r3<0> counts digits going into destination
! 	bisl2	$1,r3		#	and is flip-flop for which nibble to
  	tstl	r11		#	write in destination (1 = high, 0 = low)
  	jgeq	Lashp_left	#	(it must start out odd)
  	addl2	r11,r10		# scale is negative (right shift)

--- 898,909 -----
  	jbr	L245
  Lashp_neg:
  	movb	NEGATIVE,(r6)
! L245:
! 	clrl	arg2		# arg2 is 1 if dstlen is even, 0 if odd
! 	blbs	r3,L246
! 	incl	arg2
! 	bisl2	$1,r3		# r3<0> counts digits going into destination
! L246:				#	and is flip-flop for which nibble to
  	tstl	r11		#	write in destination (1 = high, 0 = low)
  	jgeq	Lashp_left	#	(it must start out odd)
  	addl2	r11,r10		# scale is negative (right shift)
***************
*** 943,951
  	jlbs	r3,L257		# don't need to clear high nibble twice
  	clrb	-(r6)		# clear low (and high) nib of next byte in dest
  L257:
! 	decl	r3		# move to next nibble in destination, but
! 	jneq	L258		#	don't go beyond the end.
! 	incl	r3
  L258:
  	decl	r11
  Lashp_left:			# while scale is positive

--- 930,937 -----
  	jlbs	r3,L257		# don't need to clear high nibble twice
  	clrb	-(r6)		# clear low (and high) nib of next byte in dest
  L257:
! 	sobgtr	r3,L258		# move to next nibble in destination, but
! 	incl	r3		#	don't go beyond the end.
  L258:
  	decl	r11
  Lashp_left:			# while scale is positive
***************
*** 956,962
  Lashp_shift:
  	clrl	arg4		# arg4 will be used for result condition codes
  	tstl	r10
! 	jeql	Lashp_sethigh
  Lashp_shloop:
  	jlbc	r11,L260
  	extzv	$4,$4,(r1),r0

--- 942,948 -----
  Lashp_shift:
  	clrl	arg4		# arg4 will be used for result condition codes
  	tstl	r10
! 	jeql	Lashp_round
  Lashp_shloop:
  	jlbc	r11,L260
  	extzv	$4,$4,(r1),r0
***************
*** 978,987
  L263:
  	bisl2	arg5,arg4	# remember if result was nonzero in arg4
  	decl	r3		# move to next nibble early to check
! 	jgeq	Lashp_noovfl	# if we've moved passed destination limits
! 	clrl	r3		#	test the result for possible overflow
! 	tstl	arg5		#	ignore zero nibbles
! 	jeql	L265		#	if the nibble was non-zero, overflow
  	jbr	Lashp_overfl
  Lashp_noovfl:			# else
  	jlbs	r3,L264

--- 964,974 -----
  L263:
  	bisl2	arg5,arg4	# remember if result was nonzero in arg4
  	decl	r3		# move to next nibble early to check
! 	cmpl	r3,arg2		# if we've moved passed destination limits
! 	jgeq	Lashp_noovfl	#	test the result for possible overflow
! 	movl	arg2,r3		#	ignore zero nibbles
! 	tstl	arg5		#	if the nibble was non-zero, overflow
! 	jeql	L265
  	jbr	Lashp_overfl
  Lashp_noovfl:			# else
  	jlbs	r3,L264
***************
*** 988,995
  	insv	arg5,$4,$4,(r6)	# put the result into destination (high or low)
  	jbr	L265
  L264:
! 	decl	r6
! 	insv	arg5,$0,$4,(r6)
  L265:
  	decl	r10		# loop for length of source
  	jneq	Lashp_shloop

--- 975,981 -----
  	insv	arg5,$4,$4,(r6)	# put the result into destination (high or low)
  	jbr	L265
  L264:
! 	movb	arg5,-(r6)
  L265:
  	sobgtr	r10,Lashp_shloop	# loop for length of source
  
***************
*** 991,998
  	decl	r6
  	insv	arg5,$0,$4,(r6)
  L265:
! 	decl	r10		# loop for length of source
! 	jneq	Lashp_shloop
  
  Lashp_sethigh:
  	jlbc	r3,L266		# if we haven't set the high nibble,

--- 977,983 -----
  L264:
  	movb	arg5,-(r6)
  L265:
! 	sobgtr	r10,Lashp_shloop	# loop for length of source
  
  Lashp_round:
  	tstl	r2		# take care of round out of high nibble
***************
*** 994,1003
  	decl	r10		# loop for length of source
  	jneq	Lashp_shloop
  
! Lashp_sethigh:
! 	jlbc	r3,L266		# if we haven't set the high nibble,
! 	insv	r2,$4,$4,(r6)	# carry the round into the high nibble
! 	clrl	r2
  L266:
  	argl(1,r10)		# r10 = address of destination LSNibble
  	argl(6,r3)		# r3 = address of destination MSNibble

--- 979,993 -----
  L265:
  	sobgtr	r10,Lashp_shloop	# loop for length of source
  
! Lashp_round:
! 	tstl	r2		# take care of round out of high nibble
! 	jeql	Lashp_zeroround
! 	decl	r3
! 	cmpl	r3,arg2		# if we've moved passed destination limits
! 	jlss	Lashp_overfl	#	then overflow
! 	jlbs	r3,L266
! 	insv	arg5,$4,$4,(r6)	# put the round into destination (high or low)
! 	jbr	Lashp_zeroround
  L266:
  	movb	arg5,-(r6)
  
***************
*** 999,1004
  	insv	r2,$4,$4,(r6)	# carry the round into the high nibble
  	clrl	r2
  L266:
  	argl(1,r10)		# r10 = address of destination LSNibble
  	argl(6,r3)		# r3 = address of destination MSNibble
  	movl	arg4,r11	# r11 = non-zero if destination == non-zero

--- 989,997 -----
  	insv	arg5,$4,$4,(r6)	# put the round into destination (high or low)
  	jbr	Lashp_zeroround
  L266:
+ 	movb	arg5,-(r6)
+ 
+ Lashp_zeroround:
  	argl(1,r10)		# r10 = address of destination LSNibble
  	argl(6,r3)		# r3 = address of destination MSNibble
  	movl	arg4,r11	# r11 = non-zero if destination == non-zero
***************
*** 1005,1012
  	savepsl
  	jbr	L267
  Lashp_zerofill:
! 	cvtlb	r2,-(r6)	# fill up MSNs of destination with carry or zero
! 	clrl	r2
  L267:
  	cmpl	r3,r6
  	jneq	Lashp_zerofill

--- 998,1004 -----
  	savepsl
  	jbr	L267
  Lashp_zerofill:
! 	clrb	-(r6)		# fill up MSNs of destination with zeros
  L267:
  	cmpl	r3,r6
  	jneq	Lashp_zerofill
***************
*** 1010,1017
  L267:
  	cmpl	r3,r6
  	jneq	Lashp_zerofill
- 	tstl	r2		# if carry beyond destination, overflow
- 	jneq	Lashp_overfl
  	extzv	$0,$4,(r10),r0	# test for negative result
  	cmpl	r0,NEGATIVE
  	jneq	Lashp_out

--- 1002,1007 -----
  L267:
  	cmpl	r3,r6
  	jneq	Lashp_zerofill
  	extzv	$0,$4,(r10),r0	# test for negative result
  	cmpl	r0,NEGATIVE
  	jneq	Lashp_out
***************
*** 1099,1106
  	extzv	$0,$4,(r10),r0
  	addl2	r0,r3		# destination += low nibble
  	incl	r10
! 	decl	r11
! 	jneq	Lcvtpl_loop
  Lcvtpl_zero:			# least significant byte
  	mull2	$10,r3
  	extzv	$4,$4,(r10),r0

--- 1089,1095 -----
  	extzv	$0,$4,(r10),r0
  	addl2	r0,r3		# destination += low nibble
  	incl	r10
! 	sobgtr	r11,Lcvtpl_loop
  Lcvtpl_zero:			# least significant byte
  	mull2	$10,r3
  	extzv	$4,$4,(r10),r0
***************
*** 1125,1130
  	.align	1
  	.globl	_EMcvtps
  _EMcvtps:
  	return
  
  

--- 1114,1171 -----
  	.align	1
  	.globl	_EMcvtps
  _EMcvtps:
+ 	arguw(1,r0)			# (1) source length == r0
+ 	argl(2,r1)			# (2) source address == r1
+ 	arguw(3,r2)			# (3) destination length == r2
+ 	argl(4,r3)			# (4) destination address == r3
+ 	ashl	$-1,r0,r0
+ 	addl2	r0,r1			# r1 = address of last byte
+ 	extzv	$0,$4,(r1),r10		# get sign
+ 	cmpl	r10,NEGATIVE
+ 	jeql	Lcvtps_neg
+ 	cmpl	r10,NEGATIVEalt
+ 	jeql	Lcvtps_neg
+ 	movb	$'+,(r3)+		# stuff an ascii "+" if positive
+ 	jbr	Lcvtps_pos
+ Lcvtps_neg:
+ 	movb	$'-,(r3)+		# stuff an ascii "-" if negative
+ Lcvtps_pos:
+ 	addl2	r2,r3			# point at end of dest
+ 	clrl	r11			# use r11 to compute condition code
+ 	jbr	Lcvtps_mid		# start converting
+ Lcvtps_loop:				# main loop to convert digits
+ 	tstl	r2			# is there room in dest?
+ 	jleq	Lcvtps_oflow		# no - overflow
+ 	extzv	$0,$4,-(r1),r10		# grab lower nibble
+ 	addl2	r10,r11			# accumulate something for CC
+ 	addb3	$'0,r10,-(r3)		# make it ascii and stuff it in dest
+ 	decl	r2			# decrement destination counter
+ Lcvtps_mid:
+ 	tstl	r2			# is there room in dest?
+ 	jleq	Lcvtps_oflow		# no - overflow
+ 	extzv	$4,$4,(r1),r10		# grab upper nibble
+ 	addl2	r10,r11			# accumulate something for CC
+ 	addb3	$'0,r10,-(r3)		# make it ascii and stuff it in dest
+ 	decl	r2			# decrement destination counter
+ 	sobgeq	r0,Lcvtps_loop		# next word in source
+ 	tstl	r2			# do we need to zero fill destination?
+ 	jeql	Lcvtps_out
+ Lcvtps_fill:				# loop to zero fill the destination
+ 	movb	$'0,-(r3)
+ 	sobgtr	r2,Lcvtps_fill
+ Lcvtps_out:				# time to get out
+ 	clrl	r0			# fixup registers
+ 	decl	r3
+ 	cmpb	$'+,(r3)		# is it positive?
+ 	jeql	Lcvtps_plus
+ 	mnegl	r11,r11			# fixup condition code
+ Lcvtps_plus:
+ 	tstl	r11			# is it non-zero
+ 	jneq	Lcvtps_nonzero
+ 	movb	$'+,(r3)		# stuff a plus in case of -0
+ Lcvtps_nonzero:
+ 	tstl	r11			# this sets the real condition codes
+ 	savepsl
  	return
  Lcvtps_oflow:
  	clrl	r0			# fixup r0 and r1.
***************
*** 1126,1131
  	.globl	_EMcvtps
  _EMcvtps:
  	return
  
  
  	.align	1

--- 1167,1178 -----
  	tstl	r11			# this sets the real condition codes
  	savepsl
  	return
+ Lcvtps_oflow:
+ 	clrl	r0			# fixup r0 and r1.
+ 	argl(2,r1)
+ 					# r2 and r3 should be OK
+ 	overflowpsl
+ 	return
  
  
  	.align	1
***************
*** 1205,1211
  /* fc */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 00 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 04 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 08 */	EMULATE(cvtps);	EMULATE(cvtsp);	NOEMULATE;	EMULATE(crc)
  /* 0c */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 10 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 14 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE

--- 1252,1258 -----
  /* fc */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 00 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 04 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 08 */	EMULATE(cvtps);	NOEMULATE/*(cvtsp)*/;	NOEMULATE;	EMULATE(crc)
  /* 0c */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 10 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 14 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
***************
*** 1211,1218
  /* 14 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 18 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 1c */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 20 */	EMULATE(addp4);	EMULATE(addp6);	EMULATE(subp4);	EMULATE(subp6)
! /* 24 */	EMULATE(cvtpt);	EMULATE(mulp);	EMULATE(cvttp);	EMULATE(divp)
  /* 28 */	NOEMULATE;	EMULATE(cmpc3);	EMULATE(scanc);	EMULATE(spanc)
  /* 2c */	NOEMULATE;	EMULATE(cmpc5);	EMULATE(movtc);	EMULATE(movtuc)
  /* 30 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE

--- 1258,1265 -----
  /* 14 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 18 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 1c */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 20 */	EMULATE(addp4);	NOEMULATE/*(addp6)*/;	NOEMULATE/*(subp4)*/;	NOEMULATE/*(subp6)*/
! /* 24 */	NOEMULATE/*(cvtpt)*/;	NOEMULATE/*(mulp)*/;	NOEMULATE/*(cvttp)*/;	NOEMULATE/*(divp)*/
  /* 28 */	NOEMULATE;	EMULATE(cmpc3);	EMULATE(scanc);	EMULATE(spanc)
  /* 2c */	NOEMULATE;	EMULATE(cmpc5);	EMULATE(movtc);	EMULATE(movtuc)
  /* 30 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
***************
*** 1216,1222
  /* 28 */	NOEMULATE;	EMULATE(cmpc3);	EMULATE(scanc);	EMULATE(spanc)
  /* 2c */	NOEMULATE;	EMULATE(cmpc5);	EMULATE(movtc);	EMULATE(movtuc)
  /* 30 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 34 */	EMULATE(movp);	EMULATE(cmpp3);	EMULATE(cvtpl);	EMULATE(cmpp4)
  /* 38 */	EMULATE(editpc); EMULATE(matchc); EMULATE(locc); EMULATE(skpc)
  
  /*

--- 1263,1269 -----
  /* 28 */	NOEMULATE;	EMULATE(cmpc3);	EMULATE(scanc);	EMULATE(spanc)
  /* 2c */	NOEMULATE;	EMULATE(cmpc5);	EMULATE(movtc);	EMULATE(movtuc)
  /* 30 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 34 */	EMULATE(movp);	NOEMULATE/*(cmpp3)*/;	EMULATE(cvtpl);	NOEMULATE/*(cmpp4)*/
  /* 38 */	EMULATE(editpc); EMULATE(matchc); EMULATE(locc); EMULATE(skpc)
  
  /*
//E*O*F vax.emulate.s.diff//

echo x - vax.locore.s.diff
cat > "vax.locore.s.diff" << '//E*O*F vax.locore.s.diff//'
*** /tmp/,RCSt1010380	Wed Dec  9 14:25:43 1987
--- locore.s	Thu Dec  3 16:32:43 1987
***************
*** 6,11
   *	@(#)locore.s	7.1 (Berkeley) 6/5/86
   */
  
  #include "psl.h"
  #include "pte.h"
  

--- 6,14 -----
   *	@(#)locore.s	7.1 (Berkeley) 6/5/86
   */
  
+ .data
+ .asciz	"$Header: locore.s,v 1.1 87/11/20 09:24:07 russ Exp $"
+ .text
  #include "psl.h"
  #include "pte.h"
  
***************
*** 562,568
  /* fc */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 00 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 04 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 08 */	EMULATE(cvtps);	EMULATE(cvtsp);	NOEMULATE;	EMULATE(crc)
  /* 0c */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 10 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 14 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE

--- 565,571 -----
  /* fc */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 00 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 04 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 08 */	EMULATE(cvtps);	NOEMULATE/*(cvtsp)*/;	NOEMULATE;	EMULATE(crc)
  /* 0c */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 10 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 14 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
***************
*** 568,575
  /* 14 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 18 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 1c */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 20 */	EMULATE(addp4);	EMULATE(addp6);	EMULATE(subp4);	EMULATE(subp6)
! /* 24 */	EMULATE(cvtpt);	EMULATE(mulp);	EMULATE(cvttp);	EMULATE(divp)
  /* 28 */	NOEMULATE;	EMULATE(cmpc3);	EMULATE(scanc);	EMULATE(spanc)
  /* 2c */	NOEMULATE;	EMULATE(cmpc5);	EMULATE(movtc);	EMULATE(movtuc)
  /* 30 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE

--- 571,578 -----
  /* 14 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 18 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
  /* 1c */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 20 */	EMULATE(addp4);	NOEMULATE/*(addp6)*/;	NOEMULATE/*(subp4)*/;	NOEMULATE/*(subp6)*/
! /* 24 */	NOEMULATE/*(cvtpt)*/;	NOEMULATE/*(mulp)*/;	NOEMULATE/*(cvttp)*/;	NOEMULATE/*(divp)*/
  /* 28 */	NOEMULATE;	EMULATE(cmpc3);	EMULATE(scanc);	EMULATE(spanc)
  /* 2c */	NOEMULATE;	EMULATE(cmpc5);	EMULATE(movtc);	EMULATE(movtuc)
  /* 30 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
***************
*** 573,579
  /* 28 */	NOEMULATE;	EMULATE(cmpc3);	EMULATE(scanc);	EMULATE(spanc)
  /* 2c */	NOEMULATE;	EMULATE(cmpc5);	EMULATE(movtc);	EMULATE(movtuc)
  /* 30 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 34 */	EMULATE(movp);	EMULATE(cmpp3);	EMULATE(cvtpl);	EMULATE(cmpp4)
  /* 38 */	EMULATE(editpc); EMULATE(matchc); EMULATE(locc); EMULATE(skpc)
  #endif
  

--- 576,582 -----
  /* 28 */	NOEMULATE;	EMULATE(cmpc3);	EMULATE(scanc);	EMULATE(spanc)
  /* 2c */	NOEMULATE;	EMULATE(cmpc5);	EMULATE(movtc);	EMULATE(movtuc)
  /* 30 */	NOEMULATE;	NOEMULATE;	NOEMULATE;	NOEMULATE
! /* 34 */	EMULATE(movp);	NOEMULATE/*(cmpp3)*/;	EMULATE(cvtpl);	NOEMULATE/*(cmpp4)*/
  /* 38 */	EMULATE(editpc); EMULATE(matchc); EMULATE(locc); EMULATE(skpc)
  #endif
  
//E*O*F vax.locore.s.diff//

echo x - vax.mtpr.h.diff
cat > "vax.mtpr.h.diff" << '//E*O*F vax.mtpr.h.diff//'
*** /tmp/,RCSt1010390	Wed Dec  9 14:25:36 1987
--- mtpr.h	Thu Jun 11 01:57:31 1987
***************
*** 78,84
  #define	MBRK	0x3c		/* micro-program breakpoint */
  #endif
  
! #if defined(VAX750) || defined(VAX730)
  #define	MCSR	0x17		/* machine check status register */
  #define	CSRS	0x1c		/* console storage receive status register */
  #define	CSRD	0x1d		/* console storage receive data register */

--- 78,84 -----
  #define	MBRK	0x3c		/* micro-program breakpoint */
  #endif
  
! #if defined(VAX750) || defined(VAX730) || defined(VAX630)
  #define	MCSR	0x17		/* machine check status register */
  #define	CSRS	0x1c		/* console storage receive status register */
  #define	CSRD	0x1d		/* console storage receive data register */
//E*O*F vax.mtpr.h.diff//

exit 0