3 # $NetBSD: fnetbsd.S,v 1.5 2000/11/30 21:00:51 scw Exp $
5 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 # MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
7 # M68000 Hi-Performance Microprocessor Division
8 # M68060 Software Package Production Release
10 # M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
11 # All rights reserved.
13 # THE SOFTWARE is provided on an "AS IS" basis and without warranty.
14 # To the maximum extent permitted by applicable law,
15 # MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
16 # INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
17 # FOR A PARTICULAR PURPOSE and any warranty against infringement with
18 # regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
19 # and any accompanying written materials.
21 # To the maximum extent permitted by applicable law,
22 # IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
23 # (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
24 # BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
25 # ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
27 # Motorola assumes no responsibility for the maintenance and support
30 # You are hereby granted a copyright license to use, modify, and distribute the
31 # SOFTWARE so long as this entire notice is retained without alteration
32 # in any modified and/or redistributed versions, and that such modified
33 # versions are clearly identified as such.
34 # No licenses are granted by implication, estoppel or otherwise under any
35 # patents or trademarks of Motorola, Inc.
36 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42 # (1) example "Call-out"s
43 # (2) example package entry code
44 # (3) example "Call-out" table
48 #################################
49 # (1) EXAMPLE CALL-OUTS #
60 # _060_real_fpu_disabled() #
62 #################################
69 # This is the main exit point for the 68060 Floating-Point
70 # Software Package. For a normal exit, all 060FPSP routines call this
71 # routine. The operating system can do system dependent clean-up or
72 # simply execute an "rte" as with the sample code below.
75 ASENTRY_NOPROFILE(_060_fpsp_done)
82 # This is the exit point for the 060FPSP when an enabled overflow exception
83 # is present. The routine below should point to the operating system handler
84 # for enabled overflow conditions. The exception stack frame is an overflow
85 # stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
87 # The sample routine below simply clears the exception status bit and
91 ASENTRY_NOPROFILE(_060_real_ovfl)
93 movew #0x6000,%sp@(0x2)
101 # This is the exit point for the 060FPSP when an enabled underflow exception
102 # is present. The routine below should point to the operating system handler
103 # for enabled underflow conditions. The exception stack frame is an underflow
104 # stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
106 # The sample routine below simply clears the exception status bit and
110 ASENTRY_NOPROFILE(_060_real_unfl)
112 movew #0x6000,%sp@(0x2)
114 jmp _C_LABEL(fpfault)
120 # This is the exit point for the 060FPSP when an enabled operand error exception
121 # is present. The routine below should point to the operating system handler
122 # for enabled operand error exceptions. The exception stack frame is an operand error
123 # stack frame. The FP state frame holds the source operand of the faulting
126 # The sample routine below simply clears the exception status bit and
130 ASENTRY_NOPROFILE(_060_real_operr)
132 movew #0x6000,%sp@(0x2)
134 jmp _C_LABEL(fpfault)
140 # This is the exit point for the 060FPSP when an enabled signalling NaN exception
141 # is present. The routine below should point to the operating system handler
142 # for enabled signalling NaN exceptions. The exception stack frame is a signalling NaN
143 # stack frame. The FP state frame holds the source operand of the faulting
146 # The sample routine below simply clears the exception status bit and
150 ASENTRY_NOPROFILE(_060_real_snan)
152 movew #0x6000,%sp@(0x2)
154 jmp _C_LABEL(fpfault)
160 # This is the exit point for the 060FPSP when an enabled divide-by-zero exception
161 # is present. The routine below should point to the operating system handler
162 # for enabled divide-by-zero exceptions. The exception stack frame is a divide-by-zero
163 # stack frame. The FP state frame holds the source operand of the faulting
166 # The sample routine below simply clears the exception status bit and
170 ASENTRY_NOPROFILE(_060_real_dz)
172 movew #0x6000,%sp@(0x2)
174 jmp _C_LABEL(fpfault)
180 # This is the exit point for the 060FPSP when an enabled inexact exception
181 # is present. The routine below should point to the operating system handler
182 # for enabled inexact exceptions. The exception stack frame is an inexact
183 # stack frame. The FP state frame holds the source operand of the faulting
186 # The sample routine below simply clears the exception status bit and
190 ASENTRY_NOPROFILE(_060_real_inex)
192 movew #0x6000,%sp@(0x2)
194 jmp _C_LABEL(fpfault)
200 # This is the exit point for the 060FPSP when an enabled bsun exception
201 # is present. The routine below should point to the operating system handler
202 # for enabled bsun exceptions. The exception stack frame is a bsun
205 # The sample routine below clears the exception status bit, clears the NaN
206 # bit in the FPSR, and does an "rte". The instruction that caused the
207 # bsun will now be re-executed but with the NaN FPSR bit cleared.
210 ASENTRY_NOPROFILE(_060_real_bsun)
218 jmp _C_LABEL(fpfault)
224 # This is the exit point for the 060FPSP when an F-Line Illegal exception is
225 # encountered. Three different types of exceptions can enter the F-Line exception
226 # vector number 11: FP Unimplemented Instructions, FP implemented instructions when
227 # the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
228 # _fpsp_fline() distinguishes between the three and acts appropriately. F-Line
229 # Illegals branch here.
232 ASENTRY_NOPROFILE(_060_real_fline)
233 jmp _C_LABEL(fpfault)
237 # _060_real_fpu_disabled():
239 # This is the exit point for the 060FPSP when an FPU disabled exception is
240 # encountered. Three different types of exceptions can enter the F-Line exception
241 # vector number 11: FP Unimplemented Instructions, FP implemented instructions when
242 # the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
243 # _fpsp_fline() distinguishes between the three and acts appropriately. FPU disabled
244 # exceptions branch here.
246 # The sample code below enables the FPU, sets the PC field in the exception stack
247 # frame to the PC of the instruction causing the exception, and does an "rte".
248 # The execution of the instruction then proceeds with an enabled floating-point
252 ASENTRY_NOPROFILE(_060_real_fpu_disabled)
253 movel %d0,%sp@- |# enabled the fpu
255 .short 0x4e7a,0x0808 |* movec.l pcr,d0
257 .short 0x4e7b,0x0808 |* movec.l d0,pcr
260 movel %sp@(0xc),%sp@(0x2) |# set "Current PC"
267 # This is the exit point for the 060FPSP when an emulated "ftrapcc" instruction
268 # discovers that the trap condition is true and it should branch to the operating
269 # system handler for the trap exception vector number 7.
271 # The sample code below simply executes an "rte".
274 ASENTRY_NOPROFILE(_060_real_trap)
278 #############################################################################
280 ##################################
281 # (2) EXAMPLE PACKAGE ENTRY CODE #
282 ##################################
284 ASENTRY_NOPROFILE(_060_fpsp_snan)
285 bral _C_LABEL(FP_CALL_TOP)+0x80+0x00
287 ASENTRY_NOPROFILE(_060_fpsp_operr)
288 bral _C_LABEL(FP_CALL_TOP)+0x80+0x08
290 ASENTRY_NOPROFILE(_060_fpsp_ovfl)
291 bral _C_LABEL(FP_CALL_TOP)+0x80+0x10
293 ASENTRY_NOPROFILE(_060_fpsp_unfl)
294 bral _C_LABEL(FP_CALL_TOP)+0x80+0x18
296 ASENTRY_NOPROFILE(_060_fpsp_dz)
297 bral _C_LABEL(FP_CALL_TOP)+0x80+0x20
299 ASENTRY_NOPROFILE(_060_fpsp_inex)
300 bral _C_LABEL(FP_CALL_TOP)+0x80+0x28
302 ASENTRY_NOPROFILE(_060_fpsp_fline)
303 bral _C_LABEL(FP_CALL_TOP)+0x80+0x30
305 ASENTRY_NOPROFILE(_060_fpsp_unsupp)
306 bral _C_LABEL(FP_CALL_TOP)+0x80+0x38
308 ASENTRY_NOPROFILE(_060_fpsp_effadd)
309 bral _C_LABEL(FP_CALL_TOP)+0x80+0x40
312 #############################################################################
314 ################################
315 # (3) EXAMPLE CALL-OUT SECTION #
316 ################################
318 # The size of this section MUST be 128 bytes!!!
321 .long _ASM_LABEL(_060_real_bsun)-_C_LABEL(FP_CALL_TOP)
322 .long _ASM_LABEL(_060_real_snan)-_C_LABEL(FP_CALL_TOP)
323 .long _ASM_LABEL(_060_real_operr)-_C_LABEL(FP_CALL_TOP)
324 .long _ASM_LABEL(_060_real_ovfl)-_C_LABEL(FP_CALL_TOP)
325 .long _ASM_LABEL(_060_real_unfl)-_C_LABEL(FP_CALL_TOP)
326 .long _ASM_LABEL(_060_real_dz)-_C_LABEL(FP_CALL_TOP)
327 .long _ASM_LABEL(_060_real_inex)-_C_LABEL(FP_CALL_TOP)
328 .long _ASM_LABEL(_060_real_fline)-_C_LABEL(FP_CALL_TOP)
329 .long _ASM_LABEL(_060_real_fpu_disabled)-_C_LABEL(FP_CALL_TOP)
330 .long _ASM_LABEL(_060_real_trap)-_C_LABEL(FP_CALL_TOP)
331 .long _ASM_LABEL(_060_real_trace)-_C_LABEL(FP_CALL_TOP)
332 .long _ASM_LABEL(_060_real_access)-_C_LABEL(FP_CALL_TOP)
333 .long _ASM_LABEL(_060_fpsp_done)-_C_LABEL(FP_CALL_TOP)
335 .long 0x00000000,0x00000000,0x00000000
337 .long _ASM_LABEL(_060_imem_read)-_C_LABEL(FP_CALL_TOP)
338 .long _ASM_LABEL(_060_dmem_read)-_C_LABEL(FP_CALL_TOP)
339 .long _ASM_LABEL(_060_dmem_write)-_C_LABEL(FP_CALL_TOP)
340 .long _ASM_LABEL(_060_imem_read_word)-_C_LABEL(FP_CALL_TOP)
341 .long _ASM_LABEL(_060_imem_read_long)-_C_LABEL(FP_CALL_TOP)
342 .long _ASM_LABEL(_060_dmem_read_byte)-_C_LABEL(FP_CALL_TOP)
343 .long _ASM_LABEL(_060_dmem_read_word)-_C_LABEL(FP_CALL_TOP)
344 .long _ASM_LABEL(_060_dmem_read_long)-_C_LABEL(FP_CALL_TOP)
345 .long _ASM_LABEL(_060_dmem_write_byte)-_C_LABEL(FP_CALL_TOP)
346 .long _ASM_LABEL(_060_dmem_write_word)-_C_LABEL(FP_CALL_TOP)
347 .long _ASM_LABEL(_060_dmem_write_long)-_C_LABEL(FP_CALL_TOP)
351 .long 0x00000000,0x00000000,0x00000000,0x00000000
354 #############################################################################
356 # 060 FPSP KERNEL PACKAGE NEEDS TO GO HERE!!!