revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-all / m680x0 / m68k_060fpu.S
blob3dbf80040dfd283f4c81d795dfec49bdcf213397
2 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 # MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
4 # M68000 Hi-Performance Microprocessor Division
5 # M68060 Software Package Production Release 
6
7 # M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 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
14 # FOR A 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 PROFITS,
21 # BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
22 # ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
23
24 # Motorola assumes no responsibility for the maintenance and support
25 # of the SOFTWARE.  
26
27 # You are hereby granted a copyright license to use, modify, and distribute the
28 # SOFTWARE so long as this entire notice is retained without alteration
29 # in any modified and/or redistributed versions, and that such modified
30 # versions are clearly identified as such.
31 # No licenses are granted by implication, estoppel or otherwise under any
32 # patents or trademarks of Motorola, Inc.
33 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34
35 # Derived from: 
36 # fskeleton.s
38 # This file contains:
39 #       (1) example "Call-out"s
40 #       (2) example package entry code
41 #       (3) example "Call-out" table
45 #################################
46 # (1) EXAMPLE CALL-OUTS         #
47 #                               #
48 # _060_fpsp_done()              #
49 # _060_real_ovfl()              #
50 # _060_real_unfl()              #
51 # _060_real_operr()             #
52 # _060_real_snan()              #
53 # _060_real_dz()                #
54 # _060_real_inex()              #
55 # _060_real_bsun()              #
56 # _060_real_fline()             #
57 # _060_real_fpu_disabled()      #
58 # _060_real_trap()              #
59 #################################
64 # _060_fpsp_done():
66 # This is the main exit point for the 68060 Floating-Point
67 # Software Package. For a normal exit, all 060FPSP routines call this
68 # routine. The operating system can do system dependent clean-up or
69 # simply execute an "rte" as with the sample code below.
73 _060_fpsp_done:
74         rte
78 # _060_real_ovfl():
80 # This is the exit point for the 060FPSP when an enabled overflow exception
81 # is present. The routine below should point to the operating system handler 
82 # for enabled overflow conditions. The exception stack frame is an overflow
83 # stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
85 # The sample routine below simply clears the exception status bit and
86 # does an "rte".
90 _060_real_ovfl:
94 # _060_real_unfl():
96 # This is the exit point for the 060FPSP when an enabled underflow exception
97 # is present. The routine below should point to the operating system handler 
98 # for enabled underflow conditions. The exception stack frame is an underflow
99 # stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
101 # The sample routine below simply clears the exception status bit and
102 # does an "rte".
106 _060_real_unfl:
110 # _060_real_operr():
112 # This is the exit point for the 060FPSP when an enabled operand error exception
113 # is present. The routine below should point to the operating system handler 
114 # for enabled operand error exceptions. The exception stack frame is an operand error
115 # stack frame. The FP state frame holds the source operand of the faulting
116 # instruction.
118 # The sample routine below simply clears the exception status bit and
119 # does an "rte".
123 _060_real_operr:
127 # _060_real_snan():
129 # This is the exit point for the 060FPSP when an enabled signalling NaN exception
130 # is present. The routine below should point to the operating system handler 
131 # for enabled signalling NaN exceptions. The exception stack frame is a signalling NaN
132 # stack frame. The FP state frame holds the source operand of the faulting
133 # instruction.
135 # The sample routine below simply clears the exception status bit and
136 # does an "rte".
140 _060_real_snan:
144 # _060_real_dz():
146 # This is the exit point for the 060FPSP when an enabled divide-by-zero exception
147 # is present. The routine below should point to the operating system handler 
148 # for enabled divide-by-zero exceptions. The exception stack frame is a divide-by-zero
149 # stack frame. The FP state frame holds the source operand of the faulting
150 # instruction.
152 # The sample routine below simply clears the exception status bit and
153 # does an "rte".
157 _060_real_dz:
162 # _060_real_inex():
164 # This is the exit point for the 060FPSP when an enabled inexact exception
165 # is present. The routine below should point to the operating system handler 
166 # for enabled inexact exceptions. The exception stack frame is an inexact
167 # stack frame. The FP state frame holds the source operand of the faulting
168 # instruction.
170 # The sample routine below simply clears the exception status bit and
171 # does an "rte".
174 _060_real_inex:
175         fsave   %sp@-
176         movew   #0x6000,%sp@(0x2)
177         frestore        %sp@+
178         bra             jmp_exception
182 # _060_real_bsun():
184 # This is the exit point for the 060FPSP when an enabled bsun exception
185 # is present. The routine below should point to the operating system handler 
186 # for enabled bsun exceptions. The exception stack frame is a bsun
187 # stack frame.
189 # The sample routine below clears the exception status bit, clears the NaN
190 # bit in the FPSR, and does an "rte". The instruction that caused the 
191 # bsun will now be re-executed but with the NaN FPSR bit cleared.
195 _060_real_bsun:
196         fsave   %sp@-
198         fmovel  %fpsr,%sp@-
199         andib   #0xfe,%sp@
200         fmovel  %sp@+,%fpsr
202         addl    #0xc,%sp
203         bra             jmp_exception
207 # _060_real_fline():
209 # This is the exit point for the 060FPSP when an F-Line Illegal exception is 
210 # encountered. Three different types of exceptions can enter the F-Line exception
211 # vector number 11: FP Unimplemented Instructions, FP implemented instructions when
212 # the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
213 # _fpsp_fline() distinguishes between the three and acts appropriately. F-Line
214 # Illegals branch here.
218 _060_real_fline:
219         bra             jmp_exception_old_fline
223 # _060_real_fpu_disabled():
225 # This is the exit point for the 060FPSP when an FPU disabled exception is 
226 # encountered. Three different types of exceptions can enter the F-Line exception
227 # vector number 11: FP Unimplemented Instructions, FP implemented instructions when
228 # the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
229 # _fpsp_fline() distinguishes between the three and acts appropriately. FPU disabled
230 # exceptions branch here.
232 # The sample code below enables the FPU, sets the PC field in the exception stack
233 # frame to the PC of the instruction causing the exception, and does an "rte".
234 # The execution of the instruction then proceeds with an enabled floating-point
235 # unit.
239 _060_real_fpu_disabled:
240         bra             jmp_exception_old_fline
244 # _060_real_trap():
246 # This is the exit point for the 060FPSP when an emulated "ftrapcc" instruction
247 # discovers that the trap condition is true and it should branch to the operating
248 # system handler for the trap exception vector number 7.
250 # The sample code below simply executes an "rte".
254 _060_real_trap:
255         rte
258 #############################################################################
260 ##################################
261 # (2) EXAMPLE PACKAGE ENTRY CODE #
262 ##################################
265 #if 0
266 _060_fpsp_snan:
267         bral    FP_CALL_TOP+0x80+0x00
269 _060_fpsp_operr:
270         bral    FP_CALL_TOP+0x80+0x08
272 _060_fpsp_ovfl:
273         bral    FP_CALL_TOP+0x80+0x10
275 _060_fpsp_unfl:
276         bral    FP_CALL_TOP+0x80+0x18
278 _060_fpsp_dz:
279         bral    FP_CALL_TOP+0x80+0x20
281 _060_fpsp_inex:
282         bral    FP_CALL_TOP+0x80+0x28
284 _060_fpsp_fline:
285         bral    FP_CALL_TOP+0x80+0x30
287 _060_fpsp_unsupp:
288         bral    FP_CALL_TOP+0x80+0x38
290 _060_fpsp_effadd:
291         bral    FP_CALL_TOP+0x80+0x40
292 #endif
295 #############################################################################
297 ################################
298 # (3) EXAMPLE CALL-OUT SECTION #
299 ################################
301 # The size of this section MUST be 128 bytes!!!
304 FP_CALL_TOP:
305         .long   _060_real_bsun - FP_CALL_TOP
306         .long   _060_real_snan - FP_CALL_TOP
307         .long   _060_real_operr - FP_CALL_TOP
308         .long   _060_real_ovfl - FP_CALL_TOP
309         .long   _060_real_unfl - FP_CALL_TOP
310         .long   _060_real_dz - FP_CALL_TOP
311         .long   _060_real_inex - FP_CALL_TOP
312         .long   _060_real_fline - FP_CALL_TOP
313         .long   _060_real_fpu_disabled - FP_CALL_TOP
314         .long   _060_real_trap - FP_CALL_TOP
315         .long   _060_real_trace - FP_CALL_TOP
316         .long   _060_real_access - FP_CALL_TOP
317         .long   _060_fpsp_done - FP_CALL_TOP
319         .long   0x00000000,0x00000000,0x00000000
321         .long   _060_imem_read - FP_CALL_TOP
322         .long   _060_dmem_read - FP_CALL_TOP
323         .long   _060_dmem_write - FP_CALL_TOP
324         .long   _060_imem_read_word - FP_CALL_TOP
325         .long   _060_imem_read_long - FP_CALL_TOP
326         .long   _060_dmem_read_byte - FP_CALL_TOP
327         .long   _060_dmem_read_word - FP_CALL_TOP
328         .long   _060_dmem_read_long - FP_CALL_TOP
329         .long   _060_dmem_write_byte - FP_CALL_TOP
330         .long   _060_dmem_write_word - FP_CALL_TOP
331         .long   _060_dmem_write_long - FP_CALL_TOP
333         .long   0x00000000
335         .long   0x00000000,0x00000000,0x00000000,0x00000000
338 #############################################################################
340 # 060 FPSP KERNEL PACKAGE NEEDS TO GO HERE!!!
343 #include "060sp/fpsp.S"