1 * $NetBSD: x_fline.sa,v 1.2 1994/10/26 07:50:23 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_fline.sa 3.3 1/10/91
36 * fpsp_fline --- FPSP handler for fline exception
38 * First determine if the exception is one of the unimplemented
39 * floating point instructions. If so, let fpsp_unimp handle it.
40 * Next, determine if the instruction is an fmovecr with a non-zero
41 * <ea> field. If so, handle here and return. Otherwise, it
42 * must be a real F-line exception.
45 X_FLINE IDNT 2,1 Motorola 040 Floating Point Software Package
60 * check for unimplemented vector first. Use EXC_VEC-4 because
61 * the equate is valid only after a 'link a6' has pushed one more
62 * long onto the stack.
64 cmp.w #UNIMP_VEC,EXC_VEC-4(a7)
68 * fmovecr with non-zero <ea> handling here
70 sub.l #4,a7 ;4 accounts for 2-word difference
71 * ;between six word frame (unimp) and
75 movem.l d0-d1/a0-a1,USER_DA(a6)
76 movea.l EXC_PC+4(a6),a0 ;get address of fline instruction
77 lea.l L_SCR1(a6),a1 ;use L_SCR1 as scratch
79 add.l #4,a6 ;to offset the sub.l #4,a7 above so that
80 * ;a6 can point correctly to the stack frame
81 * ;before branching to mem_read
84 move.l L_SCR1(a6),d0 ;d0 contains the fline and command word
85 bfextu d0{4:3},d1 ;extract coprocessor id
86 cmpi.b #1,d1 ;check if cpid=1
87 bne.w not_mvcr ;exit if not
89 cmpi.b #$17,d1 ;check if it is an FMOVECR encoding
91 * ;if an FMOVECR instruction, fix stack
92 * ;and go to FPSP_UNIMP
94 cmpi.b #VER_40,(a7) ;test for orig unimp frame
96 sub.l #UNIMP_40_SIZE-4,a7 ;emulate an orig fsave
98 move.b #UNIMP_40_SIZE-4,1(a7)
102 cmpi.b #VER_41,(a7) ;test for rev unimp frame
103 bne.l fpsp_fmt_error ;if not $40 or $41, exit with error
104 sub.l #UNIMP_41_SIZE-4,a7 ;emulate a rev fsave
106 move.b #UNIMP_41_SIZE-4,1(a7)
109 move.w EXC_SR+4(a6),EXC_SR(a6) ;move stacked sr to new position
110 move.l EXC_PC+4(a6),EXC_PC(a6) ;move stacked pc to new position
111 fmove.l EXC_PC(a6),FPIAR ;point FPIAR to fline inst
113 add.l d1,EXC_PC(a6) ;increment stacked pc value to next inst
114 move.w #$202c,EXC_VEC(a6) ;reformat vector to unimp
115 clr.l EXC_EA(a6) ;clear the EXC_EA field
116 move.w d0,CMDREG1B(a6) ;move the lower word into CMDREG1B
118 bset.b #UFLAG,T_BYTE(a6)
119 movem.l USER_DA(a6),d0-d1/a0-a1 ;restore data registers
123 movem.l USER_DA(a6),d0-d1/a0-a1 ;restore data registers