📄 vaxcvtlp.s
字号:
.word cvtlp_7 - module_base .text 1 .set restart_table_size,restart_table_size+1 .set cvtlp_7_restart,restart_table_size .word Lcvtlp_7 - module_base .textLcvtlp_7: movb r5,-(r3) # store in last output byte beql 9f # leave z-bit alone if zero bicb2 $psl$m_z,r119: tstl r0 # is source also all used up? beql 7b # yes, continue with exit processing # an overflow has occurred. if the z-bit is still set, then the n-bit is cleared. # note that, because all negative zero situations occur simultaneously with # overflow, the output sign is left as minus. 0: clrl r0 # r0 must be zero on exit bbc $psl$v_z,r11,L110 # z-bit and n-bit cannot both be set bicb2 $psl$m_n,r11 # clear n-bit if z-bit still setL110: bisb2 $psl$m_v,r11 # set v-bit in saved psw # 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. bbs $psl$v_dv,r11,L120 # report exception if current dv-bit set movab vax$exit_emulator,r4 # set up r4 for pic address comparison cmpl r4,(4*4)(sp) # is return pc eqlu vax$exit_emulator ? bnequ 7b # no. simply return v-bit set bbc $psl$v_dv,((4*(4+1))+exception_psl)(sp),7b # only return v-bit if dv-bit is clear # restore the saved registers and transfer control to decimal_overflowL120: clrq r1 # comform to architecture bicpsw $(psl$m_n|psl$m_z|psl$m_v|psl$m_c) # clear condition codes bispsw r11 # set appropriate condition codes # popr $^m<r4,r5,r10,r11> # restore registers, preserving psw popr $0x0c30 jmp vax$decimal_overflow # report overflow exception #- # 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 digit # count is made after registers are saved. these registers must be # restored before reporting the exception. # # input parameters: # # 00(sp) - saved r4 # 04(sp) - saved r5 # 08(sp) - saved r10 # 12(sp) - saved r11 # 16(sp) - return pc from vax$cvtlp routine # # output parameters: # # 00(sp) - offset in packed register array to delta pc byte # 04(sp) - return pc from vax$cvtlp routine # # implicit output: # # this routine passes control to vax$roprand where further # exception processing takes place. #-decimal_roprand: # popr $^m<r4,r5,r10,r11> # restore registers popr $0x0c30 pushl $cvtlp_b_delta_pc # store offset to delta pc byte jmp vax$roprand # pass control along # #+ # functional description: # # this routine receives control when an access violation occurs while # executing within the vax$cvtlp emulator routine. # # the routine header for ashp_accvio in module vax$ashp contains a # detailed description of access violation handling for the decimal # string instructions. this routine differs from most decimal # instruction emulation routines in that it preserves intermediate # results if an access violation occurs. this is accomplished by # storing the number of the exception point, as well as intermediate # arithmetic results, in the registers r0 through r3. # # input parameters: # # see routine ashp_accvio in module vax$ashp # # output parameters: # # see routine ashp_accvio in module vax$ashp #-cvtlp_accvio: clrl r2 # initialize the counter pushab module_base # store base address of this module 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(r0) - saved r4 on entry to vax$cvtlp # 04(r0) - saved r5 # 08(r0) - saved r10 # 12(r0) - saved r11 # 16(r0) - return pc from vax$cvtlp routine # # 00(sp) - saved r0 (restored by vax$handler) # 04(sp) - saved r1 # 08(sp) - saved r2 # 12(sp) - saved r3 # # output parameters: # # r0 - address of return pc from vax$cvtlp # 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 cvtlp_restart for a description of the # contents of the packed register array. # # implicit output: # # r4, r5, r10, and r11 are restored to the values that they had # when vax$cvtlp was entered. #- #+ # cvtlp_1 or cvtlp_2 # # an access violation occurred while storing the initial sign in the output # string. r1, r4, and r5 contain junk at this point. # # r0 - input source longword # r2 - digit count of destination string # r3 - address of sign byte in destination string # r11 - current psw (with z-bit set and all others clear) # # r1 - not important # r4 - scratch but saved anyway # r5 - scratch but saved anyway #-cvtlp_1: # movb #<cvtlp_1_restart!- # store code that locates exception pc # cvtlp_m_fpd>,- # cvtlp_b_state(sp) movb $(cvtlp_1_restart|cvtlp_m_fpd),cvtlp_b_state(sp) brb 1f # join common codecvtlp_2: # movb #<cvtlp_2_restart!- # store code that locates exception pc # cvtlp_m_fpd>,- # cvtlp_b_state(sp) movb $(cvtlp_2_restart|cvtlp_m_fpd),cvtlp_b_state(sp) brb 1f # join common code #+ # cvtlp_3 through cvtlp_7 # # an access violation occurred while storing a digit or digit pair in the # output string. # # r0 - input source longword (updated) # r1 - zero (so that r0/r1 can be used as input quadword to ediv) # r2 - digit count of destination string # r3 - address of current byte in destination string # r4 - updated digit or byte count # r5 - most recent remainder from ediv # r11 - current psw (condition codes reflect results so far) #-cvtlp_3: # movb #<cvtlp_3_restart!- # store code that locates exception pc # cvtlp_m_fpd>,- # cvtlp_b_state(sp) movb $(cvtlp_3_restart|cvtlp_m_fpd),cvtlp_b_state(sp) brb 1f # join common codecvtlp_4: # movb #<cvtlp_4_restart!- # store code that locates exception pc # cvtlp_m_fpd>,- # cvtlp_b_state(sp) movb $(cvtlp_4_restart|cvtlp_m_fpd),cvtlp_b_state(sp) brb 1f # join common codecvtlp_5: # movb #<cvtlp_5_restart!- # store code that locates exception pc # cvtlp_m_fpd>,- # cvtlp_b_state(sp) movb $(cvtlp_5_restart|cvtlp_m_fpd),cvtlp_b_state(sp) brb 1f # join common codecvtlp_6: # movb #<cvtlp_6_restart!- # store code that locates exception pc # cvtlp_m_fpd>,- # cvtlp_b_state(sp) movb $(cvtlp_6_restart|cvtlp_m_fpd),cvtlp_b_state(sp) brb 1f # join common codecvtlp_7: # movb #<cvtlp_7_restart!- # store code that locates exception pc # cvtlp_m_fpd>,- # cvtlp_b_state(sp) movb $(cvtlp_7_restart|cvtlp_m_fpd),cvtlp_b_state(sp)1: movb r4,cvtlp_b_saved_r4(sp) # store current digit/byte count movb r5,cvtlp_b_saved_r5(sp) # store latest ediv remainder movb r11,cvtlp_b_saved_psw(sp) # store current condition codes # 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$cvtlp and pass control to vax$reflect_fault where further exception # dispatching takes place. movq (r0)+,r4 # restore r4 and r5 movq (r0)+,r10 # ... and r10 and r11 # movl #<cvtlp_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 $(cvtlp_b_delta_pc|pack_m_fpd|pack_m_accvio),r1 jmp vax$reflect_fault # continue exception handling #+ # functional description: # # this routine receives control when a cvtlp 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 # +----------------+----------------+----------------+----------------+ # | state | saved_psw | saved_r5 | saved_r4 | # +----------------+----------------+----------------+----------------+ # | delta-pc | XXXX | dstlen | # +----------------+----------------+----------------+----------------+ # | dstaddr | # +----------------+----------------+----------------+----------------+ # # 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 - updated source longword # r1<07:00> - latest digit or byte count (loaded into r4) # r1<15:08> - most recent remainder from ediv (loaded into r5) # r1<23:16> - saved condition codes (loaded into r11) # r1<26:24> - restart code (identifies point where routine will resume) # r1<27> - Internal FPD flag # r2<15:00> - initial value of "dstlen" # r2<23:16> - spare # r2<31:24> - Size of instruction in instruction stream # r3 - address of current byte in destination string # # 00(sp) - return pc from vax$cvtlp routine # # output parameters: # # r0 - updated source longword (unchanged from input) # r1 - scratch # r2 - initial value of "dstlen" # r3 - address of current byte in output string (unchanged from input) # r4 - latest digit or byte count # r5 - most recent remainder from ediv # r10 - address of cvtlp_accvio, this module's "condition handler" # r11 - condition codes # # 00(sp) - saved r4 # 04(sp) - saved r5 # 08(sp) - saved r10 # 12(sp) - saved r11 # 16(sp) - return pc from vax$cvtlp routine # # implicit output: # # control is passed to the instruction that was executing when the # access violation occurred. #- .globl vax$cvtlp_restartvax$cvtlp_restart: # pushr #^m<r0,r1,r4,r5,r10,r11> # save some registers pushr $0x0c33 # establish_handler cvtlp_accvio # reload r10 with handler address movab cvtlp_accvio,r10 extzv $cvtlp_v_state,$cvtlp_s_state,cvtlp_b_state(sp),r1 # put restart code into r1 movzbl cvtlp_b_saved_r4(sp),r4 # restore digit/byte count movzbl cvtlp_b_saved_r5(sp),r5 # restore latest ediv remainder movzbl cvtlp_b_saved_psw(sp),r11 # restore condition codes movzbl r2,r2 # clear out r2<31:8> addl2 $8,sp # discard saved r0 and r1 movzwl restart_pc_table_base-2[r1],r1 # convert code to pc offset # in order to get back to the restart point with r1 containing zero, we cannot # use r1 to transfer control as we did in other routines like vax$cvtpl. pushab module_base[r1] # store "return pc" clrl r1 # restart with r1 set to zero rsb # get back to work # end_mark_point cvtlp_m_statemodule_end:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -