1 * $NetBSD: x_unsupp.sa,v 1.2 1994/10/26 07:50:33 cgd Exp $ 2 3 * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP 4 * M68000 Hi-Performance Microprocessor Division 5 * M68040 Software Package 6 * 7 * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc. 8 * All rights reserved. 9 * 10 * THE SOFTWARE is provided on an "AS IS" basis and without warranty. 11 * To the maximum extent permitted by applicable law, 12 * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 13 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A 14 * PARTICULAR PURPOSE and any warranty against infringement with 15 * regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) 16 * and any accompanying written materials. 17 * 18 * To the maximum extent permitted by applicable law, 19 * IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER 20 * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS 21 * PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR 22 * OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE 23 * SOFTWARE. Motorola assumes no responsibility for the maintenance 24 * and support of the SOFTWARE. 25 * 26 * You are hereby granted a copyright license to use, modify, and 27 * distribute the SOFTWARE so long as this entire notice is retained 28 * without alteration in any modified and/or redistributed versions, 29 * and that such modified versions are clearly identified as such. 30 * No licenses are granted by implication, estoppel or otherwise 31 * under any patents or trademarks of Motorola, Inc. 32 33 * 34 * x_unsupp.sa 3.3 7/1/91 35 * 36 * fpsp_unsupp --- FPSP handler for unsupported data type exception 37 * 38 * Trap vector #55 (See table 8-1 Mc68030 User's manual). 39 * Invoked when the user program encounters a data format (packed) that 40 * hardware does not support or a data type (denormalized numbers or un- 41 * normalized numbers). 42 * Normalizes denorms and unnorms, unpacks packed numbers then stores 43 * them back into the machine to let the 040 finish the operation. 44 * 45 * Unsupp calls two routines: 46 * 1. get_op - gets the operand(s) 47 * 2. res_func - restore the function back into the 040 or 48 * if fmove.p fpm,<ea> then pack source (fpm) 49 * and store in users memory <ea>. 50 * 51 * Input: Long fsave stack frame 52 * 53 54 X_UNSUPP IDNT 2,1 Motorola 040 Floating Point Software Package 55 56 section 8 57 58 include fpsp.h 59 60 xref get_op 61 xref res_func 62 xref gen_except 63 xref fpsp_fmt_error 64 65 xdef fpsp_unsupp 66 fpsp_unsupp: 67 * 68 link a6,#-LOCAL_SIZE 69 fsave -(a7) 70 movem.l d0-d1/a0-a1,USER_DA(a6) 71 fmovem.x fp0-fp3,USER_FP0(a6) 72 fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6) 73 74 75 move.b (a7),VER_TMP(a6) ;save version number 76 move.b (a7),d0 ;test for valid version num 77 andi.b #$f0,d0 ;test for $4x 78 cmpi.b #VER_4,d0 ;must be $4x or exit 79 bne.l fpsp_fmt_error 80 81 fmove.l #0,FPSR ;clear all user status bits 82 fmove.l #0,FPCR ;clear all user control bits 83 * 84 * The following lines are used to ensure that the FPSR 85 * exception byte and condition codes are clear before proceeding, 86 * except in the case of fmove, which leaves the cc's intact. 87 * 88 unsupp_con: 89 move.l USER_FPSR(a6),d1 90 btst #5,CMDREG1B(a6) ;looking for fmove out 91 bne fmove_con 92 and.l #$FF00FF,d1 ;clear all but aexcs and qbyte 93 bra.b end_fix 94 fmove_con: 95 and.l #$0FFF40FF,d1 ;clear all but cc's, snan bit, aexcs, and qbyte 96 end_fix: 97 move.l d1,USER_FPSR(a6) 98 99 st UFLG_TMP(a6) ;set flag for unsupp data 100 101 bsr.l get_op ;everything okay, go get operand(s) 102 bsr.l res_func ;fix up stack frame so can restore it 103 clr.l -(a7) 104 move.b VER_TMP(a6),(a7) ;move idle fmt word to top of stack 105 bra.l gen_except 106 * 107 end 108