revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-all / m680x0 / m68k_060sp.S
blob732e4318a25ed99fae119168c9a0b2447d53edad
2 #include "aros/m68k/asm.h"
4         .text
6 #include "060sp/copyright.S"
8         .balign 4
10         .globl sp060_init
11 sp060_init:
12         movem.l %a5/%a6,%sp@-
13         move.l  4.w,%a6
14         lea             %pc@(super),%a5
15         jsr             %a6@(-0x1e)
16         movem.l %sp@+,%a5/%a6
17         rts
18 super:
19         movec   %vbr,%a0
20         /* floating point */
21         lea             %pc@(FP_CALL_TOP+0x80+0x30),%a1 // _060_fpsp_fline
22         move.l  11*4(%a0),56*4(%a0)             /* save old f-line */
23         move.l  %a1,11*4(%a0)
24         lea             %pc@(FP_CALL_TOP+0x80+0x00),%a1 // _060_fpsp_snan
25         move.l  %a1,54*4(%a0)
26         lea             %pc@(FP_CALL_TOP+0x80+0x08),%a1 // _060_fpsp_operr
27         move.l  %a1,52*4(%a0)
28         lea             %pc@(FP_CALL_TOP+0x80+0x10),%a1 // _060_fpsp_ovfl
29         move.l  %a1,53*4(%a0)
30         lea             %pc@(FP_CALL_TOP+0x80+0x18),%a1 // _060_fpsp_unfl
31         move.l  %a1,51*4(%a0)
32         lea             %pc@(FP_CALL_TOP+0x80+0x20),%a1 // _060_fpsp_dz
33         move.l  %a1,50*4(%a0)
34         lea             %pc@(FP_CALL_TOP+0x80+0x28),%a1 // _060_fpsp_inex
35         move.l  %a1,49*4(%a0)
36         lea             %pc@(FP_CALL_TOP+0x80+0x38),%a1 // _060_fpsp_unsupp
37         move.l  %a1,55*4(%a0)
38         lea             %pc@(FP_CALL_TOP+0x80+0x40),%a1 // _060_fpsp_effadd
39         move.l  %a1,60*4(%a0)
40         /* integer */
41         lea             %pc@(I_CALL_TOP+0x80+0x00),%a1  // _060_isp_unimp
42         move.l  %a1,61*4(%a0)
43         
44         rte
46 #if 0
47 _060_isp_unimp:
48         bral    I_CALL_TOP+0x80+0x00
50 _060_isp_cas:
51         bral    I_CALL_TOP+0x80+0x08
53 _060_isp_cas2:
54         bral    I_CALL_TOP+0x80+0x10
56 _060_isp_cas_finish:
57         bral    I_CALL_TOP+0x80+0x18
59 _060_isp_cas2_finish:
60         bral    I_CALL_TOP+0x80+0x20
62 _060_isp_cas_inrange:
63         bral    I_CALL_TOP+0x80+0x28
65 _060_isp_cas_terminate:
66         bral    I_CALL_TOP+0x80+0x30
68 _060_isp_cas_restart:
69         bral    I_CALL_TOP+0x80+0x38
70 #endif
72 #if 0
73 _060_fpsp_snan:
74         bral    FP_CALL_TOP+0x80+0x00
76 _060_fpsp_operr:
77         bral    FP_CALL_TOP+0x80+0x08
79 _060_fpsp_ovfl:
80         bral    FP_CALL_TOP+0x80+0x10
82 _060_fpsp_unfl:
83         bral    FP_CALL_TOP+0x80+0x18
85 _060_fpsp_dz:
86         bral    FP_CALL_TOP+0x80+0x20
88 _060_fpsp_inex:
89         bral    FP_CALL_TOP+0x80+0x28
91 _060_fpsp_fline:
92         bral    FP_CALL_TOP+0x80+0x30
94 _060_fpsp_unsupp:
95         bral    FP_CALL_TOP+0x80+0x38
97 _060_fpsp_effadd:
98         bral    FP_CALL_TOP+0x80+0x40
99 #endif
101 jmp_exception:
102         /* exception stack frame is ready, jump to correct exception vector */
103         clr.l   %sp@-
104         movem.l %d0-%d1,%sp@-
105         movec   %vbr,%d1
106         move.w  %sp@(8+6),%d0 /* fetch exception vector number */
107         and.w   #0xfff,%d0
108         lsl.w   #2,%d0
109         add.w   %d0,%d1
110         move.l  %d1,%sp@(8)
111         movem.l %sp@+,%d0-%d1
112         rts
114 jmp_exception_old_fline:
115         clr.l   %sp@-
116         move.l  %a0,%sp@-
117         movec   %vbr,%a0
118         /* 0xE0 = old f-line storage */
119         move.l  %a0@(56*4),%sp@(4)
120         move.l  %sp@+,%a0
121         rts
124 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125 # MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
126 # M68000 Hi-Performance Microprocessor Division
127 # M68060 Software Package Production Release 
129 # M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
130 # All rights reserved.
132 # THE SOFTWARE is provided on an "AS IS" basis and without warranty.
133 # To the maximum extent permitted by applicable law,
134 # MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
135 # INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
136 # FOR A PARTICULAR PURPOSE and any warranty against infringement with
137 # regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
138 # and any accompanying written materials. 
140 # To the maximum extent permitted by applicable law,
141 # IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
142 # (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
143 # BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
144 # ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
146 # Motorola assumes no responsibility for the maintenance and support
147 # of the SOFTWARE.  
149 # You are hereby granted a copyright license to use, modify, and distribute the
150 # SOFTWARE so long as this entire notice is retained without alteration
151 # in any modified and/or redistributed versions, and that such modified
152 # versions are clearly identified as such.
153 # No licenses are granted by implication, estoppel or otherwise under any
154 # patents or trademarks of Motorola, Inc.
155 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159 #################################
160 # EXAMPLE CALL-OUTS             #
161 #                               #
162 # _060_dmem_write()             #
163 # _060_dmem_read()              #
164 # _060_imem_read()              #
165 # _060_dmem_read_byte()         #
166 # _060_dmem_read_word()         #
167 # _060_dmem_read_long()         #
168 # _060_imem_read_word()         #
169 # _060_imem_read_long()         #
170 # _060_dmem_write_byte()        #
171 # _060_dmem_write_word()        #
172 # _060_dmem_write_long()        #
173 #                               #
174 # _060_real_trace()             #
175 # _060_real_access()            #
176 #################################
181 # _060_dmem_write():
183 # Writes to data memory while in supervisor mode.
185 # INPUTS:
186 #       a0 - supervisor source address  
187 #       a1 - user destination address
188 #       d0 - number of bytes to write   
189 #       a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
190 # OUTPUTS:
191 #       d1 - 0 = success, !0 = failure
195 _060_dmem_write:
196         moveb   %a0@+,%a1@+     |# copy 1 byte
197         subql   #0x1,%d0        |# decr byte counter
198         bnes    _060_dmem_write |# quit if ctr = 0
199         moveq   #0,%d1          |# return success
200         rts
204 # _060_imem_read(), _060_dmem_read():
206 # Reads from data/instruction memory while in supervisor mode.
208 # INPUTS:
209 #       a0 - user source address
210 #       a1 - supervisor destination address
211 #       d0 - number of bytes to read
212 #       a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
213 # OUTPUTS:
214 #       d1 - 0 = success, !0 = failure
218 _060_imem_read:
219 _060_dmem_read:
220         moveb   %a0@+,%a1@+     |# copy 1 byte
221         subql   #0x1,%d0        |# decr byte counter
222         bnes    _060_dmem_read  |# quit if ctr = 0
223         moveq   #0,%d1          |# return success
224         rts
228 # _060_dmem_read_byte():
230 # Read a data byte from user memory.
232 # INPUTS:
233 #       a0 - user source address
234 #       a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
235 # OUTPUTS:
236 #       d0 - data byte in d0
237 #       d1 - 0 = success, !0 = failure
241 _060_dmem_read_byte:
242         moveq   #0,%d1                  |# return success
243         moveq   #0,%d0                  |# clear whole longword
244         moveb   %a0@,%d0                |# fetch byte
245         rts
249 # _060_imem_read_word():
250 # Read an instruction word from user memory.
252 # _060_dmem_read_word():
253 # Read a data word from user memory.
255 # INPUTS:
256 #       a0 - user source address
257 #       a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
258 # OUTPUTS:
259 #       d0 - data word in d0
260 #       d1 - 0 = success, !0 = failure
264 _060_imem_read_word:
265 _060_dmem_read_word:
266         moveq   #0,%d1                  |# return success
267         moveq   #0,%d0                  |# clear whole longword
268         movew   %a0@,%d0                |# fetch word
269         rts
273 # _060_imem_read_long():
274 # Read an instruction longword from user memory.
276 # _060_dmem_read_long():
277 # Read an data longword from user memory.
280 # INPUTS:
281 #       a0 - user source address
282 #       a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
283 # OUTPUTS:
284 #       d0 - data longword in d0
285 #       d1 - 0 = success, !0 = failure
289 _060_imem_read_long:
290 _060_dmem_read_long:
291         moveq   #0,%d1                  |# return success
292         movel   %a0@,%d0                |# fetch longword
293         rts
297 # _060_dmem_write_byte():
299 # Write a data byte to user memory.
301 # INPUTS:
302 #       a0 - user destination address
303 #       d0 - data byte in d0
304 #       a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
305 # OUTPUTS:
306 #       d1 - 0 = success, !0 = failure
310 _060_dmem_write_byte:
311         moveq   #0,%d1                  |# return success
312         moveb   %d0,%a0@                |# store byte
313         rts
317 # _060_dmem_write_word():
319 # Write a data word to user memory.
321 # INPUTS:
322 #       a0 - user destination address
323 #       d0 - data word in d0
324 #       a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
325 # OUTPUTS:
326 #       d1 - 0 = success, !0 = failure
330 _060_dmem_write_word:
331         moveq   #0,%d1                  |# return success
332         movew   %d0,%a0@                |# store word
333         rts
337 # _060_dmem_write_long():
339 # Write a data longword to user memory.
341 # INPUTS:
342 #       a0 - user destination address
343 #       d0 - data longword in d0
344 #       a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
345 # OUTPUTS:
346 #       d1 - 0 = success, !0 = failure
350 _060_dmem_write_long:
351         moveq   #0,%d1                  |# return success
352         movel   %d0,%a0@                |# store longword
353         rts
357 # _060_real_trace():
359 # This is the exit point for the 060FPSP when an instruction is being traced
360 # and there are no other higher priority exceptions pending for this instruction
361 # or they have already been processed.
363 # The sample code below simply executes an "rte".
367 _060_real_trace:
368         bra             jmp_exception
372 # _060_real_access():
374 # This is the exit point for the 060FPSP when an access error exception
375 # is encountered. The routine below should point to the operating system
376 # handler for access error exceptions. The exception stack frame is an
377 # 8-word access error frame.
379 # We jump directly to the 68060 buserr handler.
380 # If we had a sane ld, we could use use that entry point directly...
384 _060_real_access:
385         bra             jmp_exception
387 #include "m68k_060int.S"
388 #include "m68k_060fpu.S"