📄 vaxfloat.s
字号:
/* @(#)vaxfloat.s 4.1 7/2/90 */# include "../machine/emul/vaxemul.h"# include "../machine/psl.h"# include "../machine/emul/vaxregdef.h"/************************************************************************ * * * Copyright (c) 1984 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************//************************************************************************ * * Modification History * * jaw, 12-jun-89 * fix branch in iteration of polyf...also pick up fix for extra * percision in poly{fdg}. * * Stephen Reilly, 05-Dec-84 * 003- Fixed typo that made floating operations work incorrectly. * * Stephen Reilly, 28-Aug-84 * 002- The polyf routine failed to clear r1. I received this bug * from Jeff Wiener on 21-Aug-1984. * * Stephen Reilly, 28-Aug-84 * 001- Corrected a BBS instruction in MULTIPLY__FFLOAT. It has referred * to FRACTION+8(FP). It should have been FRACTION+12(FP). I * received this fix from Jeff Wiener. The date he fixed it was * 10-Aug-1984. * * Stephen Reilly, 20-Mar-84 * 000- This code is the modification of the VMS emulation codethat * was written by Derek Zave. It has been modified to run * on Ultrix. * ***********************************************************************/ #++ # facility: vms executive floating point emulation # # abstract: # # loadable code that emulates f, d, g and h floating instructions on # any processor. octaword integer emulation is included. # # environment: runs at any access mode, ast reentrant # # author: steven b. lionel, 22-march-1983 # # emulation code based on lib$emulate by derek zave. # # modified by: # # LJK0025 Lawrence J. Kenah 8-Mar-1984 # Change PRVMOD field in PSL that is in effect while emulator is # executing so that PROBEs work with correct access mode when the # emulator is used in exec or supervisor mode. Fix incorrect # register usage in READ_FAULT. # # LJK0015 Lawrence J. Kenah 2-Feb-1984 # Fix error destinations for inaccessible instruction stream or # exception stack. Use G^ addressing for SYS.STB symbols. # # JCW1005 Jeffrey C. Wiener 11-January-1984 # Corrected the discription of the algorithm used to divide unsigned # multiple length integers. A fix was also added to the associated # code to fix an outstanding DIVG/DIVH bug. The fix checks a "carry- # over". If the "carry-over" is negative, then the "carry-over" is # zeroed. # # sbl1002 steven b. lionel 23-may-1983 # add check for no p1 region. # # sbl1001 steven b. lionel 22-march-1983 # adapt lib$emulate for integration into the vms executive. #-- # # macros: # # macro for comparing condition codes # .macro cmpcond cond,loc # cmpzv #3,#26,loc,#cond@-3 # .endm # macro for loading op_types with the types of the various operands, # .macro set_op_types op1=f,op2=f,op3=f,op4=f,op5=f,op6=f # .narg n_args # .if eq n_args-6 # 6 arguments? # movw #<typ_'op5'+<typ_'op6'@8>>, op_types4(fp) # .ndc # .if eq n_args-5 # 5 arguments? # movb #<typ_'op5'>, op_types4(fp) # .endc # .if gt n_args-2 # more than 2 arguments? # movl #<typ_'op1'+ - # <typ_'op2'@8>+ - # <typ_'op3'@16>+ - # <typ_'op4'@24>>, op_types(fp) # .endc # .if eq n_args-2 # 2 arguments? # movw #<typ_'op1'+<typ_'op2'@8>>, op_types(fp) # .endc # .if eq n_args-1 # 1 argument? # movb #typ_'op1', op_types(fp) # .endc # .endm # # equated symbols: # # see body of routine # # own storage: # # none # # **************************************************************** # * * # * * # * assorted definitions * # * * # * * # **************************************************************** # # # # parameters ## define call_args 40 # flexible stack space (longwords) # # opcode range limits ## define lo_1byte 0x40# define hi_1byte 0x76# define lo_2byte 0x32# define hi_2byte 0xff # # operand area layout ## define zero 0 # zero indicator (byte)# define sign 1 # sign indicator (byte)# define power 4 # exponent (longword)# define fraction 8 # fraction area (octaword)# define operand_size 24 # operand area size (bytes) # # bits in the processor status longword (psl) ## define psl_c 0 # carry indicator# define psl_v 1 # overflow indicator# define psl_z 2 # zero indicator# define psl_n 3 # negative indicator# define psl_t 4 # trace enable indicator# define psl_iv 5 # integer overflow trap enable# define psl_fu 6 # floating underflow fault enable# define psl_cam 24 # low bit of current access mode# define psl_fpd 27 # instruction first part done# define psl_tp 30 # trace pending indicator # # masks for the processor status longword ## define pslm_c 1<<psl_c # carry indicator# define pslm_v 1<<psl_v # overflow indicator# define pslm_z 1<<psl_z # zero indicator# define pslm_n 1<<psl_n # negative indicator# define pslm_vc pslm_v + pslm_c # overflow and carry indicators# define pslm_nzvc pslm_vc + pslm_n+pslm_z # condition code# define pslm_nz pslm_n + pslm_z # comparison codes# define pslm_nzv pslm_nz + pslm_v # bits other than carry# define pslm_lss pslm_n # less than condition code# define pslm_eql pslm_z # equals condition code# define pslm_gtr 0 # greater than condition code # # call frame layout ## define handler 0 # condition handler location# define save_psw 4 # saved processor status word# define save_mask 6 # register save mask# define mask_align 14 # bit position of alignment bits# define save_ap 8 # user's argument pointer# define save_fp 12 # user's frame pointer# define save_pc 16 # return point# define reg_r0 20 # user's r0# define reg_r1 24 # user's r1# define reg_r2 28 # user's r2# define reg_r3 32 # user's r3# define reg_r4 36 # user's r4# define reg_r5 40 # user's r5# define reg_r6 44 # user's r6# define reg_r7 48 # user's r7# define reg_r8 52 # user's r8# define reg_r9 56 # user's r9# define reg_r10 60 # user's r10# define reg_r11 64 # user's r11# define frame_end 68 # end of call frame # # call frame extension layout ## define reg_ap 68 # user's ap# define reg_fp 72 # user's fp# define reg_sp 76 # user's sp# define reg_pc 80 # user's pc# define psl 84 # user's psl# define local_end 88 # end of emulator local storage# define temp 88 # temporary area for arithmetic # # local storage layout ## define save_align -1 # saved copy of alignment bits# define save_parcnt -2 # saved copy of parameter count# define mode -3 # access mode for probes# define flags -4 # indicator flag bits# define short_local -5 # start of short local storage# define regmod_pc -6 # changes to user's pc# define regmod_sp -7 # changes to user's sp# define regmod_fp -8 # changes to user's fp# define regmod_ap -9 # changes to user's ap# define regmod_r11 -10 # changes to user's r11# define regmod_r10 -11 # changes to user's r10# define regmod_r9 -12 # changes to user's r9# define regmod_r8 -13 # changes to user's r8# define regmod_r7 -14 # changes to user's r7# define regmod_r6 -15 # changes to user's r6# define regmod_r5 -16 # changes to user's r5# define regmod_r4 -17 # changes to user's r4# define regmod_r3 -18 # changes to user's r3# define regmod_r2 -19 # changes to user's r2# define regmod_r1 -20 # changes to user's r1# define regmod_r0 -21 # changes to user's r0# define address1 -25 # temporary address area #1# define address2 -29 # temporary address area #2# define address3 -33 # temporary address area #3# define operand1 address3 - operand_size # temporary operand area #1# define operand2 operand1 - operand_size # temporary operand area #2# define operand3 operand2 - operand_size # temporary operand area #3# define op_types4 operand3 - 4 # four bytes for operand type codes# define op_types op_types4 - 4 # four more bytes for operand type codes# define op_index op_types - 4#define poly_x_flag op_index-1 # pointer to current byte of op_types# define local_start poly_x_flag # op_index start of emulator local storage # # indicator bit numbers # # define flag0 0 # inhibit local store check# define flag1 1 # register mode operand# define flag2 2 # (not assigned)# define flag3 3 # (not assigned)# define flag4 4 # (not assigned)# define flag5 5 # (not assigned)# define flag6 6 # (not assigned)# define flag7 7 # temporary use # # indicator bit masks ## define flag0m 1<<0 # inhibit local store check# define flag1m 1<<1 # register mode operand# define flag2m 1<<2 # (not assigned)# define flag3m 1<<3 # (not assigned)# define flag4m 1<<4 # (not assigned)# define flag5m 1<<5 # (not assigned)# define flag6m 1<<6 # (not assigned)# define flag7m 1<<7 # temporary use # # fields in the operand areas ## define zero1 operand1 + zero # zero flag of operand1# define zero2 operand2 + zero # zero flag of operand2# define zero3 operand3 + zero # zero flag of operand3# define sign1 operand1 + sign # sign of operand1# define sign2 operand2 + sign # sign of operand2# define sign3 operand3 + sign # sign of operand3# define power1 operand1 + power # exponent of operand1# define power2 operand2 + power # exponent of operand2# define power3 operand3 + power # exponent of operand3# define fraction1 operand1 + fraction # fraction of operand1# define fraction2 operand2 + fraction # fraction of operand2# define fraction3 operand3 + fraction # fraction of operand3 # # access type code definitions ## define type_read 1 # read only access# define type_write 2 # write only access# define type_modify 3 # modify access# define type_address 4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -