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