1 * $NetBSD: x_unsupp.sa,v 1.2 1994/10/26 07:50:33 cgd Exp $
3 * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
4 * M68000 Hi-Performance Microprocessor Division
5 * M68040 Software Package
7 * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
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.
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.
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.
34 * x_unsupp.sa 3.3 7/1/91
36 * fpsp_unsupp --- FPSP handler for unsupported data type exception
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.
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>.
51 * Input: Long fsave stack frame
54 X_UNSUPP IDNT 2,1 Motorola 040 Floating Point Software Package
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)
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
81 fmove.l #0,FPSR ;clear all user status bits
82 fmove.l #0,FPCR ;clear all user control bits
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.
89 move.l USER_FPSR(a6),d1
90 btst #5,CMDREG1B(a6) ;looking for fmove out
92 and.l #$FF00FF,d1 ;clear all but aexcs and qbyte
95 and.l #$0FFF40FF,d1 ;clear all but cc's, snan bit, aexcs, and qbyte
97 move.l d1,USER_FPSR(a6)
99 st UFLG_TMP(a6) ;set flag for unsupp data
101 bsr.l get_op ;everything okay, go get operand(s)
102 bsr.l res_func ;fix up stack frame so can restore it
104 move.b VER_TMP(a6),(a7) ;move idle fmt word to top of stack