^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) | x_unsupp.sa 3.3 7/1/91
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) | fpsp_unsupp --- FPSP handler for unsupported data type exception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) | Trap vector #55 (See table 8-1 Mc68030 User's manual).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) | Invoked when the user program encounters a data format (packed) that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) | hardware does not support or a data type (denormalized numbers or un-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) | normalized numbers).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) | Normalizes denorms and unnorms, unpacks packed numbers then stores
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) | them back into the machine to let the 040 finish the operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) | Unsupp calls two routines:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) | 1. get_op - gets the operand(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) | 2. res_func - restore the function back into the 040 or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) | if fmove.p fpm,<ea> then pack source (fpm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) | and store in users memory <ea>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) | Input: Long fsave stack frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) | Copyright (C) Motorola, Inc. 1990
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) | All Rights Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) | For details on the license for this file, please see the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) | file, README, in this same directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) X_UNSUPP: |idnt 2,1 | Motorola 040 Floating Point Software Package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) |section 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include "fpsp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) |xref get_op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) |xref res_func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) |xref gen_except
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) |xref fpsp_fmt_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) .global fpsp_unsupp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) fpsp_unsupp:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) link %a6,#-LOCAL_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) fsave -(%a7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) moveml %d0-%d1/%a0-%a1,USER_DA(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) fmovemx %fp0-%fp3,USER_FP0(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) moveb (%a7),VER_TMP(%a6) |save version number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) moveb (%a7),%d0 |test for valid version num
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) andib #0xf0,%d0 |test for $4x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) cmpib #VER_4,%d0 |must be $4x or exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) bnel fpsp_fmt_error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) fmovel #0,%FPSR |clear all user status bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) fmovel #0,%FPCR |clear all user control bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) | The following lines are used to ensure that the FPSR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) | exception byte and condition codes are clear before proceeding,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) | except in the case of fmove, which leaves the cc's intact.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) unsupp_con:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) movel USER_FPSR(%a6),%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) btst #5,CMDREG1B(%a6) |looking for fmove out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) bne fmove_con
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) andl #0xFF00FF,%d1 |clear all but aexcs and qbyte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) bras end_fix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) fmove_con:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) andl #0x0FFF40FF,%d1 |clear all but cc's, snan bit, aexcs, and qbyte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) end_fix:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) movel %d1,USER_FPSR(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) st UFLG_TMP(%a6) |set flag for unsupp data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) bsrl get_op |everything okay, go get operand(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) bsrl res_func |fix up stack frame so can restore it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) clrl -(%a7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) moveb VER_TMP(%a6),(%a7) |move idle fmt word to top of stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) bral gen_except
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) |end