File indexing completed on 2025-05-11 08:23:49
0001 #include "fpsp-namespace.h"
0002 //
0003 //
0004 // x_unsupp.sa 3.3 7/1/91
0005 //
0006 // fpsp_unsupp --- FPSP handler for unsupported data type exception
0007 //
0008 // Trap vector #55 (See table 8-1 Mc68030 User's manual).
0009 // Invoked when the user program encounters a data format (packed) that
0010 // hardware does not support or a data type (denormalized numbers or un-
0011 // normalized numbers).
0012 // Normalizes denorms and unnorms, unpacks packed numbers then stores
0013 // them back into the machine to let the 040 finish the operation.
0014 //
0015 // Unsupp calls two routines:
0016 // 1. get_op - gets the operand(s)
0017 // 2. res_func - restore the function back into the 040 or
0018 // if fmove.p fpm,<ea> then pack source (fpm)
0019 // and store in users memory <ea>.
0020 //
0021 // Input: Long fsave stack frame
0022 //
0023 //
0024
0025 // Copyright (C) Motorola, Inc. 1990
0026 // All Rights Reserved
0027 //
0028 // THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
0029 // The copyright notice above does not evidence any
0030 // actual or intended publication of such source code.
0031
0032 X_UNSUPP: //idnt 2,1 | Motorola 040 Floating Point Software Package
0033
0034 |section 8
0035
0036 #include "fpsp.defs"
0037
0038 |xref get_op
0039 |xref res_func
0040 |xref gen_except
0041 |xref fpsp_fmt_error
0042
0043 .global fpsp_unsupp
0044 fpsp_unsupp:
0045 //
0046 link %a6,#-LOCAL_SIZE
0047 fsave -(%a7)
0048 moveml %d0-%d1/%a0-%a1,USER_DA(%a6)
0049 fmovemx %fp0-%fp3,USER_FP0(%a6)
0050 fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
0051
0052
0053 moveb (%a7),VER_TMP(%a6) //save version number
0054 moveb (%a7),%d0 //test for valid version num
0055 andib #0xf0,%d0 //test for $4x
0056 cmpib #VER_4,%d0 //must be $4x or exit
0057 bnel fpsp_fmt_error
0058
0059 fmovel #0,%FPSR //clear all user status bits
0060 fmovel #0,%FPCR //clear all user control bits
0061 //
0062 // The following lines are used to ensure that the FPSR
0063 // exception byte and condition codes are clear before proceeding,
0064 // except in the case of fmove, which leaves the cc's intact.
0065 //
0066 unsupp_con:
0067 movel USER_FPSR(%a6),%d1
0068 btst #5,CMDREG1B(%a6) //looking for fmove out
0069 bne fmove_con
0070 andl #0xFF00FF,%d1 //clear all but aexcs and qbyte
0071 bras end_fix
0072 fmove_con:
0073 andl #0x0FFF40FF,%d1 //clear all but cc's, snan bit, aexcs, and qbyte
0074 end_fix:
0075 movel %d1,USER_FPSR(%a6)
0076
0077 st UFLG_TMP(%a6) //set flag for unsupp data
0078
0079 bsrl get_op //everything okay, go get operand(s)
0080 bsrl res_func //fix up stack frame so can restore it
0081 clrl -(%a7)
0082 moveb VER_TMP(%a6),(%a7) //move idle fmt word to top of stack
0083 bral gen_except
0084 //
0085 |end