⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vaxcvtpl.s

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 S
📖 第 1 页 / 共 3 页
字号:
	addl2	$4,sp			# discard end address	subl2	(sp)+,r1		# get pc relative to this base1:	cmpw	r1,pc_table_base[r2]	# is this the right pc?	beql	3f			# exit loop if true	aoblss	$table_size,r2,1b	# do the entire table # if we drop through the dispatching based on pc, then the exception is not  # one that we want to back up. we simply reflect the exception to the user.2: #	popr	#^m<r0,r1,r2,r3>	# restore saved registers	 popr	$0x0f	rsb				# return to exception dispatcher # the exception pc matched one of the entries in our pc table. r2 contains # the index into both the pc table and the handler table. r1 has served # its purpose and can be used as a scratch register.3:	movzwl	handler_table_base[r2],r1	# get the offset to the handler	jmp	module_base[r1]		# pass control to the handler	 # in all of the instruction-specific routines, the state of the stack # will be shown as it was when the exception occurred. all offsets will # be pictured relative to r0.  #+ # functional description: # #	the intermediate state of the instruction is packed into registers r0  #	through r3 and control is passed to vax$reflect_fault that will, in  #	turn, reflect the access violation back to the user. the intermediate  #	state reflects the point at which the routine was executing when the  #	access violation occurred. # # input parameters: # #	r0 - address of top of stack when access violation occurred # #	00(sp) - saved r0 (restored by vax$handler) #	04(sp) - saved r1 #	08(sp) - saved r2 #	12(sp) - saved r3 # #	see individual entry points for details # # output parameters: # #	r0 - address of return pc from vax$cvtpl #	r1 - byte offset to delta-pc in saved register array #		(pack_v_fpd and pack_m_accvio set to identify exception) # #	see list of input parameters for cvtpl_restart for a description of the #	contents of the packed register array. # # implicit output: # #	r4, r5, r6, r7, and r10 are restored to the values that they had #	when vax$cvtpl was entered. #- #+ # cvtpl_1 # # an access violation occurred in subroutine strip_zeros while scanning the # source string for leading zeros. # #	r0  - updated digit or byte count in source string #	r1  - address of current byte in source string #	r2  - condition codes reflecting result #	r3  - address of destination (unchanged from input value) #	r6  - intermediate (or final) longword result # #	00(r0) - return pc from strip_zeros #	04(r0) - original value of r1 (scraddr) #	08(r0) - saved r4 #	12(r0) - saved r5 #	16(r0) - saved r6 #	20(r0) - saved r7 #	24(r0) - saved r10 #	28(r0) - return pc from vax$cvtpl routine #-cvtpl_1:	addl2	$4,r0			# discard return pc from strip_zeros	movb	$cvtpl_1_restart,r4	# store code that locates exception pc	brb	1f			# join common code #+ # cvtpl_2 through cvtpl_5 # #	r0  - updated digit or byte count in source string #	r1  - address of current byte in source string #	r2  - condition codes reflecting result #	r3  - address of destination (unchanged from input value) #	r6  - intermediate (or final) longword result # #	00(r0) - original value of r1 (scraddr) #	04(r0) - saved r4 #	08(r0) - saved r5 #	12(r0) - saved r6 #	16(r0) - saved r7 #	20(r0) - saved r10 #	24(r0) - return pc from vax$cvtpl routine #-cvtpl_2:	movb	$cvtpl_2_restart,r4	# store code that locates exception pc	brb	1f			# join common codecvtpl_3:	movb	$cvtpl_3_restart,r4	# store code that locates exception pc	brb	1f			# join common codecvtpl_4:	movb	$cvtpl_4_restart,r4	# store code that locates exception pc	brb	1f			# join common codecvtpl_5:	movb	$cvtpl_5_restart,r4	# store code that locates exception pc	brb	1f			# join common code #+ # cvtpl_6  # #	r0  - updated digit or byte count in source string #	r1  - address of most significant byte in source string (original srcaddr) #	r2  - condition codes reflecting result #	r3  - address of destination (unchanged from input value) #	r6  - intermediate (or final) longword result # #	00(r0) - zero (will be restored to r2) #	04(r0) - zero (will be restored to r3) #	08(r0) - saved r4 #	12(r0) - saved r5 #	16(r0) - saved r6 #	20(r0) - saved r7 #	24(r0) - saved r10 #	28(r0) - return pc from vax$cvtpl routine #-cvtpl_6:	addl2	$4,r0			# discard extra longword on the stack	movb	$cvtpl_6_restart,r4	# store code that locates exception pc	movl	pack_l_saved_r1(sp),(r0)# put "current" r1 on top of stack1:	subl3	(r0)+,cvtpl_a_srcaddr(sp),r1	# current minus initial srcaddr	movb	r1,cvtpl_b_delta_srcaddr(sp)	# remember it for restart	bisb3	$cvtpl_m_fpd,pack_l_saved_r2(sp),cvtpl_b_state(sp)						# save current condition codes						#  and set internal fpd bit #	insv	r7,#cvtpl_v_state,-		# store code that identifies #		#cvtpl_s_state,-		#  exception pc so that we #		cvtpl_b_state(sp)		#  restart at correct place	 insv	r7,$cvtpl_v_state,$cvtpl_s_state,cvtpl_b_state(sp)	movl	r6,cvtpl_l_result(sp)		# save intermediate result # at this point, all intermediate state has been preserved in the register # array on the stack. we now restore the registers that were saved on entry  # to vax$cvtpl and pass control to vax$reflect_fault where further exception # dispatching takes place.	movq	(r0)+,r4		# restore r4 and r6	movq	(r0)+,r6		# ... and r6 and r7	movl	(r0)+,r10		# ... and r10 #	movl	#<cvtpl_b_delta_pc!-	# indicate offset for delta pc #		pack_m_fpd!-		# fpd bit should be set #		pack_m_accvio>,r1	# this is an access violation	 movl	$(cvtpl_b_delta_pc|pack_m_fpd|pack_m_accvio),r1	jmp	vax$reflect_fault	# continue exception handling #	end_mark_point	cvtpl_m_state #+ # functional description: # #	this routine receives control when a cvtpl instruction is restarted.  #	the instruction state (stack and general registers) is restored to the  #	state that it was in when the instruction (routine) was interrupted and  #	control is passed to the pc at which the exception occurred. # # input parameters: # #	 31		  23		   15		   07		 00 #	+----------------+----------------+---------------+----------------+ #	|   delta-pc	 |    state	  |            strlen		   | #	+----------------+----------------+---------------+----------------+ #	|			     srcaddr				   | #	+----------------+----------------+---------------+----------------+ #	|			     result				   | #	+----------------+----------------+---------------+----------------+ #	|			        dst				   | #	+----------------+----------------+---------------+----------------+ # #	depending on where the exception occurred, some of these parameters  #	may not be relevant. they are nevertheless stored as if they were  #	valid to make this restart code as simple as possible. # #	r0<04:00> - remaining digit/byte count in source string #	r0<07:05> - spare #	r0<15:08> - "srcaddr" difference (current - initial) #	r0<19:16> - saved condition codes #	r0<22:20> - restart code (identifies point where routine will resume) #	r0<23>	  - internal FPD flag #      r0<31:24> - size of instruction in instruction stream ( delta pc ) #	r1	  - address of current byte in source string #	r2	  - value of intermediate or final result #	r3	  - address of destination ( unchanged from input value of r3 ) # #	00(sp) - return pc from vax$cvtpl routine # # implicit input: # #	note that the initial "srclen" is checked for legality before any #	restartable exception can occur. this means that r0 lequ 31, which #	leaves bits <15:5> free for storing intermediate state. in the case of #	an access violation, r0<15:8> is used to store the difference between #	the original and current addresses in the source string.  # # output parameters: # #	r0  - updated digit or byte count in source string #	r2  - condition codes reflecting result #	r3  - address of destination (unchanged from input value) #	r6  - intermediate (or final) longword result #	r10 - address of cvtpl_accvio, this module's "condition handler" # #	if the instruction was interrupted at mark point 6, the stack and r1 #	contain different values than they do if the instruction was interrupted #	at any of the intermediate restart points. # #	access violation occurred at restart points 1 through 5 # #		r1 - address of current byte in source string # #		00(sp) - original value of r1 (scraddr) #		04(sp) - saved r4 #		08(sp) - saved r5 #		12(sp) - saved r6 #		16(sp) - saved r7 #		20(sp) - saved r10 #		24(sp) - return pc from vax$cvtpl routine # #	access violation occurred at restart points 1 through 5 # #		r1 - address of most significant byte in source string  #			(original srcaddr) # #		00(sp) - zero (will be restored to r2) #		04(sp) - zero (will be restored to r3) #		08(sp) - saved r4 #		12(sp) - saved r5 #		16(sp) - saved r6 #		20(sp) - saved r7 #		24(sp) - saved r10 #		28(sp) - return pc from vax$cvtpl routine # # implicit output: # #	r4, r5, and r7 are used as scratch registers #-		.globl	vax$cvtpl_restartvax$cvtpl_restart: #	pushr	#^m<r0,r1,r4,r5,r6,r7,r10>	# save some registers	 pushr	$0x04f3 #	establish_handler	cvtpl_accvio	# reload r10 with handler address	 movab	cvtpl_accvio,r10 # make sure that the cvtpl_b_state byte is now on the stack (in r0 or r1) #	assume cvtpl_b_state le 7	extzv	$cvtpl_v_state,$cvtpl_s_state,cvtpl_b_state(sp),r4						# put restart code into r4 # the next two instructions reconstruct the initial value of "srcaddr" that # is stored on the stack just above the saved r4. this value will be loaded # into r1 when the instruction completes execution. 	movzbl	cvtpl_b_delta_srcaddr(sp),r5	# get the difference	subl2	r5,cvtpl_a_srcaddr(sp)		# recreate the original r1	movzbl	r0,r0				# clear out r0<31:8> # make sure that the intermediate result is stored in r2 #	assume cvtpl_l_result eq 8	movl	r2,r6	movpsl	r2				# get clean copy of psl #	extzv	#cvtpl_v_saved_psw,-		# retrieve saved copy of #		#cvtpl_s_saved_psw,-		#  condition codes #		cvtpl_b_state(sp),r5	 extzv	$cvtpl_v_saved_psw,$cvtpl_s_saved_psw,cvtpl_b_state(sp),r5	bicb2	$(psl$m_n|psl$m_z|psl$m_v|psl$m_c),r2	# clear condition codes	bisb2	r5,r2				# restore saved codes to r2 # a check is made to determine whether the access violation occurred at  # restart point number 6, where the stack is slightly different from its # state at the other exception points.	addl2	$4,sp			# discard saved r0 place holder	cmpl	r4,$cvtpl_6_restart	# check for restart at the bitter end	blssu	1f			# branch if somewhere else	movl	(sp)+,r1		# restore saved " current" r1	clrq	-(sp)			# store final values of r2 and r31:	movzwl	restart_pc_table_base-2[r4],r4	# convert code to pc offset	jmp	module_base[r4]		# get back to work #	end_mark_point		cvtpl_m_statemodule_end:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -