GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / m68k / math-emu / fp_movem.S
blobebf7ab9db7ab51c4900badb79b0d7ae07d506605
1 /*
2  * fp_movem.S
3  *
4  * Copyright Roman Zippel, 1997.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, and the entire permission notice in its entirety,
11  *    including the disclaimer of warranties.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote
16  *    products derived from this software without specific prior
17  *    written permission.
18  *
19  * ALTERNATIVELY, this product may be distributed under the terms of
20  * the GNU General Public License, in which case the provisions of the GPL are
21  * required INSTEAD OF the above restrictions.  (This clause is
22  * necessary due to a potential bad interaction between the GPL and
23  * the restrictions contained in a BSD-style copyright.)
24  *
25  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
29  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35  * OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
38 #include "fp_emu.h"
39 #include "fp_decode.h"
41 | set flags for decode macros for fmovem
42 do_fmovem=1
44         .globl  fp_fmovem_fp, fp_fmovem_cr
46 | %d1 contains the mask and count of the register list
47 | for other register usage see fp_decode.h
49 fp_fmovem_fp:
50         printf  PDECODE,"fmovem.x "
51         | get register list and count them
52         btst    #11,%d2
53         jne     1f
54         bfextu  %d2{#24,#8},%d0         | static register list
55         jra     2f
56 1:      bfextu  %d2{#25,#3},%d0         | dynamic register list
57         jsr     fp_get_data_reg
58 2:      move.l  %d0,%d1
59         swap    %d1
60         jra     2f
61 1:      addq.w  #1,%d1                  | count the # of registers in
62 2:      lsr.b   #1,%d0                  | register list and keep it in %d1
63         jcs     1b
64         jne     2b
65         printf  PDECODE,"#%08x",1,%d1
66 #ifdef FPU_EMU_DEBUG
67         btst    #12,%d2
68         jne     1f
69         printf  PDECODE,"-"             | decremental move
70         jra     2f
71 1:      printf  PDECODE,"+"             | incremental move
72 2:      btst    #13,%d2
73         jeq     1f
74         printf  PDECODE,"->"            | fpu -> cpu
75         jra     2f
76 1:      printf  PDECODE,"<-"            | fpu <- cpu
78 #endif
80         | decode address mode
81         fp_decode_addr_mode
83         .long   fp_ill, fp_ill
84         .long   fpr_indirect, fpr_postinc
85         .long   fpr_predecr, fpr_disp16
86         .long   fpr_extmode0, fpr_extmode1
88         | addressing mode: address register indirect
89 fpr_indirect:
90         fp_mode_addr_indirect
91         jra     fpr_do_movem
93         | addressing mode: address register indirect with postincrement
94 fpr_postinc:
95         fp_mode_addr_indirect_postinc
96         jra     fpr_do_movem
98 fpr_predecr:
99         fp_mode_addr_indirect_predec
100         jra     fpr_do_movem
102         | addressing mode: address register/programm counter indirect
103         |                  with 16bit displacement
104 fpr_disp16:
105         fp_mode_addr_indirect_disp16
106         jra     fpr_do_movem
108 fpr_extmode0:
109         fp_mode_addr_indirect_extmode0
110         jra     fpr_do_movem
112 fpr_extmode1:
113         fp_decode_addr_reg
114         jmp     ([0f:w,%pc,%d0*4])
116         .align  4
118         .long   fpr_absolute_short, fpr_absolute_long
119         .long   fpr_disp16, fpr_extmode0
120         .long   fp_ill, fp_ill
121         .long   fp_ill, fp_ill
123 fpr_absolute_short:
124         fp_mode_abs_short
125         jra     fpr_do_movem
127 fpr_absolute_long:
128         fp_mode_abs_long
129 |       jra     fpr_do_movem
131 fpr_do_movem:
132         swap    %d1                     | get fpu register list
133         lea     (FPD_FPREG,FPDATA),%a1
134         moveq   #12,%d0
135         btst    #12,%d2
136         jne     1f
137         lea     (-12,%a1,%d0*8),%a1
138         neg.l   %d0
139 1:      btst    #13,%d2
140         jne     4f
141         | move register from memory into fpu
142         jra     3f
143 1:      printf  PMOVEM,"(%p>%p)",2,%a0,%a1
144         getuser.l (%a0)+,%d2,fp_err_ua1,%a0
145         lsr.l   #8,%d2
146         lsr.l   #7,%d2
147         lsr.w   #1,%d2
148         move.l  %d2,(%a1)+
149         getuser.l (%a0)+,%d2,fp_err_ua1,%a0
150         move.l  %d2,(%a1)+
151         getuser.l (%a0),%d2,fp_err_ua1,%a0
152         move.l  %d2,(%a1)
153         subq.l  #8,%a0
154         subq.l  #8,%a1
155         add.l   %d0,%a0
156 2:      add.l   %d0,%a1
157 3:      lsl.b   #1,%d1
158         jcs     1b
159         jne     2b
160         jra     5f
161         | move register from fpu into memory
162 1:      printf  PMOVEM,"(%p>%p)",2,%a1,%a0
163         move.l  (%a1)+,%d2
164         lsl.w   #1,%d2
165         lsl.l   #7,%d2
166         lsl.l   #8,%d2
167         putuser.l %d2,(%a0)+,fp_err_ua1,%a0
168         move.l  (%a1)+,%d2
169         putuser.l %d2,(%a0)+,fp_err_ua1,%a0
170         move.l  (%a1),%d2
171         putuser.l %d2,(%a0),fp_err_ua1,%a0
172         subq.l  #8,%a1
173         subq.l  #8,%a0
174         add.l   %d0,%a0
175 2:      add.l   %d0,%a1
176 4:      lsl.b   #1,%d1
177         jcs     1b
178         jne     2b
180         printf  PDECODE,"\n"
181         jra     fp_end
183 | set flags for decode macros for fmovem control register
184 do_fmovem=1
185 do_fmovem_cr=1
187 fp_fmovem_cr:
188         printf  PDECODE,"fmovem.cr "
189         | get register list and count them
190         bfextu  %d2{#19,#3},%d0
191         move.l  %d0,%d1
192         swap    %d1
193         jra     2f
194 1:      addq.w  #1,%d1
195 2:      lsr.l   #1,%d0
196         jcs     1b
197         jne     2b
198         printf  PDECODE,"#%08x",1,%d1
199 #ifdef FPU_EMU_DEBUG
200         btst    #13,%d2
201         jeq     1f
202         printf  PDECODE,"->"            | fpu -> cpu
203         jra     2f
204 1:      printf  PDECODE,"<-"            | fpu <- cpu
206 #endif
208         | decode address mode
209         fp_decode_addr_mode
211         .long   fpc_data, fpc_addr
212         .long   fpc_indirect, fpc_postinc
213         .long   fpc_predecr, fpc_disp16
214         .long   fpc_extmode0, fpc_extmode1
216 fpc_data:
217         fp_mode_data_direct
218         move.w  %d0,%d1
219         bfffo   %d2{#19,#3},%d0
220         sub.w   #19,%d0
221         lea     (FPD_FPCR,FPDATA,%d0.w*4),%a1
222         btst    #13,%d2
223         jne     1f
224         move.w  %d1,%d0
225         jsr     fp_get_data_reg
226         move.l  %d0,(%a1)
227         jra     fpc_movem_fin
228 1:      move.l  (%a1),%d0
229         jsr     fp_put_data_reg
230         jra     fpc_movem_fin
232 fpc_addr:
233         fp_decode_addr_reg
234         printf  PDECODE,"a%d",1,%d0
235         btst    #13,%d2
236         jne     1f
237         jsr     fp_get_addr_reg
238         move.l  %a0,(FPD_FPIAR,FPDATA)
239         jra     fpc_movem_fin
240 1:      move.l  (FPD_FPIAR,FPDATA),%a0
241         jsr     fp_put_addr_reg
242         jra     fpc_movem_fin
244 fpc_indirect:
245         fp_mode_addr_indirect
246         jra     fpc_do_movem
248 fpc_postinc:
249         fp_mode_addr_indirect_postinc
250         jra     fpc_do_movem
252 fpc_predecr:
253         fp_mode_addr_indirect_predec
254         jra     fpc_do_movem
256 fpc_disp16:
257         fp_mode_addr_indirect_disp16
258         jra     fpc_do_movem
260 fpc_extmode0:
261         fp_mode_addr_indirect_extmode0
262         jra     fpc_do_movem
264 fpc_extmode1:
265         fp_decode_addr_reg
266         jmp     ([0f:w,%pc,%d0*4])
268         .align  4
270         .long   fpc_absolute_short, fpc_absolute_long
271         .long   fpc_disp16, fpc_extmode0
272         .long   fpc_immediate, fp_ill
273         .long   fp_ill, fp_ill
275 fpc_absolute_short:
276         fp_mode_abs_short
277         jra     fpc_do_movem
279 fpc_absolute_long:
280         fp_mode_abs_long
281         jra     fpc_do_movem
283 fpc_immediate:
284         fp_get_pc %a0
285         lea     (%a0,%d1.w*4),%a1
286         fp_put_pc %a1
287         printf  PDECODE,"#imm"
288 |       jra     fpc_do_movem
290 fpc_do_movem:
291         swap    %d1                     | get fpu register list
292         lsl.l   #5,%d1
293         lea     (FPD_FPCR,FPDATA),%a1
294 1:      btst    #13,%d2
295         jne     4f
297         | move register from memory into fpu
298         jra     3f
299 1:      printf  PMOVEM,"(%p>%p)",2,%a0,%a1
300         getuser.l (%a0)+,%d0,fp_err_ua1,%a0
301         move.l  %d0,(%a1)
302 2:      addq.l  #4,%a1
303 3:      lsl.b   #1,%d1
304         jcs     1b
305         jne     2b
306         jra     fpc_movem_fin
308         | move register from fpu into memory
309 1:      printf  PMOVEM,"(%p>%p)",2,%a1,%a0
310         move.l  (%a1),%d0
311         putuser.l %d0,(%a0)+,fp_err_ua1,%a0
312 2:      addq.l  #4,%a1
313 4:      lsl.b   #1,%d1
314         jcs     1b
315         jne     2b
317 fpc_movem_fin:
318         and.l   #0x0000fff0,(FPD_FPCR,FPDATA)
319         and.l   #0x0ffffff8,(FPD_FPSR,FPDATA)
320         move.l  (FPD_FPCR,FPDATA),%d0
321         lsr.l   #4,%d0
322         moveq   #3,%d1
323         and.l   %d0,%d1
324         move.w  %d1,(FPD_RND,FPDATA)
325         lsr.l   #2,%d0
326         moveq   #3,%d1
327         and.l   %d0,%d1
328         move.w  %d1,(FPD_PREC,FPDATA)
329         printf  PDECODE,"\n"
330         jra     fp_end