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

📄 vaxashp.s

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 S
📖 第 1 页 / 共 4 页
字号:
 # zero (unless the v-bit is also set). note that in the case of overflow, # the n-bit is cleared but the output string retrins the minus sign.        bbc     $psl$v_n,r11,L290       # n-bit is off already        bicb2   $psl$m_n,r11            # turn off saved n-bit unconditionally        bbs     $psl$v_v,r11,L290       # no fixup if v-bit is also set         movb    $12,r9                  # use preferred plus as sign of output        brb     L290                    # ... and rejoin the exit code # the following instruction is the exit point for all of the nonzero byte # checks. its direct effect is to clear the saved z-bit. it also bypasses # whatever other zero checks have not yet been performed.L287:   bicb2    $psl$m_z,r11            # clear saved z-bit # the following code executes in all cases. it is the common exit path for # all of the ashp routines when the count is even.L290:   movq    (sp)+,r2                # get address of end of output string #	mark_point	ashp_0	 .text	2	 .set	table_size,table_size + 1	 .word	Lashp_0 - module_base	 .text	3	 .word	ashp_0 - module_base	 .textLashp_0:        insv    r9,$0,$4,-1(r3)         # store sign that we have been saving #+ # this is the common exit path for many of the routines in this module. this # exit path can only be used for instructions that conform to the following # restrictions. # # 1.  registers r0 through r11 were saved on entry. # # 2.  the architecture requires that r0 and r2 are zero on exit. # # 3.  all other registers that have instruction-specific values on exit are  #     correctly stored in the appropriate locations on the stack. # # 4.  the saved psw is contained in r11 # # 5.  this instruction/routine should generate a decimal overflow trap if  #     both the v-bit and the dv-bit are set on exit. #-	.globl	vax$decimal_exitvax$decimal_exit:        clrl    (sp)                    # r0 must be zero on exit        clrl    8(sp)                   # r2 must also be zero        bbs     $psl$v_v,r11,L320       # see if exceptions are enabledL310:   bicpsw  $( psl$m_n | psl$m_z | psl$m_v | psl$m_c )      					# clear condition codes        bispsw  r11                     # set appropriate condition codes #      popr    $^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>      # restore 	 popr	$0x0fff        rsb                             # ... and return                 # if the v-bit is set and decimal traps are enabled (dv-bit is set), then # a decimal overflow trap is generated. note that the dv-bit can be set in # the current psl or, if this routine was entered as the result of an emulated # instruction exception, in the saved psl on the stack. note that the final # condition codes in the psw have not yet been set. this means that all exit # pathe out of this code must set the condition codes to their correct values.	.globl	vax$editpc_overflowvax$editpc_overflow:L320:   bbs     $psl$v_dv,r11,L330       # report exception if current dv-bit set        movab   vax$exit_emulator,r0    # set up r0 for pic address comparison        cmpl    r0,(4*12)(sp)           # is return pc eqlu vax$exit_emulator ?        bnequ   L310                    # no. simply return v-bit set        bbc     $psl$v_dv,((4*(12+1))+exception_psl)(sp),L310                                        # only return v-bit if dv-bit is clear # restore all of the saved registers, reset the condition codes, and drop  # into decimal_overflow.L330:   bicpsw  $( psl$m_n | psl$m_z | psl$m_v | psl$m_c )      					# clear condition codes        bispsw  r11                     # set appropriate condition codes #      popr    $^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>	 popr	$0x0fff #+ # this code path is entered if the decimal string result is too large to # fit into the output string and decimal overflow exceptions are enabled. # the final state of the instruction, including the condition codes, is # entirely in place. # # input parameter: # #       (sp) - return pc # # output parameters: # #       0(sp) - srm$k_dec_ovf_t (arithmetic trap code) #       4(sp) - final state psl #       8(sp) - return pc # # implicit output: # #       control passes through this code to vax$reflect_trap. #-	.globl	vax$decimal_overflowvax$decimal_overflow:        movpsl  -(sp)                   # save final psl on stack        pushl   $srm$k_dec_ovf_t        # store arithmetic trap code        jmp     vax$reflect_trap        # report exception #+ # functional description: # #       for certain cases (three out of four), it is necessary to put the #       source string in a work area so that later portions of vax$ashp can #       proceed in a straightforward manner. in one case (positive even shift #       count), the sign must be eliminated before the least significant #       byte of the source is moved to its appropriate place (not the least #       significant byte) in the destination string. for odd shift counts, #       the source string in the work area is shifted by one to reduce the #       complicated case of an odd shift count to an equivalent but simpler #       case with an even shift count. # #       this routine moves the source string to a 20-byte work area already #       allocated on the stack. note that the work area is zeroed by this #       routine so that, if the work area is used, it consists of either #       valid bytes from the source string or bytes containing zero. if the #       work area is not needed (shift count is even and not positive), the #       overhead of zeroing the work area is avoided.  # # input parameters: # #       r0 - byte count of source string (preserved) #       r1 - address of most significant byte in source string #       r8 - address one byte beyond end of work area (preserved) # # output parameters: # #       r1 - address of most significant byte of source string in #            work area # # side effects: # #       r6 and r7 are modified by this routine. #-ashp_copy_source:        clrq    -8(r8)                  # insure that the work area         clrq    -16(r8)                 # ... is entirely filled        clrl    -20(r8)                 # ... with zeros        addl3   r0,r1,r7                # r7 points one byte beyond source        movl    r8,r1                   # r1 will step through work area        movl    r0,r6                   # use r6 as the loop counter #	mark_point	ashp_bsbw_20	 .text	2	 .set	table_size,table_size + 1	 .word	Lashp_bsbw_20 - module_base	 .text	3	 .word	ashp_bsbw_20 - module_base	 .textLashp_bsbw_20:1:      movb    -(r7),-(r1)             # move the next source byte        sobgtr  r6,1b                  # check for end of loop        rsb                             # return with r1 properly loaded #- # functional description: # #       this routine receives control when a digit count larger than 31 is #       detected. the exception is architecturally defined as an abort so #       there is no need to store intermediate state. the vax$ashp routine #       saves all registers r0 through r11 before performing the digit check. #       these registers must be restored before control is passed to #       vax$roprand.  # # input parameters: # #       00(sp) - saved r0 #         . #         . #       44(sp) - saved r11 #       48(sp) - return pc from vax$xxxxxx routine # # output parameters: # #       00(sp) - offset in packed register array to delta pc byte #       04(sp) - return pc from vax$xxxxxx routine # # implicit output: # #       this routine passes control to vax$roprand where further #       exception processing takes place. #-decimal_roprand: #      popr    $^m<r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>	 popr	$0x0fff        pushl   $ashp_b_delta_pc        # store offset to delta pc byte        jmp     vax$roprand             # pass control along #+ #	the general approach to handling access violations that occur while #	emulating the packed decimal instructions is described here. we take #	advantage of the fact that there are no architectural constraints on #	the way that access violations must be handled. in general, we back #	the instruction up to the beginning, to the point where initial state #	is stored in the set of general registers modified by each #	instruction. thus, the only step that is avoided when an instruction #	is restarted is operand evaluation.  # # functional description: # #	this routine (or its counterpart in other decimal emulation modules) #	receives control when an access violation occurs while executing #	within one of the vax$xxxxxx routines that emulated a decimal string #	instruction. this routine determines whether the exception occurred #	while accessing a source or destination string or whether the access #	violation is peculiar to emulation, such as stack overflow. (this #	check is made based on the pc of the exception.)  # #	if the pc is one that is recognized by this routine, then the state of #	the instruction (digit counts, string addresses, and the like) are #	restored to a state where the instruction/routine can be restarted #	after (if) the cause for the exception is eliminated. control is then #	passed to a common routine that sets up the stack and the exception #	parameters in such a way that the instruction or routine can restart #	transparently.  # #	if the exception occurs at some unrecognized pc, then the exception is #	reflected to the user as an exception that occurred within the #	emulator.  # #	there are two exceptions that can occur that are not backed up to #	appear as if they occurred at the site of the original emulated #	instruction. these exceptions will appear to the user as if they #	occurred inside the emulator itself.  # #	    1.	if stack overflow occurs due to use of the stack by one of  #		the routines, it is unlikely that this routine will even #		execute because the code that transfers control here must #		first copy the parameters to the exception stack and that #		operation would fail. (the failure causes control to be #		transferred to vms, where the stack expansion logic is #		invoked and the routine resumed transparently.)  # #	    2.	if assumptions about the address space change out from under  #		these routines (because an ast deleted a portion of the  #		address space or a similar silly thing), the handling of the  #		exception is unpredictable. # # input parameters: # #	r0  - value of sp when exception occurred #	r1  - pc at which exception occurred #	r2  - scratch #	r3  - scratch #	r10 - address of this routine (no longer needed) # #	00(sp) - value of r0 when exception occurred #	04(sp) - value of r1 when exception occurred #	08(sp) - value of r2 when exception occurred #	12(sp) - value of r3 when exception occurred #	16(sp) - return pc in exception dispatcher in operating system # #	20(sp) - first longword of system-specific exception data #	  . #	  . #	xx(sp) - last longword of system-specific exception data # #	the address of the next longword is the position of the stack when #	the exception occurred. r0 locates this address. # # r0 ->	xx+4(sp)     - instruction-specific data #	  .	     - optional instruction-specific data #	  .          - optional instruction-specific data #	xx+<4*m>(sp) - return pc from vax$xxxxxx routine (m is the number #		       of instruction-specific longwords) # # implicit input: # #	it is assumed that the contents of all registers coming into this #	routine are unchanged from their contents when the exception occurred. #	(for r0 through r3, this assumption applies to the saved register #	contents on the top of the stack. any modification to these four #	registers must be made to their saved copies and not to the registers #	themselves.)  # #	finally, the macro begin_mark_point should have been invoked at the #	beginning of this module to define the symbols  # #		module_base #		pc_table_base #		handler_table_base #		table_size # #	pc_table_base is the base of a word array with one entry for each  #		pc (relative to module_base) that can cause an access  #		violation that is capable of being backed up. # #	handler_table_base is the base of a corresponding word array with an #		entry that locates the context specific code to handle each

⌨️ 快捷键说明

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