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