root / target-sh4 / translate.c @ 86cc1ce0
History | View | Annotate | Download (32.2 kB)
1 | fdf9b3e8 | bellard | /*
|
---|---|---|---|
2 | fdf9b3e8 | bellard | * SH4 translation
|
3 | fdf9b3e8 | bellard | *
|
4 | fdf9b3e8 | bellard | * Copyright (c) 2005 Samuel Tardieu
|
5 | fdf9b3e8 | bellard | *
|
6 | fdf9b3e8 | bellard | * This library is free software; you can redistribute it and/or
|
7 | fdf9b3e8 | bellard | * modify it under the terms of the GNU Lesser General Public
|
8 | fdf9b3e8 | bellard | * License as published by the Free Software Foundation; either
|
9 | fdf9b3e8 | bellard | * version 2 of the License, or (at your option) any later version.
|
10 | fdf9b3e8 | bellard | *
|
11 | fdf9b3e8 | bellard | * This library is distributed in the hope that it will be useful,
|
12 | fdf9b3e8 | bellard | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | fdf9b3e8 | bellard | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | fdf9b3e8 | bellard | * Lesser General Public License for more details.
|
15 | fdf9b3e8 | bellard | *
|
16 | fdf9b3e8 | bellard | * You should have received a copy of the GNU Lesser General Public
|
17 | fdf9b3e8 | bellard | * License along with this library; if not, write to the Free Software
|
18 | fdf9b3e8 | bellard | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | fdf9b3e8 | bellard | */
|
20 | fdf9b3e8 | bellard | #include <stdarg.h> |
21 | fdf9b3e8 | bellard | #include <stdlib.h> |
22 | fdf9b3e8 | bellard | #include <stdio.h> |
23 | fdf9b3e8 | bellard | #include <string.h> |
24 | fdf9b3e8 | bellard | #include <inttypes.h> |
25 | fdf9b3e8 | bellard | #include <assert.h> |
26 | fdf9b3e8 | bellard | |
27 | fdf9b3e8 | bellard | #define DEBUG_DISAS
|
28 | fdf9b3e8 | bellard | #define SH4_DEBUG_DISAS
|
29 | fdf9b3e8 | bellard | //#define SH4_SINGLE_STEP
|
30 | fdf9b3e8 | bellard | |
31 | fdf9b3e8 | bellard | #include "cpu.h" |
32 | fdf9b3e8 | bellard | #include "exec-all.h" |
33 | fdf9b3e8 | bellard | #include "disas.h" |
34 | fdf9b3e8 | bellard | |
35 | fdf9b3e8 | bellard | enum {
|
36 | fdf9b3e8 | bellard | #define DEF(s, n, copy_size) INDEX_op_ ## s, |
37 | fdf9b3e8 | bellard | #include "opc.h" |
38 | fdf9b3e8 | bellard | #undef DEF
|
39 | fdf9b3e8 | bellard | NB_OPS, |
40 | fdf9b3e8 | bellard | }; |
41 | fdf9b3e8 | bellard | |
42 | fdf9b3e8 | bellard | #ifdef USE_DIRECT_JUMP
|
43 | fdf9b3e8 | bellard | #define TBPARAM(x)
|
44 | fdf9b3e8 | bellard | #else
|
45 | fdf9b3e8 | bellard | #define TBPARAM(x) ((long)(x)) |
46 | fdf9b3e8 | bellard | #endif
|
47 | fdf9b3e8 | bellard | |
48 | fdf9b3e8 | bellard | static uint16_t *gen_opc_ptr;
|
49 | fdf9b3e8 | bellard | static uint32_t *gen_opparam_ptr;
|
50 | fdf9b3e8 | bellard | |
51 | fdf9b3e8 | bellard | #include "gen-op.h" |
52 | fdf9b3e8 | bellard | |
53 | fdf9b3e8 | bellard | typedef struct DisasContext { |
54 | fdf9b3e8 | bellard | struct TranslationBlock *tb;
|
55 | fdf9b3e8 | bellard | target_ulong pc; |
56 | fdf9b3e8 | bellard | uint32_t sr; |
57 | eda9b09b | bellard | uint32_t fpscr; |
58 | fdf9b3e8 | bellard | uint16_t opcode; |
59 | fdf9b3e8 | bellard | uint32_t flags; |
60 | fdf9b3e8 | bellard | int memidx;
|
61 | fdf9b3e8 | bellard | uint32_t delayed_pc; |
62 | fdf9b3e8 | bellard | int singlestep_enabled;
|
63 | fdf9b3e8 | bellard | } DisasContext; |
64 | fdf9b3e8 | bellard | |
65 | fdf9b3e8 | bellard | #ifdef CONFIG_USER_ONLY
|
66 | fdf9b3e8 | bellard | |
67 | eda9b09b | bellard | #define GEN_OP_LD(width, reg) \
|
68 | eda9b09b | bellard | void gen_op_ld##width##_T0_##reg (DisasContext *ctx) { \ |
69 | eda9b09b | bellard | gen_op_ld##width##_T0_##reg##_raw(); \ |
70 | fdf9b3e8 | bellard | } |
71 | eda9b09b | bellard | #define GEN_OP_ST(width, reg) \
|
72 | eda9b09b | bellard | void gen_op_st##width##_##reg##_T1 (DisasContext *ctx) { \ |
73 | eda9b09b | bellard | gen_op_st##width##_##reg##_T1_raw(); \ |
74 | fdf9b3e8 | bellard | } |
75 | fdf9b3e8 | bellard | |
76 | fdf9b3e8 | bellard | #else
|
77 | fdf9b3e8 | bellard | |
78 | eda9b09b | bellard | #define GEN_OP_LD(width, reg) \
|
79 | eda9b09b | bellard | void gen_op_ld##width##_T0_##reg (DisasContext *ctx) { \ |
80 | eda9b09b | bellard | if (ctx->memidx) gen_op_ld##width##_T0_##reg##_kernel(); \ |
81 | eda9b09b | bellard | else gen_op_ld##width##_T0_##reg##_user();\ |
82 | fdf9b3e8 | bellard | } |
83 | eda9b09b | bellard | #define GEN_OP_ST(width, reg) \
|
84 | eda9b09b | bellard | void gen_op_st##width##_##reg##_T1 (DisasContext *ctx) { \ |
85 | eda9b09b | bellard | if (ctx->memidx) gen_op_st##width##_##reg##_T1_kernel(); \ |
86 | eda9b09b | bellard | else gen_op_st##width##_##reg##_T1_user();\ |
87 | fdf9b3e8 | bellard | } |
88 | fdf9b3e8 | bellard | |
89 | fdf9b3e8 | bellard | #endif
|
90 | fdf9b3e8 | bellard | |
91 | eda9b09b | bellard | GEN_OP_LD(ub, T0) |
92 | eda9b09b | bellard | GEN_OP_LD(b, T0) |
93 | eda9b09b | bellard | GEN_OP_ST(b, T0) |
94 | eda9b09b | bellard | GEN_OP_LD(uw, T0) |
95 | eda9b09b | bellard | GEN_OP_LD(w, T0) |
96 | eda9b09b | bellard | GEN_OP_ST(w, T0) |
97 | eda9b09b | bellard | GEN_OP_LD(l, T0) |
98 | eda9b09b | bellard | GEN_OP_ST(l, T0) |
99 | eda9b09b | bellard | GEN_OP_LD(fl, FT0) |
100 | eda9b09b | bellard | GEN_OP_ST(fl, FT0) |
101 | eda9b09b | bellard | GEN_OP_LD(fq, DT0) |
102 | eda9b09b | bellard | GEN_OP_ST(fq, DT0) |
103 | fdf9b3e8 | bellard | |
104 | fdf9b3e8 | bellard | void cpu_dump_state(CPUState * env, FILE * f,
|
105 | fdf9b3e8 | bellard | int (*cpu_fprintf) (FILE * f, const char *fmt, ...), |
106 | fdf9b3e8 | bellard | int flags)
|
107 | fdf9b3e8 | bellard | { |
108 | fdf9b3e8 | bellard | int i;
|
109 | eda9b09b | bellard | cpu_fprintf(f, "pc=0x%08x sr=0x%08x pr=0x%08x fpscr=0x%08x\n",
|
110 | eda9b09b | bellard | env->pc, env->sr, env->pr, env->fpscr); |
111 | fdf9b3e8 | bellard | for (i = 0; i < 24; i += 4) { |
112 | fdf9b3e8 | bellard | cpu_fprintf(f, "r%d=0x%08x r%d=0x%08x r%d=0x%08x r%d=0x%08x\n",
|
113 | fdf9b3e8 | bellard | i, env->gregs[i], i + 1, env->gregs[i + 1], |
114 | fdf9b3e8 | bellard | i + 2, env->gregs[i + 2], i + 3, env->gregs[i + 3]); |
115 | fdf9b3e8 | bellard | } |
116 | fdf9b3e8 | bellard | if (env->flags & DELAY_SLOT) {
|
117 | fdf9b3e8 | bellard | cpu_fprintf(f, "in delay slot (delayed_pc=0x%08x)\n",
|
118 | fdf9b3e8 | bellard | env->delayed_pc); |
119 | fdf9b3e8 | bellard | } else if (env->flags & DELAY_SLOT_CONDITIONAL) { |
120 | fdf9b3e8 | bellard | cpu_fprintf(f, "in conditional delay slot (delayed_pc=0x%08x)\n",
|
121 | fdf9b3e8 | bellard | env->delayed_pc); |
122 | fdf9b3e8 | bellard | } |
123 | fdf9b3e8 | bellard | } |
124 | fdf9b3e8 | bellard | |
125 | fdf9b3e8 | bellard | void cpu_sh4_reset(CPUSH4State * env)
|
126 | fdf9b3e8 | bellard | { |
127 | 9c2a9ea1 | pbrook | #if defined(CONFIG_USER_ONLY)
|
128 | 9c2a9ea1 | pbrook | env->sr = 0x00000000;
|
129 | 9c2a9ea1 | pbrook | #else
|
130 | fdf9b3e8 | bellard | env->sr = 0x700000F0; /* MD, RB, BL, I3-I0 */ |
131 | 9c2a9ea1 | pbrook | #endif
|
132 | fdf9b3e8 | bellard | env->vbr = 0;
|
133 | fdf9b3e8 | bellard | env->pc = 0xA0000000;
|
134 | fdf9b3e8 | bellard | env->fpscr = 0x00040001;
|
135 | fdf9b3e8 | bellard | env->mmucr = 0;
|
136 | fdf9b3e8 | bellard | } |
137 | fdf9b3e8 | bellard | |
138 | fdf9b3e8 | bellard | CPUSH4State *cpu_sh4_init(void)
|
139 | fdf9b3e8 | bellard | { |
140 | fdf9b3e8 | bellard | CPUSH4State *env; |
141 | fdf9b3e8 | bellard | |
142 | fdf9b3e8 | bellard | env = qemu_mallocz(sizeof(CPUSH4State));
|
143 | fdf9b3e8 | bellard | if (!env)
|
144 | fdf9b3e8 | bellard | return NULL; |
145 | fdf9b3e8 | bellard | cpu_exec_init(env); |
146 | fdf9b3e8 | bellard | cpu_sh4_reset(env); |
147 | fdf9b3e8 | bellard | tlb_flush(env, 1);
|
148 | fdf9b3e8 | bellard | return env;
|
149 | fdf9b3e8 | bellard | } |
150 | fdf9b3e8 | bellard | |
151 | fdf9b3e8 | bellard | static void gen_goto_tb(DisasContext * ctx, int n, target_ulong dest) |
152 | fdf9b3e8 | bellard | { |
153 | fdf9b3e8 | bellard | TranslationBlock *tb; |
154 | fdf9b3e8 | bellard | tb = ctx->tb; |
155 | fdf9b3e8 | bellard | |
156 | fdf9b3e8 | bellard | if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) &&
|
157 | fdf9b3e8 | bellard | !ctx->singlestep_enabled) { |
158 | fdf9b3e8 | bellard | /* Use a direct jump if in same page and singlestep not enabled */
|
159 | fdf9b3e8 | bellard | if (n == 0) |
160 | fdf9b3e8 | bellard | gen_op_goto_tb0(TBPARAM(tb)); |
161 | fdf9b3e8 | bellard | else
|
162 | fdf9b3e8 | bellard | gen_op_goto_tb1(TBPARAM(tb)); |
163 | fdf9b3e8 | bellard | gen_op_movl_imm_T0((long) tb + n);
|
164 | fdf9b3e8 | bellard | } else {
|
165 | fdf9b3e8 | bellard | gen_op_movl_imm_T0(0);
|
166 | fdf9b3e8 | bellard | } |
167 | fdf9b3e8 | bellard | gen_op_movl_imm_PC(dest); |
168 | fdf9b3e8 | bellard | if (ctx->singlestep_enabled)
|
169 | fdf9b3e8 | bellard | gen_op_debug(); |
170 | fdf9b3e8 | bellard | gen_op_exit_tb(); |
171 | fdf9b3e8 | bellard | } |
172 | fdf9b3e8 | bellard | |
173 | fdf9b3e8 | bellard | /* Jump to pc after an exception */
|
174 | fdf9b3e8 | bellard | static void gen_jump_exception(DisasContext * ctx) |
175 | fdf9b3e8 | bellard | { |
176 | fdf9b3e8 | bellard | gen_op_movl_imm_T0(0);
|
177 | fdf9b3e8 | bellard | if (ctx->singlestep_enabled)
|
178 | fdf9b3e8 | bellard | gen_op_debug(); |
179 | fdf9b3e8 | bellard | gen_op_exit_tb(); |
180 | fdf9b3e8 | bellard | } |
181 | fdf9b3e8 | bellard | |
182 | fdf9b3e8 | bellard | static void gen_jump(DisasContext * ctx) |
183 | fdf9b3e8 | bellard | { |
184 | fdf9b3e8 | bellard | if (ctx->delayed_pc == (uint32_t) - 1) { |
185 | fdf9b3e8 | bellard | /* Target is not statically known, it comes necessarily from a
|
186 | fdf9b3e8 | bellard | delayed jump as immediate jump are conditinal jumps */
|
187 | fdf9b3e8 | bellard | gen_op_movl_delayed_pc_PC(); |
188 | fdf9b3e8 | bellard | gen_op_movl_imm_T0(0);
|
189 | fdf9b3e8 | bellard | if (ctx->singlestep_enabled)
|
190 | fdf9b3e8 | bellard | gen_op_debug(); |
191 | fdf9b3e8 | bellard | gen_op_exit_tb(); |
192 | fdf9b3e8 | bellard | } else {
|
193 | fdf9b3e8 | bellard | gen_goto_tb(ctx, 0, ctx->delayed_pc);
|
194 | fdf9b3e8 | bellard | } |
195 | fdf9b3e8 | bellard | } |
196 | fdf9b3e8 | bellard | |
197 | fdf9b3e8 | bellard | /* Immediate conditional jump (bt or bf) */
|
198 | fdf9b3e8 | bellard | static void gen_conditional_jump(DisasContext * ctx, |
199 | fdf9b3e8 | bellard | target_ulong ift, target_ulong ifnott) |
200 | fdf9b3e8 | bellard | { |
201 | fdf9b3e8 | bellard | int l1;
|
202 | fdf9b3e8 | bellard | |
203 | fdf9b3e8 | bellard | l1 = gen_new_label(); |
204 | fdf9b3e8 | bellard | gen_op_jT(l1); |
205 | fdf9b3e8 | bellard | gen_goto_tb(ctx, 0, ifnott);
|
206 | fdf9b3e8 | bellard | gen_set_label(l1); |
207 | fdf9b3e8 | bellard | gen_goto_tb(ctx, 1, ift);
|
208 | fdf9b3e8 | bellard | } |
209 | fdf9b3e8 | bellard | |
210 | fdf9b3e8 | bellard | /* Delayed conditional jump (bt or bf) */
|
211 | fdf9b3e8 | bellard | static void gen_delayed_conditional_jump(DisasContext * ctx) |
212 | fdf9b3e8 | bellard | { |
213 | fdf9b3e8 | bellard | int l1;
|
214 | fdf9b3e8 | bellard | |
215 | fdf9b3e8 | bellard | l1 = gen_new_label(); |
216 | 9c2a9ea1 | pbrook | gen_op_jdelayed(l1); |
217 | 9c2a9ea1 | pbrook | gen_goto_tb(ctx, 1, ctx->pc);
|
218 | fdf9b3e8 | bellard | gen_set_label(l1); |
219 | 9c2a9ea1 | pbrook | gen_jump(ctx); |
220 | fdf9b3e8 | bellard | } |
221 | fdf9b3e8 | bellard | |
222 | fdf9b3e8 | bellard | #define B3_0 (ctx->opcode & 0xf) |
223 | fdf9b3e8 | bellard | #define B6_4 ((ctx->opcode >> 4) & 0x7) |
224 | fdf9b3e8 | bellard | #define B7_4 ((ctx->opcode >> 4) & 0xf) |
225 | fdf9b3e8 | bellard | #define B7_0 (ctx->opcode & 0xff) |
226 | fdf9b3e8 | bellard | #define B7_0s ((int32_t) (int8_t) (ctx->opcode & 0xff)) |
227 | fdf9b3e8 | bellard | #define B11_0s (ctx->opcode & 0x800 ? 0xfffff000 | (ctx->opcode & 0xfff) : \ |
228 | fdf9b3e8 | bellard | (ctx->opcode & 0xfff))
|
229 | fdf9b3e8 | bellard | #define B11_8 ((ctx->opcode >> 8) & 0xf) |
230 | fdf9b3e8 | bellard | #define B15_12 ((ctx->opcode >> 12) & 0xf) |
231 | fdf9b3e8 | bellard | |
232 | fdf9b3e8 | bellard | #define REG(x) ((x) < 8 && (ctx->sr & (SR_MD | SR_RB)) == (SR_MD | SR_RB) ? \ |
233 | fdf9b3e8 | bellard | (x) + 16 : (x))
|
234 | fdf9b3e8 | bellard | |
235 | fdf9b3e8 | bellard | #define ALTREG(x) ((x) < 8 && (ctx->sr & (SR_MD | SR_RB)) != (SR_MD | SR_RB) \ |
236 | fdf9b3e8 | bellard | ? (x) + 16 : (x))
|
237 | fdf9b3e8 | bellard | |
238 | eda9b09b | bellard | #define FREG(x) (ctx->fpscr & FPSCR_FR ? (x) ^ 0x10 : (x)) |
239 | eda9b09b | bellard | #define XHACK(x) (((x) & 1 ) << 4 | ((x) & 0xe ) << 1) |
240 | eda9b09b | bellard | #define XREG(x) (ctx->fpscr & FPSCR_FR ? XHACK(x) ^ 0x10 : XHACK(x)) |
241 | eda9b09b | bellard | |
242 | fdf9b3e8 | bellard | #define CHECK_NOT_DELAY_SLOT \
|
243 | fdf9b3e8 | bellard | if (ctx->flags & (DELAY_SLOT | DELAY_SLOT_CONDITIONAL)) \
|
244 | fdf9b3e8 | bellard | {gen_op_raise_slot_illegal_instruction (); ctx->flags |= BRANCH_EXCEPTION; \ |
245 | fdf9b3e8 | bellard | return;}
|
246 | fdf9b3e8 | bellard | |
247 | fdf9b3e8 | bellard | void decode_opc(DisasContext * ctx)
|
248 | fdf9b3e8 | bellard | { |
249 | fdf9b3e8 | bellard | #if 0
|
250 | fdf9b3e8 | bellard | fprintf(stderr, "Translating opcode 0x%04x\n", ctx->opcode);
|
251 | fdf9b3e8 | bellard | #endif
|
252 | fdf9b3e8 | bellard | switch (ctx->opcode) {
|
253 | fdf9b3e8 | bellard | case 0x0019: /* div0u */ |
254 | fdf9b3e8 | bellard | gen_op_div0u(); |
255 | fdf9b3e8 | bellard | return;
|
256 | fdf9b3e8 | bellard | case 0x000b: /* rts */ |
257 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT gen_op_rts(); |
258 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT; |
259 | fdf9b3e8 | bellard | ctx->delayed_pc = (uint32_t) - 1;
|
260 | fdf9b3e8 | bellard | return;
|
261 | fdf9b3e8 | bellard | case 0x0028: /* clrmac */ |
262 | fdf9b3e8 | bellard | gen_op_clrmac(); |
263 | fdf9b3e8 | bellard | return;
|
264 | fdf9b3e8 | bellard | case 0x0048: /* clrs */ |
265 | fdf9b3e8 | bellard | gen_op_clrs(); |
266 | fdf9b3e8 | bellard | return;
|
267 | fdf9b3e8 | bellard | case 0x0008: /* clrt */ |
268 | fdf9b3e8 | bellard | gen_op_clrt(); |
269 | fdf9b3e8 | bellard | return;
|
270 | fdf9b3e8 | bellard | case 0x0038: /* ldtlb */ |
271 | fdf9b3e8 | bellard | assert(0); /* XXXXX */ |
272 | fdf9b3e8 | bellard | return;
|
273 | fdf9b3e8 | bellard | case 0x004b: /* rte */ |
274 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT gen_op_rte(); |
275 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT; |
276 | fdf9b3e8 | bellard | ctx->delayed_pc = (uint32_t) - 1;
|
277 | fdf9b3e8 | bellard | return;
|
278 | fdf9b3e8 | bellard | case 0x0058: /* sets */ |
279 | fdf9b3e8 | bellard | gen_op_sets(); |
280 | fdf9b3e8 | bellard | return;
|
281 | fdf9b3e8 | bellard | case 0x0018: /* sett */ |
282 | fdf9b3e8 | bellard | gen_op_sett(); |
283 | fdf9b3e8 | bellard | return;
|
284 | fdf9b3e8 | bellard | case 0xfbfb: /* frchg */ |
285 | eda9b09b | bellard | gen_op_frchg(); |
286 | eda9b09b | bellard | ctx->flags |= MODE_CHANGE; |
287 | fdf9b3e8 | bellard | return;
|
288 | fdf9b3e8 | bellard | case 0xf3fb: /* fschg */ |
289 | eda9b09b | bellard | gen_op_fschg(); |
290 | eda9b09b | bellard | ctx->flags |= MODE_CHANGE; |
291 | fdf9b3e8 | bellard | return;
|
292 | fdf9b3e8 | bellard | case 0x0009: /* nop */ |
293 | fdf9b3e8 | bellard | return;
|
294 | fdf9b3e8 | bellard | case 0x001b: /* sleep */ |
295 | fdf9b3e8 | bellard | assert(0); /* XXXXX */ |
296 | fdf9b3e8 | bellard | return;
|
297 | fdf9b3e8 | bellard | } |
298 | fdf9b3e8 | bellard | |
299 | fdf9b3e8 | bellard | switch (ctx->opcode & 0xf000) { |
300 | fdf9b3e8 | bellard | case 0x1000: /* mov.l Rm,@(disp,Rn) */ |
301 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
302 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
303 | fdf9b3e8 | bellard | gen_op_addl_imm_T1(B3_0 * 4);
|
304 | fdf9b3e8 | bellard | gen_op_stl_T0_T1(ctx); |
305 | fdf9b3e8 | bellard | return;
|
306 | fdf9b3e8 | bellard | case 0x5000: /* mov.l @(disp,Rm),Rn */ |
307 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
308 | fdf9b3e8 | bellard | gen_op_addl_imm_T0(B3_0 * 4);
|
309 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
310 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
311 | fdf9b3e8 | bellard | return;
|
312 | fdf9b3e8 | bellard | case 0xe000: /* mov.l #imm,Rn */ |
313 | fdf9b3e8 | bellard | gen_op_movl_imm_rN(B7_0s, REG(B11_8)); |
314 | fdf9b3e8 | bellard | return;
|
315 | fdf9b3e8 | bellard | case 0x9000: /* mov.w @(disp,PC),Rn */ |
316 | fdf9b3e8 | bellard | gen_op_movl_imm_T0(ctx->pc + 4 + B7_0 * 2); |
317 | fdf9b3e8 | bellard | gen_op_ldw_T0_T0(ctx); |
318 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
319 | fdf9b3e8 | bellard | return;
|
320 | fdf9b3e8 | bellard | case 0xd000: /* mov.l @(disp,PC),Rn */ |
321 | fdf9b3e8 | bellard | gen_op_movl_imm_T0((ctx->pc + 4 + B7_0 * 4) & ~3); |
322 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
323 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
324 | fdf9b3e8 | bellard | return;
|
325 | fdf9b3e8 | bellard | case 0x7000: /* add.l #imm,Rn */ |
326 | fdf9b3e8 | bellard | gen_op_add_imm_rN(B7_0s, REG(B11_8)); |
327 | fdf9b3e8 | bellard | return;
|
328 | fdf9b3e8 | bellard | case 0xa000: /* bra disp */ |
329 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT |
330 | fdf9b3e8 | bellard | gen_op_bra(ctx->delayed_pc = ctx->pc + 4 + B11_0s * 2); |
331 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT; |
332 | fdf9b3e8 | bellard | return;
|
333 | fdf9b3e8 | bellard | case 0xb000: /* bsr disp */ |
334 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT |
335 | fdf9b3e8 | bellard | gen_op_bsr(ctx->pc + 4, ctx->delayed_pc =
|
336 | fdf9b3e8 | bellard | ctx->pc + 4 + B11_0s * 2); |
337 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT; |
338 | fdf9b3e8 | bellard | return;
|
339 | fdf9b3e8 | bellard | } |
340 | fdf9b3e8 | bellard | |
341 | fdf9b3e8 | bellard | switch (ctx->opcode & 0xf00f) { |
342 | fdf9b3e8 | bellard | case 0x6003: /* mov Rm,Rn */ |
343 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
344 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
345 | fdf9b3e8 | bellard | return;
|
346 | fdf9b3e8 | bellard | case 0x2000: /* mov.b Rm,@Rn */ |
347 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
348 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
349 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
350 | fdf9b3e8 | bellard | return;
|
351 | fdf9b3e8 | bellard | case 0x2001: /* mov.w Rm,@Rn */ |
352 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
353 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
354 | fdf9b3e8 | bellard | gen_op_stw_T0_T1(ctx); |
355 | fdf9b3e8 | bellard | return;
|
356 | fdf9b3e8 | bellard | case 0x2002: /* mov.l Rm,@Rn */ |
357 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
358 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
359 | fdf9b3e8 | bellard | gen_op_stl_T0_T1(ctx); |
360 | fdf9b3e8 | bellard | return;
|
361 | fdf9b3e8 | bellard | case 0x6000: /* mov.b @Rm,Rn */ |
362 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
363 | fdf9b3e8 | bellard | gen_op_ldb_T0_T0(ctx); |
364 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
365 | fdf9b3e8 | bellard | return;
|
366 | fdf9b3e8 | bellard | case 0x6001: /* mov.w @Rm,Rn */ |
367 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
368 | fdf9b3e8 | bellard | gen_op_ldw_T0_T0(ctx); |
369 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
370 | fdf9b3e8 | bellard | return;
|
371 | fdf9b3e8 | bellard | case 0x6002: /* mov.l @Rm,Rn */ |
372 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
373 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
374 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
375 | fdf9b3e8 | bellard | return;
|
376 | fdf9b3e8 | bellard | case 0x2004: /* mov.b Rm,@-Rn */ |
377 | fdf9b3e8 | bellard | gen_op_dec1_rN(REG(B11_8)); |
378 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
379 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
380 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
381 | fdf9b3e8 | bellard | return;
|
382 | fdf9b3e8 | bellard | case 0x2005: /* mov.w Rm,@-Rn */ |
383 | fdf9b3e8 | bellard | gen_op_dec2_rN(REG(B11_8)); |
384 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
385 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
386 | fdf9b3e8 | bellard | gen_op_stw_T0_T1(ctx); |
387 | fdf9b3e8 | bellard | return;
|
388 | fdf9b3e8 | bellard | case 0x2006: /* mov.l Rm,@-Rn */ |
389 | fdf9b3e8 | bellard | gen_op_dec4_rN(REG(B11_8)); |
390 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
391 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
392 | fdf9b3e8 | bellard | gen_op_stl_T0_T1(ctx); |
393 | fdf9b3e8 | bellard | return;
|
394 | eda9b09b | bellard | case 0x6004: /* mov.b @Rm+,Rn */ |
395 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
396 | fdf9b3e8 | bellard | gen_op_ldb_T0_T0(ctx); |
397 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
398 | fdf9b3e8 | bellard | gen_op_inc1_rN(REG(B7_4)); |
399 | fdf9b3e8 | bellard | return;
|
400 | fdf9b3e8 | bellard | case 0x6005: /* mov.w @Rm+,Rn */ |
401 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
402 | fdf9b3e8 | bellard | gen_op_ldw_T0_T0(ctx); |
403 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
404 | fdf9b3e8 | bellard | gen_op_inc2_rN(REG(B7_4)); |
405 | fdf9b3e8 | bellard | return;
|
406 | fdf9b3e8 | bellard | case 0x6006: /* mov.l @Rm+,Rn */ |
407 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
408 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
409 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
410 | fdf9b3e8 | bellard | gen_op_inc4_rN(REG(B7_4)); |
411 | fdf9b3e8 | bellard | return;
|
412 | fdf9b3e8 | bellard | case 0x0004: /* mov.b Rm,@(R0,Rn) */ |
413 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
414 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
415 | fdf9b3e8 | bellard | gen_op_add_rN_T1(REG(0));
|
416 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
417 | fdf9b3e8 | bellard | return;
|
418 | fdf9b3e8 | bellard | case 0x0005: /* mov.w Rm,@(R0,Rn) */ |
419 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
420 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
421 | fdf9b3e8 | bellard | gen_op_add_rN_T1(REG(0));
|
422 | fdf9b3e8 | bellard | gen_op_stw_T0_T1(ctx); |
423 | fdf9b3e8 | bellard | return;
|
424 | fdf9b3e8 | bellard | case 0x0006: /* mov.l Rm,@(R0,Rn) */ |
425 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
426 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
427 | fdf9b3e8 | bellard | gen_op_add_rN_T1(REG(0));
|
428 | fdf9b3e8 | bellard | gen_op_stl_T0_T1(ctx); |
429 | fdf9b3e8 | bellard | return;
|
430 | fdf9b3e8 | bellard | case 0x000c: /* mov.b @(R0,Rm),Rn */ |
431 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
432 | fdf9b3e8 | bellard | gen_op_add_rN_T0(REG(0));
|
433 | fdf9b3e8 | bellard | gen_op_ldb_T0_T0(ctx); |
434 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
435 | fdf9b3e8 | bellard | return;
|
436 | fdf9b3e8 | bellard | case 0x000d: /* mov.w @(R0,Rm),Rn */ |
437 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
438 | fdf9b3e8 | bellard | gen_op_add_rN_T0(REG(0));
|
439 | fdf9b3e8 | bellard | gen_op_ldw_T0_T0(ctx); |
440 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
441 | fdf9b3e8 | bellard | return;
|
442 | fdf9b3e8 | bellard | case 0x000e: /* mov.l @(R0,Rm),Rn */ |
443 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
444 | fdf9b3e8 | bellard | gen_op_add_rN_T0(REG(0));
|
445 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
446 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
447 | fdf9b3e8 | bellard | return;
|
448 | fdf9b3e8 | bellard | case 0x6008: /* swap.b Rm,Rn */ |
449 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
450 | fdf9b3e8 | bellard | gen_op_swapb_T0(); |
451 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
452 | fdf9b3e8 | bellard | return;
|
453 | fdf9b3e8 | bellard | case 0x6009: /* swap.w Rm,Rn */ |
454 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
455 | fdf9b3e8 | bellard | gen_op_swapw_T0(); |
456 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
457 | fdf9b3e8 | bellard | return;
|
458 | fdf9b3e8 | bellard | case 0x200d: /* xtrct Rm,Rn */ |
459 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
460 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
461 | fdf9b3e8 | bellard | gen_op_xtrct_T0_T1(); |
462 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
463 | fdf9b3e8 | bellard | return;
|
464 | fdf9b3e8 | bellard | case 0x300c: /* add Rm,Rn */ |
465 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
466 | fdf9b3e8 | bellard | gen_op_add_T0_rN(REG(B11_8)); |
467 | fdf9b3e8 | bellard | return;
|
468 | fdf9b3e8 | bellard | case 0x300e: /* addc Rm,Rn */ |
469 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
470 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
471 | fdf9b3e8 | bellard | gen_op_addc_T0_T1(); |
472 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
473 | fdf9b3e8 | bellard | return;
|
474 | fdf9b3e8 | bellard | case 0x300f: /* addv Rm,Rn */ |
475 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
476 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
477 | fdf9b3e8 | bellard | gen_op_addv_T0_T1(); |
478 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
479 | fdf9b3e8 | bellard | return;
|
480 | fdf9b3e8 | bellard | case 0x2009: /* and Rm,Rn */ |
481 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
482 | fdf9b3e8 | bellard | gen_op_and_T0_rN(REG(B11_8)); |
483 | fdf9b3e8 | bellard | return;
|
484 | fdf9b3e8 | bellard | case 0x3000: /* cmp/eq Rm,Rn */ |
485 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
486 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
487 | fdf9b3e8 | bellard | gen_op_cmp_eq_T0_T1(); |
488 | fdf9b3e8 | bellard | return;
|
489 | fdf9b3e8 | bellard | case 0x3003: /* cmp/ge Rm,Rn */ |
490 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
491 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
492 | fdf9b3e8 | bellard | gen_op_cmp_ge_T0_T1(); |
493 | fdf9b3e8 | bellard | return;
|
494 | fdf9b3e8 | bellard | case 0x3007: /* cmp/gt Rm,Rn */ |
495 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
496 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
497 | fdf9b3e8 | bellard | gen_op_cmp_gt_T0_T1(); |
498 | fdf9b3e8 | bellard | return;
|
499 | fdf9b3e8 | bellard | case 0x3006: /* cmp/hi Rm,Rn */ |
500 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
501 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
502 | fdf9b3e8 | bellard | gen_op_cmp_hi_T0_T1(); |
503 | fdf9b3e8 | bellard | return;
|
504 | fdf9b3e8 | bellard | case 0x3002: /* cmp/hs Rm,Rn */ |
505 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
506 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
507 | fdf9b3e8 | bellard | gen_op_cmp_hs_T0_T1(); |
508 | fdf9b3e8 | bellard | return;
|
509 | fdf9b3e8 | bellard | case 0x200c: /* cmp/str Rm,Rn */ |
510 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
511 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
512 | fdf9b3e8 | bellard | gen_op_cmp_str_T0_T1(); |
513 | fdf9b3e8 | bellard | return;
|
514 | fdf9b3e8 | bellard | case 0x2007: /* div0s Rm,Rn */ |
515 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
516 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
517 | fdf9b3e8 | bellard | gen_op_div0s_T0_T1(); |
518 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
519 | fdf9b3e8 | bellard | return;
|
520 | fdf9b3e8 | bellard | case 0x3004: /* div1 Rm,Rn */ |
521 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
522 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
523 | fdf9b3e8 | bellard | gen_op_div1_T0_T1(); |
524 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
525 | fdf9b3e8 | bellard | return;
|
526 | fdf9b3e8 | bellard | case 0x300d: /* dmuls.l Rm,Rn */ |
527 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
528 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
529 | fdf9b3e8 | bellard | gen_op_dmulsl_T0_T1(); |
530 | fdf9b3e8 | bellard | return;
|
531 | fdf9b3e8 | bellard | case 0x3005: /* dmulu.l Rm,Rn */ |
532 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
533 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
534 | fdf9b3e8 | bellard | gen_op_dmulul_T0_T1(); |
535 | fdf9b3e8 | bellard | return;
|
536 | fdf9b3e8 | bellard | case 0x600e: /* exts.b Rm,Rn */ |
537 | fdf9b3e8 | bellard | gen_op_movb_rN_T0(REG(B7_4)); |
538 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
539 | fdf9b3e8 | bellard | return;
|
540 | fdf9b3e8 | bellard | case 0x600f: /* exts.w Rm,Rn */ |
541 | fdf9b3e8 | bellard | gen_op_movw_rN_T0(REG(B7_4)); |
542 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
543 | fdf9b3e8 | bellard | return;
|
544 | fdf9b3e8 | bellard | case 0x600c: /* extu.b Rm,Rn */ |
545 | fdf9b3e8 | bellard | gen_op_movub_rN_T0(REG(B7_4)); |
546 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
547 | fdf9b3e8 | bellard | return;
|
548 | fdf9b3e8 | bellard | case 0x600d: /* extu.w Rm,Rn */ |
549 | fdf9b3e8 | bellard | gen_op_movuw_rN_T0(REG(B7_4)); |
550 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
551 | fdf9b3e8 | bellard | return;
|
552 | fdf9b3e8 | bellard | case 0x000f: /* mac.l @Rm+,@Rn- */ |
553 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B11_8)); |
554 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
555 | fdf9b3e8 | bellard | gen_op_movl_T0_T1(); |
556 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B7_4)); |
557 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
558 | fdf9b3e8 | bellard | gen_op_macl_T0_T1(); |
559 | fdf9b3e8 | bellard | gen_op_inc4_rN(REG(B7_4)); |
560 | fdf9b3e8 | bellard | gen_op_inc4_rN(REG(B11_8)); |
561 | fdf9b3e8 | bellard | return;
|
562 | fdf9b3e8 | bellard | case 0x400f: /* mac.w @Rm+,@Rn+ */ |
563 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B11_8)); |
564 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
565 | fdf9b3e8 | bellard | gen_op_movl_T0_T1(); |
566 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B7_4)); |
567 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
568 | fdf9b3e8 | bellard | gen_op_macw_T0_T1(); |
569 | fdf9b3e8 | bellard | gen_op_inc2_rN(REG(B7_4)); |
570 | fdf9b3e8 | bellard | gen_op_inc2_rN(REG(B11_8)); |
571 | fdf9b3e8 | bellard | return;
|
572 | fdf9b3e8 | bellard | case 0x0007: /* mul.l Rm,Rn */ |
573 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
574 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
575 | fdf9b3e8 | bellard | gen_op_mull_T0_T1(); |
576 | fdf9b3e8 | bellard | return;
|
577 | fdf9b3e8 | bellard | case 0x200f: /* muls.w Rm,Rn */ |
578 | fdf9b3e8 | bellard | gen_op_movw_rN_T0(REG(B7_4)); |
579 | fdf9b3e8 | bellard | gen_op_movw_rN_T1(REG(B11_8)); |
580 | fdf9b3e8 | bellard | gen_op_mulsw_T0_T1(); |
581 | fdf9b3e8 | bellard | return;
|
582 | fdf9b3e8 | bellard | case 0x200e: /* mulu.w Rm,Rn */ |
583 | fdf9b3e8 | bellard | gen_op_movuw_rN_T0(REG(B7_4)); |
584 | fdf9b3e8 | bellard | gen_op_movuw_rN_T1(REG(B11_8)); |
585 | fdf9b3e8 | bellard | gen_op_muluw_T0_T1(); |
586 | fdf9b3e8 | bellard | return;
|
587 | fdf9b3e8 | bellard | case 0x600b: /* neg Rm,Rn */ |
588 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
589 | fdf9b3e8 | bellard | gen_op_neg_T0(); |
590 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
591 | fdf9b3e8 | bellard | return;
|
592 | fdf9b3e8 | bellard | case 0x600a: /* negc Rm,Rn */ |
593 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
594 | fdf9b3e8 | bellard | gen_op_negc_T0(); |
595 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
596 | fdf9b3e8 | bellard | return;
|
597 | fdf9b3e8 | bellard | case 0x6007: /* not Rm,Rn */ |
598 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
599 | fdf9b3e8 | bellard | gen_op_not_T0(); |
600 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(B11_8)); |
601 | fdf9b3e8 | bellard | return;
|
602 | fdf9b3e8 | bellard | case 0x200b: /* or Rm,Rn */ |
603 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
604 | fdf9b3e8 | bellard | gen_op_or_T0_rN(REG(B11_8)); |
605 | fdf9b3e8 | bellard | return;
|
606 | fdf9b3e8 | bellard | case 0x400c: /* shad Rm,Rn */ |
607 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
608 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
609 | fdf9b3e8 | bellard | gen_op_shad_T0_T1(); |
610 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
611 | fdf9b3e8 | bellard | return;
|
612 | fdf9b3e8 | bellard | case 0x400d: /* shld Rm,Rn */ |
613 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
614 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
615 | fdf9b3e8 | bellard | gen_op_shld_T0_T1(); |
616 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
617 | fdf9b3e8 | bellard | return;
|
618 | fdf9b3e8 | bellard | case 0x3008: /* sub Rm,Rn */ |
619 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
620 | fdf9b3e8 | bellard | gen_op_sub_T0_rN(REG(B11_8)); |
621 | fdf9b3e8 | bellard | return;
|
622 | fdf9b3e8 | bellard | case 0x300a: /* subc Rm,Rn */ |
623 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
624 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
625 | fdf9b3e8 | bellard | gen_op_subc_T0_T1(); |
626 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
627 | fdf9b3e8 | bellard | return;
|
628 | fdf9b3e8 | bellard | case 0x300b: /* subv Rm,Rn */ |
629 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
630 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
631 | fdf9b3e8 | bellard | gen_op_subv_T0_T1(); |
632 | fdf9b3e8 | bellard | gen_op_movl_T1_rN(REG(B11_8)); |
633 | fdf9b3e8 | bellard | return;
|
634 | fdf9b3e8 | bellard | case 0x2008: /* tst Rm,Rn */ |
635 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
636 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
637 | fdf9b3e8 | bellard | gen_op_tst_T0_T1(); |
638 | fdf9b3e8 | bellard | return;
|
639 | fdf9b3e8 | bellard | case 0x200a: /* xor Rm,Rn */ |
640 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
641 | fdf9b3e8 | bellard | gen_op_xor_T0_rN(REG(B11_8)); |
642 | fdf9b3e8 | bellard | return;
|
643 | eda9b09b | bellard | case 0xf00c: /* fmov {F,D,X}Rm,{F,D,X}Rn */ |
644 | eda9b09b | bellard | if (ctx->fpscr & FPSCR_PR) {
|
645 | eda9b09b | bellard | gen_op_fmov_drN_DT0(XREG(B7_4)); |
646 | eda9b09b | bellard | gen_op_fmov_DT0_drN(XREG(B11_8)); |
647 | eda9b09b | bellard | } else if (ctx->fpscr & FPSCR_SZ) { |
648 | eda9b09b | bellard | if (ctx->opcode & 0x0110) |
649 | eda9b09b | bellard | break; /* illegal instruction */ |
650 | eda9b09b | bellard | gen_op_fmov_drN_DT0(XREG(B7_4)); |
651 | eda9b09b | bellard | gen_op_fmov_DT0_drN(XREG(B11_8)); |
652 | eda9b09b | bellard | } else {
|
653 | eda9b09b | bellard | gen_op_fmov_frN_FT0(FREG(B7_4)); |
654 | eda9b09b | bellard | gen_op_fmov_FT0_frN(FREG(B11_8)); |
655 | eda9b09b | bellard | } |
656 | eda9b09b | bellard | return;
|
657 | eda9b09b | bellard | case 0xf00a: /* fmov {F,D,X}Rm,@Rn */ |
658 | eda9b09b | bellard | if (ctx->fpscr & FPSCR_PR) {
|
659 | eda9b09b | bellard | gen_op_fmov_drN_DT0(XREG(B7_4)); |
660 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
661 | eda9b09b | bellard | gen_op_stfq_DT0_T1(ctx); |
662 | eda9b09b | bellard | } else if (ctx->fpscr & FPSCR_SZ) { |
663 | eda9b09b | bellard | if (ctx->opcode & 0x0010) |
664 | eda9b09b | bellard | break; /* illegal instruction */ |
665 | eda9b09b | bellard | gen_op_fmov_drN_DT0(XREG(B7_4)); |
666 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
667 | eda9b09b | bellard | gen_op_stfq_DT0_T1(ctx); |
668 | eda9b09b | bellard | } else {
|
669 | eda9b09b | bellard | gen_op_fmov_frN_FT0(FREG(B7_4)); |
670 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
671 | eda9b09b | bellard | gen_op_stfl_FT0_T1(ctx); |
672 | eda9b09b | bellard | } |
673 | eda9b09b | bellard | return;
|
674 | eda9b09b | bellard | case 0xf008: /* fmov @Rm,{F,D,X}Rn */ |
675 | eda9b09b | bellard | if (ctx->fpscr & FPSCR_PR) {
|
676 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
677 | eda9b09b | bellard | gen_op_ldfq_T0_DT0(ctx); |
678 | eda9b09b | bellard | gen_op_fmov_DT0_drN(XREG(B11_8)); |
679 | eda9b09b | bellard | } else if (ctx->fpscr & FPSCR_SZ) { |
680 | eda9b09b | bellard | if (ctx->opcode & 0x0100) |
681 | eda9b09b | bellard | break; /* illegal instruction */ |
682 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
683 | eda9b09b | bellard | gen_op_ldfq_T0_DT0(ctx); |
684 | eda9b09b | bellard | gen_op_fmov_DT0_drN(XREG(B11_8)); |
685 | eda9b09b | bellard | } else {
|
686 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
687 | eda9b09b | bellard | gen_op_ldfl_T0_FT0(ctx); |
688 | eda9b09b | bellard | gen_op_fmov_FT0_frN(XREG(B11_8)); |
689 | eda9b09b | bellard | } |
690 | eda9b09b | bellard | return;
|
691 | eda9b09b | bellard | case 0xf009: /* fmov @Rm+,{F,D,X}Rn */ |
692 | eda9b09b | bellard | if (ctx->fpscr & FPSCR_PR) {
|
693 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
694 | eda9b09b | bellard | gen_op_ldfq_T0_DT0(ctx); |
695 | eda9b09b | bellard | gen_op_fmov_DT0_drN(XREG(B11_8)); |
696 | eda9b09b | bellard | gen_op_inc8_rN(REG(B7_4)); |
697 | eda9b09b | bellard | } else if (ctx->fpscr & FPSCR_SZ) { |
698 | eda9b09b | bellard | if (ctx->opcode & 0x0100) |
699 | eda9b09b | bellard | break; /* illegal instruction */ |
700 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
701 | eda9b09b | bellard | gen_op_ldfq_T0_DT0(ctx); |
702 | eda9b09b | bellard | gen_op_fmov_DT0_drN(XREG(B11_8)); |
703 | eda9b09b | bellard | gen_op_inc8_rN(REG(B7_4)); |
704 | eda9b09b | bellard | } else {
|
705 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
706 | eda9b09b | bellard | gen_op_ldfl_T0_FT0(ctx); |
707 | eda9b09b | bellard | gen_op_fmov_FT0_frN(XREG(B11_8)); |
708 | eda9b09b | bellard | gen_op_inc4_rN(REG(B7_4)); |
709 | eda9b09b | bellard | } |
710 | eda9b09b | bellard | return;
|
711 | eda9b09b | bellard | case 0xf00b: /* fmov {F,D,X}Rm,@-Rn */ |
712 | eda9b09b | bellard | if (ctx->fpscr & FPSCR_PR) {
|
713 | eda9b09b | bellard | gen_op_dec8_rN(REG(B11_8)); |
714 | eda9b09b | bellard | gen_op_fmov_drN_DT0(XREG(B7_4)); |
715 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
716 | eda9b09b | bellard | gen_op_stfq_DT0_T1(ctx); |
717 | eda9b09b | bellard | } else if (ctx->fpscr & FPSCR_SZ) { |
718 | eda9b09b | bellard | if (ctx->opcode & 0x0100) |
719 | eda9b09b | bellard | break; /* illegal instruction */ |
720 | eda9b09b | bellard | gen_op_dec8_rN(REG(B11_8)); |
721 | eda9b09b | bellard | gen_op_fmov_drN_DT0(XREG(B7_4)); |
722 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
723 | eda9b09b | bellard | gen_op_stfq_DT0_T1(ctx); |
724 | eda9b09b | bellard | } else {
|
725 | eda9b09b | bellard | gen_op_dec4_rN(REG(B11_8)); |
726 | eda9b09b | bellard | gen_op_fmov_frN_FT0(FREG(B7_4)); |
727 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
728 | eda9b09b | bellard | gen_op_stfl_FT0_T1(ctx); |
729 | eda9b09b | bellard | } |
730 | eda9b09b | bellard | return;
|
731 | eda9b09b | bellard | case 0xf006: /* fmov @(R0,Rm),{F,D,X}Rm */ |
732 | eda9b09b | bellard | if (ctx->fpscr & FPSCR_PR) {
|
733 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
734 | eda9b09b | bellard | gen_op_add_rN_T0(REG(0));
|
735 | eda9b09b | bellard | gen_op_ldfq_T0_DT0(ctx); |
736 | eda9b09b | bellard | gen_op_fmov_DT0_drN(XREG(B11_8)); |
737 | eda9b09b | bellard | } else if (ctx->fpscr & FPSCR_SZ) { |
738 | eda9b09b | bellard | if (ctx->opcode & 0x0100) |
739 | eda9b09b | bellard | break; /* illegal instruction */ |
740 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
741 | eda9b09b | bellard | gen_op_add_rN_T0(REG(0));
|
742 | eda9b09b | bellard | gen_op_ldfq_T0_DT0(ctx); |
743 | eda9b09b | bellard | gen_op_fmov_DT0_drN(XREG(B11_8)); |
744 | eda9b09b | bellard | } else {
|
745 | eda9b09b | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
746 | eda9b09b | bellard | gen_op_add_rN_T0(REG(0));
|
747 | eda9b09b | bellard | gen_op_ldfl_T0_FT0(ctx); |
748 | eda9b09b | bellard | gen_op_fmov_FT0_frN(XREG(B11_8)); |
749 | eda9b09b | bellard | } |
750 | eda9b09b | bellard | return;
|
751 | eda9b09b | bellard | case 0xf007: /* fmov {F,D,X}Rn,@(R0,Rn) */ |
752 | eda9b09b | bellard | if (ctx->fpscr & FPSCR_PR) {
|
753 | eda9b09b | bellard | gen_op_fmov_drN_DT0(XREG(B7_4)); |
754 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
755 | eda9b09b | bellard | gen_op_add_rN_T1(REG(0));
|
756 | eda9b09b | bellard | gen_op_stfq_DT0_T1(ctx); |
757 | eda9b09b | bellard | } else if (ctx->fpscr & FPSCR_SZ) { |
758 | eda9b09b | bellard | if (ctx->opcode & 0x0010) |
759 | eda9b09b | bellard | break; /* illegal instruction */ |
760 | eda9b09b | bellard | gen_op_fmov_drN_DT0(XREG(B7_4)); |
761 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
762 | eda9b09b | bellard | gen_op_add_rN_T1(REG(0));
|
763 | eda9b09b | bellard | gen_op_stfq_DT0_T1(ctx); |
764 | eda9b09b | bellard | } else {
|
765 | eda9b09b | bellard | gen_op_fmov_frN_FT0(FREG(B7_4)); |
766 | eda9b09b | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
767 | eda9b09b | bellard | gen_op_add_rN_T1(REG(0));
|
768 | eda9b09b | bellard | gen_op_stfl_FT0_T1(ctx); |
769 | eda9b09b | bellard | } |
770 | eda9b09b | bellard | return;
|
771 | fdf9b3e8 | bellard | } |
772 | fdf9b3e8 | bellard | |
773 | fdf9b3e8 | bellard | switch (ctx->opcode & 0xff00) { |
774 | fdf9b3e8 | bellard | case 0xc900: /* and #imm,R0 */ |
775 | fdf9b3e8 | bellard | gen_op_and_imm_rN(B7_0, REG(0));
|
776 | fdf9b3e8 | bellard | return;
|
777 | fdf9b3e8 | bellard | case 0xcd00: /* and.b #imm,@(R0+GBR) */ |
778 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
779 | fdf9b3e8 | bellard | gen_op_addl_GBR_T0(); |
780 | fdf9b3e8 | bellard | gen_op_movl_T0_T1(); |
781 | fdf9b3e8 | bellard | gen_op_ldb_T0_T0(ctx); |
782 | fdf9b3e8 | bellard | gen_op_and_imm_T0(B7_0); |
783 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
784 | fdf9b3e8 | bellard | return;
|
785 | fdf9b3e8 | bellard | case 0x8b00: /* bf label */ |
786 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT |
787 | fdf9b3e8 | bellard | gen_conditional_jump(ctx, ctx->pc + 2,
|
788 | fdf9b3e8 | bellard | ctx->pc + 4 + B7_0s * 2); |
789 | fdf9b3e8 | bellard | ctx->flags |= BRANCH_CONDITIONAL; |
790 | fdf9b3e8 | bellard | return;
|
791 | fdf9b3e8 | bellard | case 0x8f00: /* bf/s label */ |
792 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT |
793 | fdf9b3e8 | bellard | gen_op_bf_s(ctx->delayed_pc = ctx->pc + 4 + B7_0s * 2); |
794 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT_CONDITIONAL; |
795 | fdf9b3e8 | bellard | return;
|
796 | fdf9b3e8 | bellard | case 0x8900: /* bt label */ |
797 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT |
798 | fdf9b3e8 | bellard | gen_conditional_jump(ctx, ctx->pc + 4 + B7_0s * 2, |
799 | fdf9b3e8 | bellard | ctx->pc + 2);
|
800 | fdf9b3e8 | bellard | ctx->flags |= BRANCH_CONDITIONAL; |
801 | fdf9b3e8 | bellard | return;
|
802 | fdf9b3e8 | bellard | case 0x8d00: /* bt/s label */ |
803 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT |
804 | fdf9b3e8 | bellard | gen_op_bt_s(ctx->delayed_pc = ctx->pc + 4 + B7_0s * 2); |
805 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT_CONDITIONAL; |
806 | fdf9b3e8 | bellard | return;
|
807 | fdf9b3e8 | bellard | case 0x8800: /* cmp/eq #imm,R0 */ |
808 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
809 | fdf9b3e8 | bellard | gen_op_cmp_eq_imm_T0(B7_0s); |
810 | fdf9b3e8 | bellard | return;
|
811 | fdf9b3e8 | bellard | case 0xc400: /* mov.b @(disp,GBR),R0 */ |
812 | fdf9b3e8 | bellard | gen_op_stc_gbr_T0(); |
813 | fdf9b3e8 | bellard | gen_op_addl_imm_T0(B7_0); |
814 | fdf9b3e8 | bellard | gen_op_ldb_T0_T0(ctx); |
815 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(0));
|
816 | fdf9b3e8 | bellard | return;
|
817 | fdf9b3e8 | bellard | case 0xc500: /* mov.w @(disp,GBR),R0 */ |
818 | fdf9b3e8 | bellard | gen_op_stc_gbr_T0(); |
819 | fdf9b3e8 | bellard | gen_op_addl_imm_T0(B7_0); |
820 | fdf9b3e8 | bellard | gen_op_ldw_T0_T0(ctx); |
821 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(0));
|
822 | fdf9b3e8 | bellard | return;
|
823 | fdf9b3e8 | bellard | case 0xc600: /* mov.l @(disp,GBR),R0 */ |
824 | fdf9b3e8 | bellard | gen_op_stc_gbr_T0(); |
825 | fdf9b3e8 | bellard | gen_op_addl_imm_T0(B7_0); |
826 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
827 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(0));
|
828 | fdf9b3e8 | bellard | return;
|
829 | fdf9b3e8 | bellard | case 0xc000: /* mov.b R0,@(disp,GBR) */ |
830 | fdf9b3e8 | bellard | gen_op_stc_gbr_T0(); |
831 | fdf9b3e8 | bellard | gen_op_addl_imm_T0(B7_0); |
832 | fdf9b3e8 | bellard | gen_op_movl_T0_T1(); |
833 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
834 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
835 | fdf9b3e8 | bellard | return;
|
836 | fdf9b3e8 | bellard | case 0xc100: /* mov.w R0,@(disp,GBR) */ |
837 | fdf9b3e8 | bellard | gen_op_stc_gbr_T0(); |
838 | fdf9b3e8 | bellard | gen_op_addl_imm_T0(B7_0); |
839 | fdf9b3e8 | bellard | gen_op_movl_T0_T1(); |
840 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
841 | fdf9b3e8 | bellard | gen_op_stw_T0_T1(ctx); |
842 | fdf9b3e8 | bellard | return;
|
843 | fdf9b3e8 | bellard | case 0xc200: /* mov.l R0,@(disp,GBR) */ |
844 | fdf9b3e8 | bellard | gen_op_stc_gbr_T0(); |
845 | fdf9b3e8 | bellard | gen_op_addl_imm_T0(B7_0); |
846 | fdf9b3e8 | bellard | gen_op_movl_T0_T1(); |
847 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
848 | fdf9b3e8 | bellard | gen_op_stl_T0_T1(ctx); |
849 | fdf9b3e8 | bellard | return;
|
850 | fdf9b3e8 | bellard | case 0x8000: /* mov.b R0,@(disp,Rn) */ |
851 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
852 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B7_4)); |
853 | fdf9b3e8 | bellard | gen_op_addl_imm_T1(B3_0); |
854 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
855 | fdf9b3e8 | bellard | return;
|
856 | fdf9b3e8 | bellard | case 0x8100: /* mov.w R0,@(disp,Rn) */ |
857 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
858 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B7_4)); |
859 | fdf9b3e8 | bellard | gen_op_addl_imm_T1(B3_0 * 2);
|
860 | fdf9b3e8 | bellard | gen_op_stw_T0_T1(ctx); |
861 | fdf9b3e8 | bellard | return;
|
862 | fdf9b3e8 | bellard | case 0x8400: /* mov.b @(disp,Rn),R0 */ |
863 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
864 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B7_4)); |
865 | fdf9b3e8 | bellard | gen_op_addl_imm_T1(B3_0); |
866 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
867 | fdf9b3e8 | bellard | return;
|
868 | fdf9b3e8 | bellard | case 0x8500: /* mov.w @(disp,Rn),R0 */ |
869 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B7_4)); |
870 | fdf9b3e8 | bellard | gen_op_addl_imm_T0(B3_0 * 2);
|
871 | fdf9b3e8 | bellard | gen_op_ldw_T0_T0(ctx); |
872 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(REG(0));
|
873 | fdf9b3e8 | bellard | return;
|
874 | fdf9b3e8 | bellard | case 0xc700: /* mova @(disp,PC),R0 */ |
875 | fdf9b3e8 | bellard | gen_op_movl_imm_rN(((ctx->pc & 0xfffffffc) + 4 + B7_0 * 4) & ~3, |
876 | fdf9b3e8 | bellard | REG(0));
|
877 | fdf9b3e8 | bellard | return;
|
878 | fdf9b3e8 | bellard | case 0xcb00: /* or #imm,R0 */ |
879 | fdf9b3e8 | bellard | gen_op_or_imm_rN(B7_0, REG(0));
|
880 | fdf9b3e8 | bellard | return;
|
881 | fdf9b3e8 | bellard | case 0xcf00: /* or.b #imm,@(R0+GBR) */ |
882 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
883 | fdf9b3e8 | bellard | gen_op_addl_GBR_T0(); |
884 | fdf9b3e8 | bellard | gen_op_movl_T0_T1(); |
885 | fdf9b3e8 | bellard | gen_op_ldb_T0_T0(ctx); |
886 | fdf9b3e8 | bellard | gen_op_or_imm_T0(B7_0); |
887 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
888 | fdf9b3e8 | bellard | return;
|
889 | fdf9b3e8 | bellard | case 0xc300: /* trapa #imm */ |
890 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT gen_op_movl_imm_PC(ctx->pc); |
891 | fdf9b3e8 | bellard | gen_op_trapa(B7_0); |
892 | fdf9b3e8 | bellard | ctx->flags |= BRANCH; |
893 | fdf9b3e8 | bellard | return;
|
894 | fdf9b3e8 | bellard | case 0xc800: /* tst #imm,R0 */ |
895 | fdf9b3e8 | bellard | gen_op_tst_imm_rN(B7_0, REG(0));
|
896 | fdf9b3e8 | bellard | return;
|
897 | fdf9b3e8 | bellard | case 0xcc00: /* tst #imm,@(R0+GBR) */ |
898 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
899 | fdf9b3e8 | bellard | gen_op_addl_GBR_T0(); |
900 | fdf9b3e8 | bellard | gen_op_ldb_T0_T0(ctx); |
901 | fdf9b3e8 | bellard | gen_op_tst_imm_T0(B7_0); |
902 | fdf9b3e8 | bellard | return;
|
903 | fdf9b3e8 | bellard | case 0xca00: /* xor #imm,R0 */ |
904 | fdf9b3e8 | bellard | gen_op_xor_imm_rN(B7_0, REG(0));
|
905 | fdf9b3e8 | bellard | return;
|
906 | fdf9b3e8 | bellard | case 0xce00: /* xor.b #imm,@(R0+GBR) */ |
907 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
908 | fdf9b3e8 | bellard | gen_op_addl_GBR_T0(); |
909 | fdf9b3e8 | bellard | gen_op_movl_T0_T1(); |
910 | fdf9b3e8 | bellard | gen_op_ldb_T0_T0(ctx); |
911 | fdf9b3e8 | bellard | gen_op_xor_imm_T0(B7_0); |
912 | fdf9b3e8 | bellard | gen_op_stb_T0_T1(ctx); |
913 | fdf9b3e8 | bellard | return;
|
914 | fdf9b3e8 | bellard | } |
915 | fdf9b3e8 | bellard | |
916 | fdf9b3e8 | bellard | switch (ctx->opcode & 0xf08f) { |
917 | fdf9b3e8 | bellard | case 0x408e: /* ldc Rm,Rn_BANK */ |
918 | fdf9b3e8 | bellard | gen_op_movl_rN_rN(REG(B11_8), ALTREG(B6_4)); |
919 | fdf9b3e8 | bellard | return;
|
920 | fdf9b3e8 | bellard | case 0x4087: /* ldc.l @Rm+,Rn_BANK */ |
921 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B11_8)); |
922 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
923 | fdf9b3e8 | bellard | gen_op_movl_T0_rN(ALTREG(B6_4)); |
924 | fdf9b3e8 | bellard | gen_op_inc4_rN(REG(B11_8)); |
925 | fdf9b3e8 | bellard | return;
|
926 | fdf9b3e8 | bellard | case 0x0082: /* stc Rm_BANK,Rn */ |
927 | fdf9b3e8 | bellard | gen_op_movl_rN_rN(ALTREG(B6_4), REG(B11_8)); |
928 | fdf9b3e8 | bellard | return;
|
929 | fdf9b3e8 | bellard | case 0x4083: /* stc.l Rm_BANK,@-Rn */ |
930 | fdf9b3e8 | bellard | gen_op_dec4_rN(REG(B11_8)); |
931 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
932 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(ALTREG(B6_4)); |
933 | fdf9b3e8 | bellard | gen_op_stl_T0_T1(ctx); |
934 | fdf9b3e8 | bellard | return;
|
935 | fdf9b3e8 | bellard | } |
936 | fdf9b3e8 | bellard | |
937 | fdf9b3e8 | bellard | switch (ctx->opcode & 0xf0ff) { |
938 | fdf9b3e8 | bellard | case 0x0023: /* braf Rn */ |
939 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT gen_op_movl_rN_T0(REG(B11_8)); |
940 | fdf9b3e8 | bellard | gen_op_braf_T0(ctx->pc + 4);
|
941 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT; |
942 | fdf9b3e8 | bellard | ctx->delayed_pc = (uint32_t) - 1;
|
943 | fdf9b3e8 | bellard | return;
|
944 | fdf9b3e8 | bellard | case 0x0003: /* bsrf Rn */ |
945 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT gen_op_movl_rN_T0(REG(B11_8)); |
946 | fdf9b3e8 | bellard | gen_op_bsrf_T0(ctx->pc + 4);
|
947 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT; |
948 | fdf9b3e8 | bellard | ctx->delayed_pc = (uint32_t) - 1;
|
949 | fdf9b3e8 | bellard | return;
|
950 | fdf9b3e8 | bellard | case 0x4015: /* cmp/pl Rn */ |
951 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B11_8)); |
952 | fdf9b3e8 | bellard | gen_op_cmp_pl_T0(); |
953 | fdf9b3e8 | bellard | return;
|
954 | fdf9b3e8 | bellard | case 0x4011: /* cmp/pz Rn */ |
955 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B11_8)); |
956 | fdf9b3e8 | bellard | gen_op_cmp_pz_T0(); |
957 | fdf9b3e8 | bellard | return;
|
958 | fdf9b3e8 | bellard | case 0x4010: /* dt Rn */ |
959 | fdf9b3e8 | bellard | gen_op_dt_rN(REG(B11_8)); |
960 | fdf9b3e8 | bellard | return;
|
961 | fdf9b3e8 | bellard | case 0x402b: /* jmp @Rn */ |
962 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT gen_op_movl_rN_T0(REG(B11_8)); |
963 | fdf9b3e8 | bellard | gen_op_jmp_T0(); |
964 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT; |
965 | fdf9b3e8 | bellard | ctx->delayed_pc = (uint32_t) - 1;
|
966 | fdf9b3e8 | bellard | return;
|
967 | fdf9b3e8 | bellard | case 0x400b: /* jsr @Rn */ |
968 | fdf9b3e8 | bellard | CHECK_NOT_DELAY_SLOT gen_op_movl_rN_T0(REG(B11_8)); |
969 | fdf9b3e8 | bellard | gen_op_jsr_T0(ctx->pc + 4);
|
970 | fdf9b3e8 | bellard | ctx->flags |= DELAY_SLOT; |
971 | fdf9b3e8 | bellard | ctx->delayed_pc = (uint32_t) - 1;
|
972 | fdf9b3e8 | bellard | return;
|
973 | fdf9b3e8 | bellard | #define LDST(reg,ldnum,ldpnum,ldop,stnum,stpnum,stop,extrald) \
|
974 | fdf9b3e8 | bellard | case ldnum: \
|
975 | fdf9b3e8 | bellard | gen_op_movl_rN_T0 (REG(B11_8)); \ |
976 | fdf9b3e8 | bellard | gen_op_##ldop##_T0_##reg (); \ |
977 | fdf9b3e8 | bellard | extrald \ |
978 | fdf9b3e8 | bellard | return; \
|
979 | fdf9b3e8 | bellard | case ldpnum: \
|
980 | fdf9b3e8 | bellard | gen_op_movl_rN_T0 (REG(B11_8)); \ |
981 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0 (ctx); \ |
982 | fdf9b3e8 | bellard | gen_op_inc4_rN (REG(B11_8)); \ |
983 | fdf9b3e8 | bellard | gen_op_##ldop##_T0_##reg (); \ |
984 | fdf9b3e8 | bellard | extrald \ |
985 | fdf9b3e8 | bellard | return; \
|
986 | fdf9b3e8 | bellard | case stnum: \
|
987 | fdf9b3e8 | bellard | gen_op_##stop##_##reg##_T0 (); \ |
988 | fdf9b3e8 | bellard | gen_op_movl_T0_rN (REG(B11_8)); \ |
989 | fdf9b3e8 | bellard | return; \
|
990 | fdf9b3e8 | bellard | case stpnum: \
|
991 | fdf9b3e8 | bellard | gen_op_##stop##_##reg##_T0 (); \ |
992 | fdf9b3e8 | bellard | gen_op_dec4_rN (REG(B11_8)); \ |
993 | fdf9b3e8 | bellard | gen_op_movl_rN_T1 (REG(B11_8)); \ |
994 | fdf9b3e8 | bellard | gen_op_stl_T0_T1 (ctx); \ |
995 | fdf9b3e8 | bellard | return;
|
996 | fdf9b3e8 | bellard | LDST(sr, 0x400e, 0x4007, ldc, 0x0002, 0x4003, stc, ctx->flags |= |
997 | eda9b09b | bellard | MODE_CHANGE;) |
998 | eda9b09b | bellard | LDST(gbr, 0x401e, 0x4017, ldc, 0x0012, 0x4013, stc,) |
999 | eda9b09b | bellard | LDST(vbr, 0x402e, 0x4027, ldc, 0x0022, 0x4023, stc,) |
1000 | eda9b09b | bellard | LDST(ssr, 0x403e, 0x4037, ldc, 0x0032, 0x4033, stc,) |
1001 | eda9b09b | bellard | LDST(spc, 0x404e, 0x4047, ldc, 0x0042, 0x4043, stc,) |
1002 | eda9b09b | bellard | LDST(dbr, 0x40fa, 0x40f6, ldc, 0x00fa, 0x40f2, stc,) |
1003 | eda9b09b | bellard | LDST(mach, 0x400a, 0x4006, lds, 0x000a, 0x4002, sts,) |
1004 | eda9b09b | bellard | LDST(macl, 0x401a, 0x4016, lds, 0x001a, 0x4012, sts,) |
1005 | eda9b09b | bellard | LDST(pr, 0x402a, 0x4026, lds, 0x002a, 0x4022, sts,) |
1006 | eda9b09b | bellard | LDST(fpul, 0x405a, 0x4056, lds, 0x005a, 0x0052, sts,) |
1007 | eda9b09b | bellard | LDST(fpscr, 0x406a, 0x4066, lds, 0x006a, 0x0062, sts, ctx->flags |= |
1008 | eda9b09b | bellard | MODE_CHANGE;) |
1009 | fdf9b3e8 | bellard | case 0x00c3: /* movca.l R0,@Rm */ |
1010 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(0));
|
1011 | fdf9b3e8 | bellard | gen_op_movl_rN_T1(REG(B11_8)); |
1012 | fdf9b3e8 | bellard | gen_op_stl_T0_T1(ctx); |
1013 | fdf9b3e8 | bellard | return;
|
1014 | fdf9b3e8 | bellard | case 0x0029: /* movt Rn */ |
1015 | fdf9b3e8 | bellard | gen_op_movt_rN(REG(B11_8)); |
1016 | fdf9b3e8 | bellard | return;
|
1017 | fdf9b3e8 | bellard | case 0x0093: /* ocbi @Rn */ |
1018 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B11_8)); |
1019 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
1020 | fdf9b3e8 | bellard | return;
|
1021 | fdf9b3e8 | bellard | case 0x00a2: /* ocbp @Rn */ |
1022 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B11_8)); |
1023 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
1024 | fdf9b3e8 | bellard | return;
|
1025 | fdf9b3e8 | bellard | case 0x00b3: /* ocbwb @Rn */ |
1026 | fdf9b3e8 | bellard | gen_op_movl_rN_T0(REG(B11_8)); |
1027 | fdf9b3e8 | bellard | gen_op_ldl_T0_T0(ctx); |
1028 | fdf9b3e8 | bellard | return;
|
1029 | fdf9b3e8 | bellard | case 0x0083: /* pref @Rn */ |
1030 | fdf9b3e8 | bellard | return;
|
1031 | fdf9b3e8 | bellard | case 0x4024: /* rotcl Rn */ |
1032 | fdf9b3e8 | bellard | gen_op_rotcl_Rn(REG(B11_8)); |
1033 | fdf9b3e8 | bellard | return;
|
1034 | fdf9b3e8 | bellard | case 0x4025: /* rotcr Rn */ |
1035 | fdf9b3e8 | bellard | gen_op_rotcr_Rn(REG(B11_8)); |
1036 | fdf9b3e8 | bellard | return;
|
1037 | fdf9b3e8 | bellard | case 0x4004: /* rotl Rn */ |
1038 | fdf9b3e8 | bellard | gen_op_rotl_Rn(REG(B11_8)); |
1039 | fdf9b3e8 | bellard | return;
|
1040 | fdf9b3e8 | bellard | case 0x4005: /* rotr Rn */ |
1041 | fdf9b3e8 | bellard | gen_op_rotr_Rn(REG(B11_8)); |
1042 | fdf9b3e8 | bellard | return;
|
1043 | fdf9b3e8 | bellard | case 0x4000: /* shll Rn */ |
1044 | fdf9b3e8 | bellard | case 0x4020: /* shal Rn */ |
1045 | fdf9b3e8 | bellard | gen_op_shal_Rn(REG(B11_8)); |
1046 | fdf9b3e8 | bellard | return;
|
1047 | fdf9b3e8 | bellard | case 0x4021: /* shar Rn */ |
1048 | fdf9b3e8 | bellard | gen_op_shar_Rn(REG(B11_8)); |
1049 | fdf9b3e8 | bellard | return;
|
1050 | fdf9b3e8 | bellard | case 0x4001: /* shlr Rn */ |
1051 | fdf9b3e8 | bellard | gen_op_shlr_Rn(REG(B11_8)); |
1052 | fdf9b3e8 | bellard | return;
|
1053 | fdf9b3e8 | bellard | case 0x4008: /* shll2 Rn */ |
1054 | fdf9b3e8 | bellard | gen_op_shll2_Rn(REG(B11_8)); |
1055 | fdf9b3e8 | bellard | return;
|
1056 | fdf9b3e8 | bellard | case 0x4018: /* shll8 Rn */ |
1057 | fdf9b3e8 | bellard | gen_op_shll8_Rn(REG(B11_8)); |
1058 | fdf9b3e8 | bellard | return;
|
1059 | fdf9b3e8 | bellard | case 0x4028: /* shll16 Rn */ |
1060 | fdf9b3e8 | bellard | gen_op_shll16_Rn(REG(B11_8)); |
1061 | fdf9b3e8 | bellard | return;
|
1062 | fdf9b3e8 | bellard | case 0x4009: /* shlr2 Rn */ |
1063 | fdf9b3e8 | bellard | gen_op_shlr2_Rn(REG(B11_8)); |
1064 | fdf9b3e8 | bellard | return;
|
1065 | fdf9b3e8 | bellard | case 0x4019: /* shlr8 Rn */ |
1066 | fdf9b3e8 | bellard | gen_op_shlr8_Rn(REG(B11_8)); |
1067 | fdf9b3e8 | bellard | return;
|
1068 | fdf9b3e8 | bellard | case 0x4029: /* shlr16 Rn */ |
1069 | fdf9b3e8 | bellard | gen_op_shlr16_Rn(REG(B11_8)); |
1070 | fdf9b3e8 | bellard | return;
|
1071 | fdf9b3e8 | bellard | case 0x401b: /* tas.b @Rn */ |
1072 | fdf9b3e8 | bellard | gen_op_tasb_rN(REG(B11_8)); |
1073 | fdf9b3e8 | bellard | return;
|
1074 | eda9b09b | bellard | case 0xf00d: /* fsts FPUL,FRn */ |
1075 | eda9b09b | bellard | gen_op_movl_fpul_FT0(); |
1076 | eda9b09b | bellard | gen_op_fmov_FT0_frN(FREG(B11_8)); |
1077 | eda9b09b | bellard | return;
|
1078 | eda9b09b | bellard | case 0xf01d: /* flds FRm.FPUL */ |
1079 | eda9b09b | bellard | gen_op_fmov_frN_FT0(FREG(B11_8)); |
1080 | eda9b09b | bellard | gen_op_movl_FT0_fpul(); |
1081 | eda9b09b | bellard | return;
|
1082 | fdf9b3e8 | bellard | } |
1083 | fdf9b3e8 | bellard | |
1084 | fdf9b3e8 | bellard | fprintf(stderr, "unknown instruction 0x%04x at pc 0x%08x\n",
|
1085 | fdf9b3e8 | bellard | ctx->opcode, ctx->pc); |
1086 | fdf9b3e8 | bellard | gen_op_raise_illegal_instruction(); |
1087 | fdf9b3e8 | bellard | ctx->flags |= BRANCH_EXCEPTION; |
1088 | fdf9b3e8 | bellard | } |
1089 | fdf9b3e8 | bellard | |
1090 | 820e00f2 | ths | static inline int |
1091 | 820e00f2 | ths | gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb, |
1092 | 820e00f2 | ths | int search_pc)
|
1093 | fdf9b3e8 | bellard | { |
1094 | fdf9b3e8 | bellard | DisasContext ctx; |
1095 | fdf9b3e8 | bellard | target_ulong pc_start; |
1096 | fdf9b3e8 | bellard | static uint16_t *gen_opc_end;
|
1097 | fdf9b3e8 | bellard | uint32_t old_flags; |
1098 | 355fb23d | pbrook | int i, ii;
|
1099 | fdf9b3e8 | bellard | |
1100 | fdf9b3e8 | bellard | pc_start = tb->pc; |
1101 | fdf9b3e8 | bellard | gen_opc_ptr = gen_opc_buf; |
1102 | fdf9b3e8 | bellard | gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; |
1103 | fdf9b3e8 | bellard | gen_opparam_ptr = gen_opparam_buf; |
1104 | fdf9b3e8 | bellard | ctx.pc = pc_start; |
1105 | fdf9b3e8 | bellard | ctx.flags = env->flags; |
1106 | fdf9b3e8 | bellard | old_flags = 0;
|
1107 | fdf9b3e8 | bellard | ctx.sr = env->sr; |
1108 | eda9b09b | bellard | ctx.fpscr = env->fpscr; |
1109 | fdf9b3e8 | bellard | ctx.memidx = (env->sr & SR_MD) ? 1 : 0; |
1110 | 9854bc46 | pbrook | /* We don't know if the delayed pc came from a dynamic or static branch,
|
1111 | 9854bc46 | pbrook | so assume it is a dynamic branch. */
|
1112 | 9854bc46 | pbrook | ctx.delayed_pc = -1;
|
1113 | fdf9b3e8 | bellard | ctx.tb = tb; |
1114 | fdf9b3e8 | bellard | ctx.singlestep_enabled = env->singlestep_enabled; |
1115 | fdf9b3e8 | bellard | nb_gen_labels = 0;
|
1116 | fdf9b3e8 | bellard | |
1117 | fdf9b3e8 | bellard | #ifdef DEBUG_DISAS
|
1118 | fdf9b3e8 | bellard | if (loglevel & CPU_LOG_TB_CPU) {
|
1119 | fdf9b3e8 | bellard | fprintf(logfile, |
1120 | fdf9b3e8 | bellard | "------------------------------------------------\n");
|
1121 | fdf9b3e8 | bellard | cpu_dump_state(env, logfile, fprintf, 0);
|
1122 | fdf9b3e8 | bellard | } |
1123 | fdf9b3e8 | bellard | #endif
|
1124 | fdf9b3e8 | bellard | |
1125 | 355fb23d | pbrook | ii = -1;
|
1126 | fdf9b3e8 | bellard | while ((old_flags & (DELAY_SLOT | DELAY_SLOT_CONDITIONAL)) == 0 && |
1127 | fdf9b3e8 | bellard | (ctx.flags & (BRANCH | BRANCH_CONDITIONAL | MODE_CHANGE | |
1128 | fdf9b3e8 | bellard | BRANCH_EXCEPTION)) == 0 &&
|
1129 | fdf9b3e8 | bellard | gen_opc_ptr < gen_opc_end && ctx.sr == env->sr) { |
1130 | fdf9b3e8 | bellard | old_flags = ctx.flags; |
1131 | fdf9b3e8 | bellard | if (env->nb_breakpoints > 0) { |
1132 | fdf9b3e8 | bellard | for (i = 0; i < env->nb_breakpoints; i++) { |
1133 | fdf9b3e8 | bellard | if (ctx.pc == env->breakpoints[i]) {
|
1134 | fdf9b3e8 | bellard | /* We have hit a breakpoint - make sure PC is up-to-date */
|
1135 | fdf9b3e8 | bellard | gen_op_movl_imm_PC(ctx.pc); |
1136 | fdf9b3e8 | bellard | gen_op_debug(); |
1137 | fdf9b3e8 | bellard | ctx.flags |= BRANCH_EXCEPTION; |
1138 | fdf9b3e8 | bellard | break;
|
1139 | fdf9b3e8 | bellard | } |
1140 | fdf9b3e8 | bellard | } |
1141 | fdf9b3e8 | bellard | } |
1142 | 355fb23d | pbrook | if (search_pc) {
|
1143 | 355fb23d | pbrook | i = gen_opc_ptr - gen_opc_buf; |
1144 | 355fb23d | pbrook | if (ii < i) {
|
1145 | 355fb23d | pbrook | ii++; |
1146 | 355fb23d | pbrook | while (ii < i)
|
1147 | 355fb23d | pbrook | gen_opc_instr_start[ii++] = 0;
|
1148 | 355fb23d | pbrook | } |
1149 | 355fb23d | pbrook | gen_opc_pc[ii] = ctx.pc; |
1150 | 355fb23d | pbrook | gen_opc_instr_start[ii] = 1;
|
1151 | 355fb23d | pbrook | } |
1152 | fdf9b3e8 | bellard | #if 0
|
1153 | fdf9b3e8 | bellard | fprintf(stderr, "Loading opcode at address 0x%08x\n", ctx.pc);
|
1154 | fdf9b3e8 | bellard | fflush(stderr);
|
1155 | fdf9b3e8 | bellard | #endif
|
1156 | fdf9b3e8 | bellard | ctx.opcode = lduw_code(ctx.pc); |
1157 | fdf9b3e8 | bellard | decode_opc(&ctx); |
1158 | fdf9b3e8 | bellard | ctx.pc += 2;
|
1159 | fdf9b3e8 | bellard | if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) |
1160 | fdf9b3e8 | bellard | break;
|
1161 | fdf9b3e8 | bellard | if (env->singlestep_enabled)
|
1162 | fdf9b3e8 | bellard | break;
|
1163 | fdf9b3e8 | bellard | #ifdef SH4_SINGLE_STEP
|
1164 | fdf9b3e8 | bellard | break;
|
1165 | fdf9b3e8 | bellard | #endif
|
1166 | fdf9b3e8 | bellard | } |
1167 | fdf9b3e8 | bellard | |
1168 | 9c2a9ea1 | pbrook | if (old_flags & DELAY_SLOT_CONDITIONAL) {
|
1169 | fdf9b3e8 | bellard | gen_delayed_conditional_jump(&ctx); |
1170 | 9c2a9ea1 | pbrook | } else if (old_flags & DELAY_SLOT) { |
1171 | fdf9b3e8 | bellard | gen_op_clr_delay_slot(); |
1172 | fdf9b3e8 | bellard | gen_jump(&ctx); |
1173 | 9c2a9ea1 | pbrook | } else if (ctx.flags & BRANCH_EXCEPTION) { |
1174 | 9c2a9ea1 | pbrook | gen_jump_exception(&ctx); |
1175 | 9c2a9ea1 | pbrook | } else if ((ctx.flags & (BRANCH | BRANCH_CONDITIONAL)) == 0) { |
1176 | 9c2a9ea1 | pbrook | gen_goto_tb(&ctx, 0, ctx.pc);
|
1177 | fdf9b3e8 | bellard | } |
1178 | fdf9b3e8 | bellard | |
1179 | fdf9b3e8 | bellard | if (env->singlestep_enabled) {
|
1180 | fdf9b3e8 | bellard | gen_op_debug(); |
1181 | fdf9b3e8 | bellard | } |
1182 | fdf9b3e8 | bellard | *gen_opc_ptr = INDEX_op_end; |
1183 | 355fb23d | pbrook | if (search_pc) {
|
1184 | 355fb23d | pbrook | i = gen_opc_ptr - gen_opc_buf; |
1185 | 355fb23d | pbrook | ii++; |
1186 | 355fb23d | pbrook | while (ii <= i)
|
1187 | 355fb23d | pbrook | gen_opc_instr_start[ii++] = 0;
|
1188 | 355fb23d | pbrook | tb->size = 0;
|
1189 | 355fb23d | pbrook | } else {
|
1190 | 355fb23d | pbrook | tb->size = ctx.pc - pc_start; |
1191 | 355fb23d | pbrook | } |
1192 | fdf9b3e8 | bellard | |
1193 | fdf9b3e8 | bellard | #ifdef DEBUG_DISAS
|
1194 | fdf9b3e8 | bellard | #ifdef SH4_DEBUG_DISAS
|
1195 | fdf9b3e8 | bellard | if (loglevel & CPU_LOG_TB_IN_ASM)
|
1196 | fdf9b3e8 | bellard | fprintf(logfile, "\n");
|
1197 | fdf9b3e8 | bellard | #endif
|
1198 | fdf9b3e8 | bellard | if (loglevel & CPU_LOG_TB_IN_ASM) {
|
1199 | fdf9b3e8 | bellard | fprintf(logfile, "IN:\n"); /* , lookup_symbol(pc_start)); */ |
1200 | fdf9b3e8 | bellard | target_disas(logfile, pc_start, ctx.pc - pc_start, 0);
|
1201 | fdf9b3e8 | bellard | fprintf(logfile, "\n");
|
1202 | fdf9b3e8 | bellard | } |
1203 | fdf9b3e8 | bellard | if (loglevel & CPU_LOG_TB_OP) {
|
1204 | fdf9b3e8 | bellard | fprintf(logfile, "OP:\n");
|
1205 | fdf9b3e8 | bellard | dump_ops(gen_opc_buf, gen_opparam_buf); |
1206 | fdf9b3e8 | bellard | fprintf(logfile, "\n");
|
1207 | fdf9b3e8 | bellard | } |
1208 | fdf9b3e8 | bellard | #endif
|
1209 | fdf9b3e8 | bellard | return 0; |
1210 | fdf9b3e8 | bellard | } |
1211 | fdf9b3e8 | bellard | |
1212 | fdf9b3e8 | bellard | int gen_intermediate_code(CPUState * env, struct TranslationBlock *tb) |
1213 | fdf9b3e8 | bellard | { |
1214 | fdf9b3e8 | bellard | return gen_intermediate_code_internal(env, tb, 0); |
1215 | fdf9b3e8 | bellard | } |
1216 | fdf9b3e8 | bellard | |
1217 | fdf9b3e8 | bellard | int gen_intermediate_code_pc(CPUState * env, struct TranslationBlock *tb) |
1218 | fdf9b3e8 | bellard | { |
1219 | fdf9b3e8 | bellard | return gen_intermediate_code_internal(env, tb, 1); |
1220 | fdf9b3e8 | bellard | } |