1 /* 1 /* 2 * fp_move.S 2 * fp_move.S 3 * 3 * 4 * Copyright Roman Zippel, 1997. All rights r 4 * Copyright Roman Zippel, 1997. All rights reserved. 5 * 5 * 6 * Redistribution and use in source and binary 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that t 7 * modification, are permitted provided that the following conditions 8 * are met: 8 * are met: 9 * 1. Redistributions of source code must reta 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, and the entire permission notice 10 * notice, and the entire permission notice in its entirety, 11 * including the disclaimer of warranties. 11 * including the disclaimer of warranties. 12 * 2. Redistributions in binary form must repr 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials pro 14 * documentation and/or other materials provided with the distribution. 15 * 3. The name of the author may not be used t 15 * 3. The name of the author may not be used to endorse or promote 16 * products derived from this software with 16 * products derived from this software without specific prior 17 * written permission. 17 * written permission. 18 * 18 * 19 * ALTERNATIVELY, this product may be distribu 19 * ALTERNATIVELY, this product may be distributed under the terms of 20 * the GNU General Public License, in which ca 20 * the GNU General Public License, in which case the provisions of the GPL are 21 * required INSTEAD OF the above restrictions. 21 * required INSTEAD OF the above restrictions. (This clause is 22 * necessary due to a potential bad interactio 22 * necessary due to a potential bad interaction between the GPL and 23 * the restrictions contained in a BSD-style c 23 * the restrictions contained in a BSD-style copyright.) 24 * 24 * 25 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY 25 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 * OF MERCHANTABILITY AND FITNESS FOR A PARTIC 27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR B 28 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, O 29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILI 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIG 33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS S 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 35 * OF THE POSSIBILITY OF SUCH DAMAGE. 35 * OF THE POSSIBILITY OF SUCH DAMAGE. 36 */ 36 */ 37 37 38 #include "fp_emu.h" 38 #include "fp_emu.h" 39 #include "fp_decode.h" 39 #include "fp_decode.h" 40 40 41 do_no_pc_mode=1 41 do_no_pc_mode=1 42 42 43 .globl fp_fmove_fp2mem 43 .globl fp_fmove_fp2mem 44 44 45 fp_fmove_fp2mem: 45 fp_fmove_fp2mem: 46 clr.b (2+FPD_FPSR,FPDATA) 46 clr.b (2+FPD_FPSR,FPDATA) 47 fp_decode_dest_format 47 fp_decode_dest_format 48 move.w %d0,%d1 | stor 48 move.w %d0,%d1 | store data size twice in %d1 49 swap %d1 | one 49 swap %d1 | one can be trashed below 50 move.w %d0,%d1 50 move.w %d0,%d1 51 #ifdef FPU_EMU_DEBUG 51 #ifdef FPU_EMU_DEBUG 52 lea 0f,%a0 52 lea 0f,%a0 53 clr.l %d0 53 clr.l %d0 54 move.b (%a0,%d1.w),%d0 54 move.b (%a0,%d1.w),%d0 55 printf PDECODE,"fmove.%c ",1,%d0 55 printf PDECODE,"fmove.%c ",1,%d0 56 fp_decode_src_reg 56 fp_decode_src_reg 57 printf PDECODE,"fp%d,",1,%d0 57 printf PDECODE,"fp%d,",1,%d0 58 58 59 .data 59 .data 60 0: .byte 'l','s','x','p','w','d','b','p 60 0: .byte 'l','s','x','p','w','d','b','p' 61 .previous 61 .previous 62 #endif 62 #endif 63 63 64 | encode addressing mode for dest 64 | encode addressing mode for dest 65 fp_decode_addr_mode 65 fp_decode_addr_mode 66 66 67 .long fp_data, fp_ill 67 .long fp_data, fp_ill 68 .long fp_indirect, fp_postinc 68 .long fp_indirect, fp_postinc 69 .long fp_predecr, fp_disp16 69 .long fp_predecr, fp_disp16 70 .long fp_extmode0, fp_extmode1 70 .long fp_extmode0, fp_extmode1 71 71 72 | addressing mode: data register direc 72 | addressing mode: data register direct 73 fp_data: 73 fp_data: 74 fp_mode_data_direct 74 fp_mode_data_direct 75 move.w %d0,%d1 75 move.w %d0,%d1 76 fp_decode_src_reg 76 fp_decode_src_reg 77 fp_get_fp_reg 77 fp_get_fp_reg 78 lea (FPD_TEMPFP1,FPDATA),%a1 78 lea (FPD_TEMPFP1,FPDATA),%a1 79 move.l (%a0)+,(%a1)+ 79 move.l (%a0)+,(%a1)+ 80 move.l (%a0)+,(%a1)+ 80 move.l (%a0)+,(%a1)+ 81 move.l (%a0),(%a1) 81 move.l (%a0),(%a1) 82 lea (-8,%a1),%a0 82 lea (-8,%a1),%a0 83 swap %d1 83 swap %d1 84 move.l %d1,%d2 84 move.l %d1,%d2 85 printf PDECODE,"\n" 85 printf PDECODE,"\n" 86 jmp ([0f:w,%pc,%d1.w*4]) 86 jmp ([0f:w,%pc,%d1.w*4]) 87 87 88 .align 4 88 .align 4 89 0: 89 0: 90 .long fp_data_long, fp_data_single 90 .long fp_data_long, fp_data_single 91 .long fp_ill, fp_ill 91 .long fp_ill, fp_ill 92 .long fp_data_word, fp_ill 92 .long fp_data_word, fp_ill 93 .long fp_data_byte, fp_ill 93 .long fp_data_byte, fp_ill 94 94 95 fp_data_byte: 95 fp_data_byte: 96 jsr fp_normalize_ext 96 jsr fp_normalize_ext 97 jsr fp_conv_ext2byte 97 jsr fp_conv_ext2byte 98 move.l %d0,%d1 98 move.l %d0,%d1 99 swap %d2 99 swap %d2 100 move.w %d2,%d0 100 move.w %d2,%d0 101 jsr fp_get_data_reg 101 jsr fp_get_data_reg 102 move.b %d1,%d0 102 move.b %d1,%d0 103 move.w %d2,%d1 103 move.w %d2,%d1 104 jsr fp_put_data_reg 104 jsr fp_put_data_reg 105 jra fp_final 105 jra fp_final 106 106 107 fp_data_word: 107 fp_data_word: 108 jsr fp_normalize_ext 108 jsr fp_normalize_ext 109 jsr fp_conv_ext2short 109 jsr fp_conv_ext2short 110 move.l %d0,%d1 110 move.l %d0,%d1 111 swap %d2 111 swap %d2 112 move.w %d2,%d0 112 move.w %d2,%d0 113 jsr fp_get_data_reg 113 jsr fp_get_data_reg 114 move.w %d1,%d0 114 move.w %d1,%d0 115 move.l %d2,%d1 115 move.l %d2,%d1 116 jsr fp_put_data_reg 116 jsr fp_put_data_reg 117 jra fp_final 117 jra fp_final 118 118 119 fp_data_long: 119 fp_data_long: 120 jsr fp_normalize_ext 120 jsr fp_normalize_ext 121 jsr fp_conv_ext2long 121 jsr fp_conv_ext2long 122 swap %d2 122 swap %d2 123 move.w %d2,%d1 123 move.w %d2,%d1 124 jsr fp_put_data_reg 124 jsr fp_put_data_reg 125 jra fp_final 125 jra fp_final 126 126 127 fp_data_single: 127 fp_data_single: 128 jsr fp_normalize_ext 128 jsr fp_normalize_ext 129 jsr fp_conv_ext2single 129 jsr fp_conv_ext2single 130 swap %d2 130 swap %d2 131 move.w %d2,%d1 131 move.w %d2,%d1 132 jsr fp_put_data_reg 132 jsr fp_put_data_reg 133 jra fp_final 133 jra fp_final 134 134 135 | addressing mode: address register in 135 | addressing mode: address register indirect 136 fp_indirect: 136 fp_indirect: 137 fp_mode_addr_indirect 137 fp_mode_addr_indirect 138 jra fp_putdest 138 jra fp_putdest 139 139 140 | addressing mode: address register in 140 | addressing mode: address register indirect with postincrement 141 fp_postinc: 141 fp_postinc: 142 fp_mode_addr_indirect_postinc 142 fp_mode_addr_indirect_postinc 143 jra fp_putdest 143 jra fp_putdest 144 144 145 | addressing mode: address register in 145 | addressing mode: address register indirect with predecrement 146 fp_predecr: 146 fp_predecr: 147 fp_mode_addr_indirect_predec 147 fp_mode_addr_indirect_predec 148 jra fp_putdest 148 jra fp_putdest 149 149 150 | addressing mode: address register in 150 | addressing mode: address register indirect with 16bit displacement 151 fp_disp16: 151 fp_disp16: 152 fp_mode_addr_indirect_disp16 152 fp_mode_addr_indirect_disp16 153 jra fp_putdest 153 jra fp_putdest 154 154 155 fp_extmode0: 155 fp_extmode0: 156 fp_mode_addr_indirect_extmode0 156 fp_mode_addr_indirect_extmode0 157 jra fp_putdest 157 jra fp_putdest 158 158 159 fp_extmode1: 159 fp_extmode1: 160 fp_decode_addr_reg 160 fp_decode_addr_reg 161 jmp ([0f:w,%pc,%d0*4]) 161 jmp ([0f:w,%pc,%d0*4]) 162 162 163 .align 4 163 .align 4 164 0: 164 0: 165 .long fp_abs_short, fp_abs_long 165 .long fp_abs_short, fp_abs_long 166 .long fp_ill, fp_ill 166 .long fp_ill, fp_ill 167 .long fp_ill, fp_ill 167 .long fp_ill, fp_ill 168 .long fp_ill, fp_ill 168 .long fp_ill, fp_ill 169 169 170 fp_abs_short: 170 fp_abs_short: 171 fp_mode_abs_short 171 fp_mode_abs_short 172 jra fp_putdest 172 jra fp_putdest 173 173 174 fp_abs_long: 174 fp_abs_long: 175 fp_mode_abs_long 175 fp_mode_abs_long 176 jra fp_putdest 176 jra fp_putdest 177 177 178 fp_putdest: 178 fp_putdest: 179 move.l %a0,%a1 179 move.l %a0,%a1 180 fp_decode_src_reg 180 fp_decode_src_reg 181 move.l %d1,%d2 | save 181 move.l %d1,%d2 | save size 182 fp_get_fp_reg 182 fp_get_fp_reg 183 printf PDECODE,"\n" 183 printf PDECODE,"\n" 184 addq.l #8,%a0 184 addq.l #8,%a0 185 move.l (%a0),-(%sp) 185 move.l (%a0),-(%sp) 186 move.l -(%a0),-(%sp) 186 move.l -(%a0),-(%sp) 187 move.l -(%a0),-(%sp) 187 move.l -(%a0),-(%sp) 188 move.l %sp,%a0 188 move.l %sp,%a0 189 jsr fp_normalize_ext 189 jsr fp_normalize_ext 190 190 191 swap %d2 191 swap %d2 192 jmp ([0f:w,%pc,%d2.w*4]) 192 jmp ([0f:w,%pc,%d2.w*4]) 193 193 194 .align 4 194 .align 4 195 0: 195 0: 196 .long fp_format_long, fp_format_sing 196 .long fp_format_long, fp_format_single 197 .long fp_format_extended, fp_format_ 197 .long fp_format_extended, fp_format_packed 198 .long fp_format_word, fp_format_doub 198 .long fp_format_word, fp_format_double 199 .long fp_format_byte, fp_format_pack 199 .long fp_format_byte, fp_format_packed 200 200 201 fp_format_long: 201 fp_format_long: 202 jsr fp_conv_ext2long 202 jsr fp_conv_ext2long 203 putuser.l %d0,(%a1),fp_err_ua1,%a1 203 putuser.l %d0,(%a1),fp_err_ua1,%a1 204 jra fp_finish_move 204 jra fp_finish_move 205 205 206 fp_format_single: 206 fp_format_single: 207 jsr fp_conv_ext2single 207 jsr fp_conv_ext2single 208 putuser.l %d0,(%a1),fp_err_ua1,%a1 208 putuser.l %d0,(%a1),fp_err_ua1,%a1 209 jra fp_finish_move 209 jra fp_finish_move 210 210 211 fp_format_extended: 211 fp_format_extended: 212 move.l (%a0)+,%d0 212 move.l (%a0)+,%d0 213 lsl.w #1,%d0 213 lsl.w #1,%d0 214 lsl.l #7,%d0 214 lsl.l #7,%d0 215 lsl.l #8,%d0 215 lsl.l #8,%d0 216 putuser.l %d0,(%a1)+,fp_err_ua1,%a1 216 putuser.l %d0,(%a1)+,fp_err_ua1,%a1 217 move.l (%a0)+,%d0 217 move.l (%a0)+,%d0 218 putuser.l %d0,(%a1)+,fp_err_ua1,%a1 218 putuser.l %d0,(%a1)+,fp_err_ua1,%a1 219 move.l (%a0),%d0 219 move.l (%a0),%d0 220 putuser.l %d0,(%a1),fp_err_ua1,%a1 220 putuser.l %d0,(%a1),fp_err_ua1,%a1 221 jra fp_finish_move 221 jra fp_finish_move 222 222 223 fp_format_packed: 223 fp_format_packed: 224 /* not supported yet */ 224 /* not supported yet */ 225 lea (12,%sp),%sp 225 lea (12,%sp),%sp 226 jra fp_ill 226 jra fp_ill 227 227 228 fp_format_word: 228 fp_format_word: 229 jsr fp_conv_ext2short 229 jsr fp_conv_ext2short 230 putuser.w %d0,(%a1),fp_err_ua1,%a1 230 putuser.w %d0,(%a1),fp_err_ua1,%a1 231 jra fp_finish_move 231 jra fp_finish_move 232 232 233 fp_format_double: 233 fp_format_double: 234 jsr fp_conv_ext2double 234 jsr fp_conv_ext2double 235 jra fp_finish_move 235 jra fp_finish_move 236 236 237 fp_format_byte: 237 fp_format_byte: 238 jsr fp_conv_ext2byte 238 jsr fp_conv_ext2byte 239 putuser.b %d0,(%a1),fp_err_ua1,%a1 239 putuser.b %d0,(%a1),fp_err_ua1,%a1 240 | jra fp_finish_move 240 | jra fp_finish_move 241 241 242 fp_finish_move: 242 fp_finish_move: 243 lea (12,%sp),%sp 243 lea (12,%sp),%sp 244 jra fp_final 244 jra fp_final
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.