root / cris-dis.c @ 7b239bec
History | View | Annotate | Download (80.6 kB)
1 | 450d4ff5 | ths | /* Disassembler code for CRIS.
|
---|---|---|---|
2 | 450d4ff5 | ths | Copyright 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
3 | 450d4ff5 | ths | Contributed by Axis Communications AB, Lund, Sweden.
|
4 | 450d4ff5 | ths | Written by Hans-Peter Nilsson.
|
5 | 450d4ff5 | ths | |
6 | 450d4ff5 | ths | This file is part of the GNU binutils and GDB, the GNU debugger.
|
7 | 450d4ff5 | ths | |
8 | 450d4ff5 | ths | This program is free software; you can redistribute it and/or modify it
|
9 | 450d4ff5 | ths | under the terms of the GNU General Public License as published by the
|
10 | 450d4ff5 | ths | Free Software Foundation; either version 2, or (at your option) any later
|
11 | 450d4ff5 | ths | version.
|
12 | 450d4ff5 | ths | |
13 | 450d4ff5 | ths | This program is distributed in the hope that it will be useful, but WITHOUT
|
14 | 450d4ff5 | ths | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
15 | 450d4ff5 | ths | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
16 | 450d4ff5 | ths | more details.
|
17 | 450d4ff5 | ths | |
18 | 450d4ff5 | ths | You should have received a copy of the GNU General Public License
|
19 | 450d4ff5 | ths | along with this program; if not, write to the Free Software
|
20 | 450d4ff5 | ths | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
21 | 450d4ff5 | ths | MA 02110-1301, USA. */
|
22 | 450d4ff5 | ths | |
23 | 450d4ff5 | ths | #include "dis-asm.h" |
24 | 450d4ff5 | ths | //#include "sysdep.h"
|
25 | 450d4ff5 | ths | #include "target-cris/opcode-cris.h" |
26 | 450d4ff5 | ths | //#include "libiberty.h"
|
27 | 450d4ff5 | ths | |
28 | 450d4ff5 | ths | |
29 | 450d4ff5 | ths | #define FALSE 0 |
30 | 450d4ff5 | ths | #define TRUE 1 |
31 | 450d4ff5 | ths | #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0) |
32 | 450d4ff5 | ths | |
33 | 450d4ff5 | ths | /* cris-opc.c -- Table of opcodes for the CRIS processor.
|
34 | 450d4ff5 | ths | Copyright 2000, 2001, 2004 Free Software Foundation, Inc.
|
35 | 450d4ff5 | ths | Contributed by Axis Communications AB, Lund, Sweden.
|
36 | 450d4ff5 | ths | Originally written for GAS 1.38.1 by Mikael Asker.
|
37 | 450d4ff5 | ths | Reorganized by Hans-Peter Nilsson.
|
38 | 450d4ff5 | ths | |
39 | 450d4ff5 | ths | This file is part of GAS, GDB and the GNU binutils.
|
40 | 450d4ff5 | ths | |
41 | 450d4ff5 | ths | GAS, GDB, and GNU binutils is free software; you can redistribute it
|
42 | 450d4ff5 | ths | and/or modify it under the terms of the GNU General Public License as
|
43 | 450d4ff5 | ths | published by the Free Software Foundation; either version 2, or (at your
|
44 | 450d4ff5 | ths | option) any later version.
|
45 | 450d4ff5 | ths | |
46 | 450d4ff5 | ths | GAS, GDB, and GNU binutils are distributed in the hope that they will be
|
47 | 450d4ff5 | ths | useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
48 | 450d4ff5 | ths | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
49 | 450d4ff5 | ths | GNU General Public License for more details.
|
50 | 450d4ff5 | ths | |
51 | 450d4ff5 | ths | You should have received a copy of the GNU General Public License
|
52 | 450d4ff5 | ths | along with this program; if not, write to the Free Software
|
53 | 450d4ff5 | ths | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
54 | 450d4ff5 | ths | |
55 | 450d4ff5 | ths | #ifndef NULL |
56 | 450d4ff5 | ths | #define NULL (0) |
57 | 450d4ff5 | ths | #endif
|
58 | 450d4ff5 | ths | |
59 | 450d4ff5 | ths | /* This table isn't used for CRISv32 and the size of immediate operands. */
|
60 | 450d4ff5 | ths | const struct cris_spec_reg |
61 | 450d4ff5 | ths | cris_spec_regs[] = |
62 | 450d4ff5 | ths | { |
63 | 450d4ff5 | ths | {"bz", 0, 1, cris_ver_v32p, NULL}, |
64 | 450d4ff5 | ths | {"p0", 0, 1, 0, NULL}, |
65 | 450d4ff5 | ths | {"vr", 1, 1, 0, NULL}, |
66 | 450d4ff5 | ths | {"p1", 1, 1, 0, NULL}, |
67 | 450d4ff5 | ths | {"pid", 2, 1, cris_ver_v32p, NULL}, |
68 | 450d4ff5 | ths | {"p2", 2, 1, cris_ver_v32p, NULL}, |
69 | 450d4ff5 | ths | {"p2", 2, 1, cris_ver_warning, NULL}, |
70 | 450d4ff5 | ths | {"srs", 3, 1, cris_ver_v32p, NULL}, |
71 | 450d4ff5 | ths | {"p3", 3, 1, cris_ver_v32p, NULL}, |
72 | 450d4ff5 | ths | {"p3", 3, 1, cris_ver_warning, NULL}, |
73 | 450d4ff5 | ths | {"wz", 4, 2, cris_ver_v32p, NULL}, |
74 | 450d4ff5 | ths | {"p4", 4, 2, 0, NULL}, |
75 | 450d4ff5 | ths | {"ccr", 5, 2, cris_ver_v0_10, NULL}, |
76 | 450d4ff5 | ths | {"exs", 5, 4, cris_ver_v32p, NULL}, |
77 | 450d4ff5 | ths | {"p5", 5, 2, cris_ver_v0_10, NULL}, |
78 | 450d4ff5 | ths | {"p5", 5, 4, cris_ver_v32p, NULL}, |
79 | 450d4ff5 | ths | {"dcr0",6, 2, cris_ver_v0_3, NULL}, |
80 | 450d4ff5 | ths | {"eda", 6, 4, cris_ver_v32p, NULL}, |
81 | 450d4ff5 | ths | {"p6", 6, 2, cris_ver_v0_3, NULL}, |
82 | 450d4ff5 | ths | {"p6", 6, 4, cris_ver_v32p, NULL}, |
83 | 450d4ff5 | ths | {"dcr1/mof", 7, 4, cris_ver_v10p, |
84 | 450d4ff5 | ths | "Register `dcr1/mof' with ambiguous size specified. Guessing 4 bytes"},
|
85 | 450d4ff5 | ths | {"dcr1/mof", 7, 2, cris_ver_v0_3, |
86 | 450d4ff5 | ths | "Register `dcr1/mof' with ambiguous size specified. Guessing 2 bytes"},
|
87 | 450d4ff5 | ths | {"mof", 7, 4, cris_ver_v10p, NULL}, |
88 | 450d4ff5 | ths | {"dcr1",7, 2, cris_ver_v0_3, NULL}, |
89 | 450d4ff5 | ths | {"p7", 7, 4, cris_ver_v10p, NULL}, |
90 | 450d4ff5 | ths | {"p7", 7, 2, cris_ver_v0_3, NULL}, |
91 | 450d4ff5 | ths | {"dz", 8, 4, cris_ver_v32p, NULL}, |
92 | 450d4ff5 | ths | {"p8", 8, 4, 0, NULL}, |
93 | 450d4ff5 | ths | {"ibr", 9, 4, cris_ver_v0_10, NULL}, |
94 | 450d4ff5 | ths | {"ebp", 9, 4, cris_ver_v32p, NULL}, |
95 | 450d4ff5 | ths | {"p9", 9, 4, 0, NULL}, |
96 | 450d4ff5 | ths | {"irp", 10, 4, cris_ver_v0_10, NULL}, |
97 | 450d4ff5 | ths | {"erp", 10, 4, cris_ver_v32p, NULL}, |
98 | 450d4ff5 | ths | {"p10", 10, 4, 0, NULL}, |
99 | 450d4ff5 | ths | {"srp", 11, 4, 0, NULL}, |
100 | 450d4ff5 | ths | {"p11", 11, 4, 0, NULL}, |
101 | 450d4ff5 | ths | /* For disassembly use only. Accept at assembly with a warning. */
|
102 | 450d4ff5 | ths | {"bar/dtp0", 12, 4, cris_ver_warning, |
103 | 450d4ff5 | ths | "Ambiguous register `bar/dtp0' specified"},
|
104 | 450d4ff5 | ths | {"nrp", 12, 4, cris_ver_v32p, NULL}, |
105 | 450d4ff5 | ths | {"bar", 12, 4, cris_ver_v8_10, NULL}, |
106 | 450d4ff5 | ths | {"dtp0",12, 4, cris_ver_v0_3, NULL}, |
107 | 450d4ff5 | ths | {"p12", 12, 4, 0, NULL}, |
108 | 450d4ff5 | ths | /* For disassembly use only. Accept at assembly with a warning. */
|
109 | 450d4ff5 | ths | {"dccr/dtp1",13, 4, cris_ver_warning, |
110 | 450d4ff5 | ths | "Ambiguous register `dccr/dtp1' specified"},
|
111 | 450d4ff5 | ths | {"ccs", 13, 4, cris_ver_v32p, NULL}, |
112 | 450d4ff5 | ths | {"dccr",13, 4, cris_ver_v8_10, NULL}, |
113 | 450d4ff5 | ths | {"dtp1",13, 4, cris_ver_v0_3, NULL}, |
114 | 450d4ff5 | ths | {"p13", 13, 4, 0, NULL}, |
115 | 450d4ff5 | ths | {"brp", 14, 4, cris_ver_v3_10, NULL}, |
116 | 450d4ff5 | ths | {"usp", 14, 4, cris_ver_v32p, NULL}, |
117 | 450d4ff5 | ths | {"p14", 14, 4, cris_ver_v3p, NULL}, |
118 | 450d4ff5 | ths | {"usp", 15, 4, cris_ver_v10, NULL}, |
119 | 450d4ff5 | ths | {"spc", 15, 4, cris_ver_v32p, NULL}, |
120 | 450d4ff5 | ths | {"p15", 15, 4, cris_ver_v10p, NULL}, |
121 | 450d4ff5 | ths | {NULL, 0, 0, cris_ver_version_all, NULL} |
122 | 450d4ff5 | ths | }; |
123 | 450d4ff5 | ths | |
124 | 450d4ff5 | ths | /* Add version specifiers to this table when necessary.
|
125 | 450d4ff5 | ths | The (now) regular coding of register names suggests a simpler
|
126 | 450d4ff5 | ths | implementation. */
|
127 | 450d4ff5 | ths | const struct cris_support_reg cris_support_regs[] = |
128 | 450d4ff5 | ths | { |
129 | 450d4ff5 | ths | {"s0", 0}, |
130 | 450d4ff5 | ths | {"s1", 1}, |
131 | 450d4ff5 | ths | {"s2", 2}, |
132 | 450d4ff5 | ths | {"s3", 3}, |
133 | 450d4ff5 | ths | {"s4", 4}, |
134 | 450d4ff5 | ths | {"s5", 5}, |
135 | 450d4ff5 | ths | {"s6", 6}, |
136 | 450d4ff5 | ths | {"s7", 7}, |
137 | 450d4ff5 | ths | {"s8", 8}, |
138 | 450d4ff5 | ths | {"s9", 9}, |
139 | 450d4ff5 | ths | {"s10", 10}, |
140 | 450d4ff5 | ths | {"s11", 11}, |
141 | 450d4ff5 | ths | {"s12", 12}, |
142 | 450d4ff5 | ths | {"s13", 13}, |
143 | 450d4ff5 | ths | {"s14", 14}, |
144 | 450d4ff5 | ths | {"s15", 15}, |
145 | 450d4ff5 | ths | {NULL, 0} |
146 | 450d4ff5 | ths | }; |
147 | 450d4ff5 | ths | |
148 | 450d4ff5 | ths | /* All CRIS opcodes are 16 bits.
|
149 | 450d4ff5 | ths | |
150 | 450d4ff5 | ths | - The match component is a mask saying which bits must match a
|
151 | 450d4ff5 | ths | particular opcode in order for an instruction to be an instance
|
152 | 450d4ff5 | ths | of that opcode.
|
153 | 450d4ff5 | ths | |
154 | 450d4ff5 | ths | - The args component is a string containing characters symbolically
|
155 | 450d4ff5 | ths | matching the operands of an instruction. Used for both assembly
|
156 | 450d4ff5 | ths | and disassembly.
|
157 | 450d4ff5 | ths | |
158 | 450d4ff5 | ths | Operand-matching characters:
|
159 | 450d4ff5 | ths | [ ] , space
|
160 | 450d4ff5 | ths | Verbatim.
|
161 | 450d4ff5 | ths | A The string "ACR" (case-insensitive).
|
162 | 450d4ff5 | ths | B Not really an operand. It causes a "BDAP -size,SP" prefix to be
|
163 | 450d4ff5 | ths | output for the PUSH alias-instructions and recognizes a push-
|
164 | 450d4ff5 | ths | prefix at disassembly. This letter isn't recognized for v32.
|
165 | 450d4ff5 | ths | Must be followed by a R or P letter.
|
166 | 450d4ff5 | ths | ! Non-match pattern, will not match if there's a prefix insn.
|
167 | 450d4ff5 | ths | b Non-matching operand, used for branches with 16-bit
|
168 | 450d4ff5 | ths | displacement. Only recognized by the disassembler.
|
169 | 450d4ff5 | ths | c 5-bit unsigned immediate in bits <4:0>.
|
170 | 450d4ff5 | ths | C 4-bit unsigned immediate in bits <3:0>.
|
171 | 450d4ff5 | ths | d At assembly, optionally (as in put other cases before this one)
|
172 | 450d4ff5 | ths | ".d" or ".D" at the start of the operands, followed by one space
|
173 | 450d4ff5 | ths | character. At disassembly, nothing.
|
174 | 450d4ff5 | ths | D General register in bits <15:12> and <3:0>.
|
175 | 450d4ff5 | ths | f List of flags in bits <15:12> and <3:0>.
|
176 | 450d4ff5 | ths | i 6-bit signed immediate in bits <5:0>.
|
177 | 450d4ff5 | ths | I 6-bit unsigned immediate in bits <5:0>.
|
178 | 450d4ff5 | ths | M Size modifier (B, W or D) for CLEAR instructions.
|
179 | 450d4ff5 | ths | m Size modifier (B, W or D) in bits <5:4>
|
180 | 450d4ff5 | ths | N A 32-bit dword, like in the difference between s and y.
|
181 | 450d4ff5 | ths | This has no effect on bits in the opcode. Can also be expressed
|
182 | 450d4ff5 | ths | as "[pc+]" in input.
|
183 | 450d4ff5 | ths | n As N, but PC-relative (to the start of the instruction).
|
184 | 450d4ff5 | ths | o [-128..127] word offset in bits <7:1> and <0>. Used by 8-bit
|
185 | 450d4ff5 | ths | branch instructions.
|
186 | 450d4ff5 | ths | O [-128..127] offset in bits <7:0>. Also matches a comma and a
|
187 | 450d4ff5 | ths | general register after the expression, in bits <15:12>. Used
|
188 | 450d4ff5 | ths | only for the BDAP prefix insn (in v32 the ADDOQ insn; same opcode).
|
189 | 450d4ff5 | ths | P Special register in bits <15:12>.
|
190 | 450d4ff5 | ths | p Indicates that the insn is a prefix insn. Must be first
|
191 | 450d4ff5 | ths | character.
|
192 | 450d4ff5 | ths | Q As O, but don't relax; force an 8-bit offset.
|
193 | 450d4ff5 | ths | R General register in bits <15:12>.
|
194 | 450d4ff5 | ths | r General register in bits <3:0>.
|
195 | 450d4ff5 | ths | S Source operand in bit <10> and a prefix; a 3-operand prefix
|
196 | 450d4ff5 | ths | without side-effect.
|
197 | 450d4ff5 | ths | s Source operand in bits <10> and <3:0>, optionally with a
|
198 | 450d4ff5 | ths | side-effect prefix, except [pc] (the name, not R15 as in ACR)
|
199 | 450d4ff5 | ths | isn't allowed for v32 and higher.
|
200 | 450d4ff5 | ths | T Support register in bits <15:12>.
|
201 | 450d4ff5 | ths | u 4-bit (PC-relative) unsigned immediate word offset in bits <3:0>.
|
202 | 450d4ff5 | ths | U Relaxes to either u or n, instruction is assumed LAPCQ or LAPC.
|
203 | 450d4ff5 | ths | Not recognized at disassembly.
|
204 | 450d4ff5 | ths | x Register-dot-modifier, for example "r5.w" in bits <15:12> and <5:4>.
|
205 | 450d4ff5 | ths | y Like 's' but do not allow an integer at assembly.
|
206 | 450d4ff5 | ths | Y The difference s-y; only an integer is allowed.
|
207 | 450d4ff5 | ths | z Size modifier (B or W) in bit <4>. */
|
208 | 450d4ff5 | ths | |
209 | 450d4ff5 | ths | |
210 | 450d4ff5 | ths | /* Please note the order of the opcodes in this table is significant.
|
211 | 450d4ff5 | ths | The assembler requires that all instances of the same mnemonic must
|
212 | 450d4ff5 | ths | be consecutive. If they aren't, the assembler might not recognize
|
213 | 450d4ff5 | ths | them, or may indicate an internal error.
|
214 | 450d4ff5 | ths | |
215 | 450d4ff5 | ths | The disassembler should not normally care about the order of the
|
216 | 450d4ff5 | ths | opcodes, but will prefer an earlier alternative if the "match-score"
|
217 | 450d4ff5 | ths | (see cris-dis.c) is computed as equal.
|
218 | 450d4ff5 | ths | |
219 | 450d4ff5 | ths | It should not be significant for proper execution that this table is
|
220 | 450d4ff5 | ths | in alphabetical order, but please follow that convention for an easy
|
221 | 450d4ff5 | ths | overview. */
|
222 | 450d4ff5 | ths | |
223 | 450d4ff5 | ths | const struct cris_opcode |
224 | 450d4ff5 | ths | cris_opcodes[] = |
225 | 450d4ff5 | ths | { |
226 | 450d4ff5 | ths | {"abs", 0x06B0, 0x0940, "r,R", 0, SIZE_NONE, 0, |
227 | 450d4ff5 | ths | cris_abs_op}, |
228 | 450d4ff5 | ths | |
229 | 450d4ff5 | ths | {"add", 0x0600, 0x09c0, "m r,R", 0, SIZE_NONE, 0, |
230 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
231 | 450d4ff5 | ths | |
232 | 450d4ff5 | ths | {"add", 0x0A00, 0x01c0, "m s,R", 0, SIZE_FIELD, 0, |
233 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
234 | 450d4ff5 | ths | |
235 | 450d4ff5 | ths | {"add", 0x0A00, 0x01c0, "m S,D", 0, SIZE_NONE, |
236 | 450d4ff5 | ths | cris_ver_v0_10, |
237 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
238 | 450d4ff5 | ths | |
239 | 450d4ff5 | ths | {"add", 0x0a00, 0x05c0, "m S,R,r", 0, SIZE_NONE, |
240 | 450d4ff5 | ths | cris_ver_v0_10, |
241 | 450d4ff5 | ths | cris_three_operand_add_sub_cmp_and_or_op}, |
242 | 450d4ff5 | ths | |
243 | 450d4ff5 | ths | {"add", 0x0A00, 0x01c0, "m s,R", 0, SIZE_FIELD, |
244 | 450d4ff5 | ths | cris_ver_v32p, |
245 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
246 | 450d4ff5 | ths | |
247 | 450d4ff5 | ths | {"addc", 0x0570, 0x0A80, "r,R", 0, SIZE_FIX_32, |
248 | 450d4ff5 | ths | cris_ver_v32p, |
249 | 450d4ff5 | ths | cris_not_implemented_op}, |
250 | 450d4ff5 | ths | |
251 | 450d4ff5 | ths | {"addc", 0x09A0, 0x0250, "s,R", 0, SIZE_FIX_32, |
252 | 450d4ff5 | ths | cris_ver_v32p, |
253 | 450d4ff5 | ths | cris_not_implemented_op}, |
254 | 450d4ff5 | ths | |
255 | 450d4ff5 | ths | {"addi", 0x0540, 0x0A80, "x,r,A", 0, SIZE_NONE, |
256 | 450d4ff5 | ths | cris_ver_v32p, |
257 | 450d4ff5 | ths | cris_addi_op}, |
258 | 450d4ff5 | ths | |
259 | 450d4ff5 | ths | {"addi", 0x0500, 0x0Ac0, "x,r", 0, SIZE_NONE, 0, |
260 | 450d4ff5 | ths | cris_addi_op}, |
261 | 450d4ff5 | ths | |
262 | 450d4ff5 | ths | /* This collates after "addo", but we want to disassemble as "addoq",
|
263 | 450d4ff5 | ths | not "addo". */
|
264 | 450d4ff5 | ths | {"addoq", 0x0100, 0x0E00, "Q,A", 0, SIZE_NONE, |
265 | 450d4ff5 | ths | cris_ver_v32p, |
266 | 450d4ff5 | ths | cris_not_implemented_op}, |
267 | 450d4ff5 | ths | |
268 | 450d4ff5 | ths | {"addo", 0x0940, 0x0280, "m s,R,A", 0, SIZE_FIELD_SIGNED, |
269 | 450d4ff5 | ths | cris_ver_v32p, |
270 | 450d4ff5 | ths | cris_not_implemented_op}, |
271 | 450d4ff5 | ths | |
272 | 450d4ff5 | ths | /* This must be located after the insn above, lest we misinterpret
|
273 | 450d4ff5 | ths | "addo.b -1,r0,acr" as "addo .b-1,r0,acr". FIXME: Sounds like a
|
274 | 450d4ff5 | ths | parser bug. */
|
275 | 450d4ff5 | ths | {"addo", 0x0100, 0x0E00, "O,A", 0, SIZE_NONE, |
276 | 450d4ff5 | ths | cris_ver_v32p, |
277 | 450d4ff5 | ths | cris_not_implemented_op}, |
278 | 450d4ff5 | ths | |
279 | 450d4ff5 | ths | {"addq", 0x0200, 0x0Dc0, "I,R", 0, SIZE_NONE, 0, |
280 | 450d4ff5 | ths | cris_quick_mode_add_sub_op}, |
281 | 450d4ff5 | ths | |
282 | 450d4ff5 | ths | {"adds", 0x0420, 0x0Bc0, "z r,R", 0, SIZE_NONE, 0, |
283 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
284 | 450d4ff5 | ths | |
285 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_SIGNED and all necessary changes. */
|
286 | 450d4ff5 | ths | {"adds", 0x0820, 0x03c0, "z s,R", 0, SIZE_FIELD, 0, |
287 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
288 | 450d4ff5 | ths | |
289 | 450d4ff5 | ths | {"adds", 0x0820, 0x03c0, "z S,D", 0, SIZE_NONE, |
290 | 450d4ff5 | ths | cris_ver_v0_10, |
291 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
292 | 450d4ff5 | ths | |
293 | 450d4ff5 | ths | {"adds", 0x0820, 0x07c0, "z S,R,r", 0, SIZE_NONE, |
294 | 450d4ff5 | ths | cris_ver_v0_10, |
295 | 450d4ff5 | ths | cris_three_operand_add_sub_cmp_and_or_op}, |
296 | 450d4ff5 | ths | |
297 | 450d4ff5 | ths | {"addu", 0x0400, 0x0be0, "z r,R", 0, SIZE_NONE, 0, |
298 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
299 | 450d4ff5 | ths | |
300 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
|
301 | 450d4ff5 | ths | {"addu", 0x0800, 0x03e0, "z s,R", 0, SIZE_FIELD, 0, |
302 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
303 | 450d4ff5 | ths | |
304 | 450d4ff5 | ths | {"addu", 0x0800, 0x03e0, "z S,D", 0, SIZE_NONE, |
305 | 450d4ff5 | ths | cris_ver_v0_10, |
306 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
307 | 450d4ff5 | ths | |
308 | 450d4ff5 | ths | {"addu", 0x0800, 0x07e0, "z S,R,r", 0, SIZE_NONE, |
309 | 450d4ff5 | ths | cris_ver_v0_10, |
310 | 450d4ff5 | ths | cris_three_operand_add_sub_cmp_and_or_op}, |
311 | 450d4ff5 | ths | |
312 | 450d4ff5 | ths | {"and", 0x0700, 0x08C0, "m r,R", 0, SIZE_NONE, 0, |
313 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
314 | 450d4ff5 | ths | |
315 | 450d4ff5 | ths | {"and", 0x0B00, 0x00C0, "m s,R", 0, SIZE_FIELD, 0, |
316 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
317 | 450d4ff5 | ths | |
318 | 450d4ff5 | ths | {"and", 0x0B00, 0x00C0, "m S,D", 0, SIZE_NONE, |
319 | 450d4ff5 | ths | cris_ver_v0_10, |
320 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
321 | 450d4ff5 | ths | |
322 | 450d4ff5 | ths | {"and", 0x0B00, 0x04C0, "m S,R,r", 0, SIZE_NONE, |
323 | 450d4ff5 | ths | cris_ver_v0_10, |
324 | 450d4ff5 | ths | cris_three_operand_add_sub_cmp_and_or_op}, |
325 | 450d4ff5 | ths | |
326 | 450d4ff5 | ths | {"andq", 0x0300, 0x0CC0, "i,R", 0, SIZE_NONE, 0, |
327 | 450d4ff5 | ths | cris_quick_mode_and_cmp_move_or_op}, |
328 | 450d4ff5 | ths | |
329 | 450d4ff5 | ths | {"asr", 0x0780, 0x0840, "m r,R", 0, SIZE_NONE, 0, |
330 | 450d4ff5 | ths | cris_asr_op}, |
331 | 450d4ff5 | ths | |
332 | 450d4ff5 | ths | {"asrq", 0x03a0, 0x0c40, "c,R", 0, SIZE_NONE, 0, |
333 | 450d4ff5 | ths | cris_asrq_op}, |
334 | 450d4ff5 | ths | |
335 | 450d4ff5 | ths | {"ax", 0x15B0, 0xEA4F, "", 0, SIZE_NONE, 0, |
336 | 450d4ff5 | ths | cris_ax_ei_setf_op}, |
337 | 450d4ff5 | ths | |
338 | 450d4ff5 | ths | /* FIXME: Should use branch #defines. */
|
339 | 450d4ff5 | ths | {"b", 0x0dff, 0x0200, "b", 1, SIZE_NONE, 0, |
340 | 450d4ff5 | ths | cris_sixteen_bit_offset_branch_op}, |
341 | 450d4ff5 | ths | |
342 | 450d4ff5 | ths | {"ba",
|
343 | 450d4ff5 | ths | BA_QUICK_OPCODE, |
344 | 450d4ff5 | ths | 0x0F00+(0xF-CC_A)*0x1000, "o", 1, SIZE_NONE, 0, |
345 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
346 | 450d4ff5 | ths | |
347 | 450d4ff5 | ths | /* Needs to come after the usual "ba o", which might be relaxed to
|
348 | 450d4ff5 | ths | this one. */
|
349 | 450d4ff5 | ths | {"ba", BA_DWORD_OPCODE,
|
350 | 450d4ff5 | ths | 0xffff & (~BA_DWORD_OPCODE), "n", 0, SIZE_FIX_32, |
351 | 450d4ff5 | ths | cris_ver_v32p, |
352 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
353 | 450d4ff5 | ths | |
354 | 450d4ff5 | ths | {"bas", 0x0EBF, 0x0140, "n,P", 0, SIZE_FIX_32, |
355 | 450d4ff5 | ths | cris_ver_v32p, |
356 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
357 | 450d4ff5 | ths | |
358 | 450d4ff5 | ths | {"basc", 0x0EFF, 0x0100, "n,P", 0, SIZE_FIX_32, |
359 | 450d4ff5 | ths | cris_ver_v32p, |
360 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
361 | 450d4ff5 | ths | |
362 | 450d4ff5 | ths | {"bcc",
|
363 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_CC*0x1000,
|
364 | 450d4ff5 | ths | 0x0f00+(0xF-CC_CC)*0x1000, "o", 1, SIZE_NONE, 0, |
365 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
366 | 450d4ff5 | ths | |
367 | 450d4ff5 | ths | {"bcs",
|
368 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_CS*0x1000,
|
369 | 450d4ff5 | ths | 0x0f00+(0xF-CC_CS)*0x1000, "o", 1, SIZE_NONE, 0, |
370 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
371 | 450d4ff5 | ths | |
372 | 450d4ff5 | ths | {"bdap",
|
373 | 450d4ff5 | ths | BDAP_INDIR_OPCODE, BDAP_INDIR_Z_BITS, "pm s,R", 0, SIZE_FIELD_SIGNED, |
374 | 450d4ff5 | ths | cris_ver_v0_10, |
375 | 450d4ff5 | ths | cris_bdap_prefix}, |
376 | 450d4ff5 | ths | |
377 | 450d4ff5 | ths | {"bdap",
|
378 | 450d4ff5 | ths | BDAP_QUICK_OPCODE, BDAP_QUICK_Z_BITS, "pO", 0, SIZE_NONE, |
379 | 450d4ff5 | ths | cris_ver_v0_10, |
380 | 450d4ff5 | ths | cris_quick_mode_bdap_prefix}, |
381 | 450d4ff5 | ths | |
382 | 450d4ff5 | ths | {"beq",
|
383 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_EQ*0x1000,
|
384 | 450d4ff5 | ths | 0x0f00+(0xF-CC_EQ)*0x1000, "o", 1, SIZE_NONE, 0, |
385 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
386 | 450d4ff5 | ths | |
387 | 450d4ff5 | ths | /* This is deliberately put before "bext" to trump it, even though not
|
388 | 450d4ff5 | ths | in alphabetical order, since we don't do excluding version checks
|
389 | 450d4ff5 | ths | for v0..v10. */
|
390 | 450d4ff5 | ths | {"bwf",
|
391 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_EXT*0x1000,
|
392 | 450d4ff5 | ths | 0x0f00+(0xF-CC_EXT)*0x1000, "o", 1, SIZE_NONE, |
393 | 450d4ff5 | ths | cris_ver_v10, |
394 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
395 | 450d4ff5 | ths | |
396 | 450d4ff5 | ths | {"bext",
|
397 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_EXT*0x1000,
|
398 | 450d4ff5 | ths | 0x0f00+(0xF-CC_EXT)*0x1000, "o", 1, SIZE_NONE, |
399 | 450d4ff5 | ths | cris_ver_v0_3, |
400 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
401 | 450d4ff5 | ths | |
402 | 450d4ff5 | ths | {"bge",
|
403 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_GE*0x1000,
|
404 | 450d4ff5 | ths | 0x0f00+(0xF-CC_GE)*0x1000, "o", 1, SIZE_NONE, 0, |
405 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
406 | 450d4ff5 | ths | |
407 | 450d4ff5 | ths | {"bgt",
|
408 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_GT*0x1000,
|
409 | 450d4ff5 | ths | 0x0f00+(0xF-CC_GT)*0x1000, "o", 1, SIZE_NONE, 0, |
410 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
411 | 450d4ff5 | ths | |
412 | 450d4ff5 | ths | {"bhi",
|
413 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_HI*0x1000,
|
414 | 450d4ff5 | ths | 0x0f00+(0xF-CC_HI)*0x1000, "o", 1, SIZE_NONE, 0, |
415 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
416 | 450d4ff5 | ths | |
417 | 450d4ff5 | ths | {"bhs",
|
418 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_HS*0x1000,
|
419 | 450d4ff5 | ths | 0x0f00+(0xF-CC_HS)*0x1000, "o", 1, SIZE_NONE, 0, |
420 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
421 | 450d4ff5 | ths | |
422 | 450d4ff5 | ths | {"biap", BIAP_OPCODE, BIAP_Z_BITS, "pm r,R", 0, SIZE_NONE, |
423 | 450d4ff5 | ths | cris_ver_v0_10, |
424 | 450d4ff5 | ths | cris_biap_prefix}, |
425 | 450d4ff5 | ths | |
426 | 450d4ff5 | ths | {"ble",
|
427 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_LE*0x1000,
|
428 | 450d4ff5 | ths | 0x0f00+(0xF-CC_LE)*0x1000, "o", 1, SIZE_NONE, 0, |
429 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
430 | 450d4ff5 | ths | |
431 | 450d4ff5 | ths | {"blo",
|
432 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_LO*0x1000,
|
433 | 450d4ff5 | ths | 0x0f00+(0xF-CC_LO)*0x1000, "o", 1, SIZE_NONE, 0, |
434 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
435 | 450d4ff5 | ths | |
436 | 450d4ff5 | ths | {"bls",
|
437 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_LS*0x1000,
|
438 | 450d4ff5 | ths | 0x0f00+(0xF-CC_LS)*0x1000, "o", 1, SIZE_NONE, 0, |
439 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
440 | 450d4ff5 | ths | |
441 | 450d4ff5 | ths | {"blt",
|
442 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_LT*0x1000,
|
443 | 450d4ff5 | ths | 0x0f00+(0xF-CC_LT)*0x1000, "o", 1, SIZE_NONE, 0, |
444 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
445 | 450d4ff5 | ths | |
446 | 450d4ff5 | ths | {"bmi",
|
447 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_MI*0x1000,
|
448 | 450d4ff5 | ths | 0x0f00+(0xF-CC_MI)*0x1000, "o", 1, SIZE_NONE, 0, |
449 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
450 | 450d4ff5 | ths | |
451 | 450d4ff5 | ths | {"bmod", 0x0ab0, 0x0140, "s,R", 0, SIZE_FIX_32, |
452 | 450d4ff5 | ths | cris_ver_sim_v0_10, |
453 | 450d4ff5 | ths | cris_not_implemented_op}, |
454 | 450d4ff5 | ths | |
455 | 450d4ff5 | ths | {"bmod", 0x0ab0, 0x0140, "S,D", 0, SIZE_NONE, |
456 | 450d4ff5 | ths | cris_ver_sim_v0_10, |
457 | 450d4ff5 | ths | cris_not_implemented_op}, |
458 | 450d4ff5 | ths | |
459 | 450d4ff5 | ths | {"bmod", 0x0ab0, 0x0540, "S,R,r", 0, SIZE_NONE, |
460 | 450d4ff5 | ths | cris_ver_sim_v0_10, |
461 | 450d4ff5 | ths | cris_not_implemented_op}, |
462 | 450d4ff5 | ths | |
463 | 450d4ff5 | ths | {"bne",
|
464 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_NE*0x1000,
|
465 | 450d4ff5 | ths | 0x0f00+(0xF-CC_NE)*0x1000, "o", 1, SIZE_NONE, 0, |
466 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
467 | 450d4ff5 | ths | |
468 | 450d4ff5 | ths | {"bound", 0x05c0, 0x0A00, "m r,R", 0, SIZE_NONE, 0, |
469 | 450d4ff5 | ths | cris_two_operand_bound_op}, |
470 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
|
471 | 450d4ff5 | ths | {"bound", 0x09c0, 0x0200, "m s,R", 0, SIZE_FIELD, |
472 | 450d4ff5 | ths | cris_ver_v0_10, |
473 | 450d4ff5 | ths | cris_two_operand_bound_op}, |
474 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
|
475 | 450d4ff5 | ths | {"bound", 0x0dcf, 0x0200, "m Y,R", 0, SIZE_FIELD, 0, |
476 | 450d4ff5 | ths | cris_two_operand_bound_op}, |
477 | 450d4ff5 | ths | {"bound", 0x09c0, 0x0200, "m S,D", 0, SIZE_NONE, |
478 | 450d4ff5 | ths | cris_ver_v0_10, |
479 | 450d4ff5 | ths | cris_two_operand_bound_op}, |
480 | 450d4ff5 | ths | {"bound", 0x09c0, 0x0600, "m S,R,r", 0, SIZE_NONE, |
481 | 450d4ff5 | ths | cris_ver_v0_10, |
482 | 450d4ff5 | ths | cris_three_operand_bound_op}, |
483 | 450d4ff5 | ths | |
484 | 450d4ff5 | ths | {"bpl",
|
485 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_PL*0x1000,
|
486 | 450d4ff5 | ths | 0x0f00+(0xF-CC_PL)*0x1000, "o", 1, SIZE_NONE, 0, |
487 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
488 | 450d4ff5 | ths | |
489 | 450d4ff5 | ths | {"break", 0xe930, 0x16c0, "C", 0, SIZE_NONE, |
490 | 450d4ff5 | ths | cris_ver_v3p, |
491 | 450d4ff5 | ths | cris_break_op}, |
492 | 450d4ff5 | ths | |
493 | 450d4ff5 | ths | {"bsb",
|
494 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_EXT*0x1000,
|
495 | 450d4ff5 | ths | 0x0f00+(0xF-CC_EXT)*0x1000, "o", 1, SIZE_NONE, |
496 | 450d4ff5 | ths | cris_ver_v32p, |
497 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
498 | 450d4ff5 | ths | |
499 | 450d4ff5 | ths | {"bsr", 0xBEBF, 0x4140, "n", 0, SIZE_FIX_32, |
500 | 450d4ff5 | ths | cris_ver_v32p, |
501 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
502 | 450d4ff5 | ths | |
503 | 450d4ff5 | ths | {"bsrc", 0xBEFF, 0x4100, "n", 0, SIZE_FIX_32, |
504 | 450d4ff5 | ths | cris_ver_v32p, |
505 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
506 | 450d4ff5 | ths | |
507 | 450d4ff5 | ths | {"bstore", 0x0af0, 0x0100, "s,R", 0, SIZE_FIX_32, |
508 | 450d4ff5 | ths | cris_ver_warning, |
509 | 450d4ff5 | ths | cris_not_implemented_op}, |
510 | 450d4ff5 | ths | |
511 | 450d4ff5 | ths | {"bstore", 0x0af0, 0x0100, "S,D", 0, SIZE_NONE, |
512 | 450d4ff5 | ths | cris_ver_warning, |
513 | 450d4ff5 | ths | cris_not_implemented_op}, |
514 | 450d4ff5 | ths | |
515 | 450d4ff5 | ths | {"bstore", 0x0af0, 0x0500, "S,R,r", 0, SIZE_NONE, |
516 | 450d4ff5 | ths | cris_ver_warning, |
517 | 450d4ff5 | ths | cris_not_implemented_op}, |
518 | 450d4ff5 | ths | |
519 | 450d4ff5 | ths | {"btst", 0x04F0, 0x0B00, "r,R", 0, SIZE_NONE, 0, |
520 | 450d4ff5 | ths | cris_btst_nop_op}, |
521 | 450d4ff5 | ths | {"btstq", 0x0380, 0x0C60, "c,R", 0, SIZE_NONE, 0, |
522 | 450d4ff5 | ths | cris_btst_nop_op}, |
523 | 450d4ff5 | ths | |
524 | 450d4ff5 | ths | {"bvc",
|
525 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_VC*0x1000,
|
526 | 450d4ff5 | ths | 0x0f00+(0xF-CC_VC)*0x1000, "o", 1, SIZE_NONE, 0, |
527 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
528 | 450d4ff5 | ths | |
529 | 450d4ff5 | ths | {"bvs",
|
530 | 450d4ff5 | ths | BRANCH_QUICK_OPCODE+CC_VS*0x1000,
|
531 | 450d4ff5 | ths | 0x0f00+(0xF-CC_VS)*0x1000, "o", 1, SIZE_NONE, 0, |
532 | 450d4ff5 | ths | cris_eight_bit_offset_branch_op}, |
533 | 450d4ff5 | ths | |
534 | 450d4ff5 | ths | {"clear", 0x0670, 0x3980, "M r", 0, SIZE_NONE, 0, |
535 | 450d4ff5 | ths | cris_reg_mode_clear_op}, |
536 | 450d4ff5 | ths | |
537 | 450d4ff5 | ths | {"clear", 0x0A70, 0x3180, "M y", 0, SIZE_NONE, 0, |
538 | 450d4ff5 | ths | cris_none_reg_mode_clear_test_op}, |
539 | 450d4ff5 | ths | |
540 | 450d4ff5 | ths | {"clear", 0x0A70, 0x3180, "M S", 0, SIZE_NONE, |
541 | 450d4ff5 | ths | cris_ver_v0_10, |
542 | 450d4ff5 | ths | cris_none_reg_mode_clear_test_op}, |
543 | 450d4ff5 | ths | |
544 | 450d4ff5 | ths | {"clearf", 0x05F0, 0x0A00, "f", 0, SIZE_NONE, 0, |
545 | 450d4ff5 | ths | cris_clearf_di_op}, |
546 | 450d4ff5 | ths | |
547 | 450d4ff5 | ths | {"cmp", 0x06C0, 0x0900, "m r,R", 0, SIZE_NONE, 0, |
548 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
549 | 450d4ff5 | ths | |
550 | 450d4ff5 | ths | {"cmp", 0x0Ac0, 0x0100, "m s,R", 0, SIZE_FIELD, 0, |
551 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
552 | 450d4ff5 | ths | |
553 | 450d4ff5 | ths | {"cmp", 0x0Ac0, 0x0100, "m S,D", 0, SIZE_NONE, |
554 | 450d4ff5 | ths | cris_ver_v0_10, |
555 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
556 | 450d4ff5 | ths | |
557 | 450d4ff5 | ths | {"cmpq", 0x02C0, 0x0D00, "i,R", 0, SIZE_NONE, 0, |
558 | 450d4ff5 | ths | cris_quick_mode_and_cmp_move_or_op}, |
559 | 450d4ff5 | ths | |
560 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_SIGNED and all necessary changes. */
|
561 | 450d4ff5 | ths | {"cmps", 0x08e0, 0x0300, "z s,R", 0, SIZE_FIELD, 0, |
562 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
563 | 450d4ff5 | ths | |
564 | 450d4ff5 | ths | {"cmps", 0x08e0, 0x0300, "z S,D", 0, SIZE_NONE, |
565 | 450d4ff5 | ths | cris_ver_v0_10, |
566 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
567 | 450d4ff5 | ths | |
568 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
|
569 | 450d4ff5 | ths | {"cmpu", 0x08c0, 0x0320, "z s,R" , 0, SIZE_FIELD, 0, |
570 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
571 | 450d4ff5 | ths | |
572 | 450d4ff5 | ths | {"cmpu", 0x08c0, 0x0320, "z S,D", 0, SIZE_NONE, |
573 | 450d4ff5 | ths | cris_ver_v0_10, |
574 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
575 | 450d4ff5 | ths | |
576 | 450d4ff5 | ths | {"di", 0x25F0, 0xDA0F, "", 0, SIZE_NONE, 0, |
577 | 450d4ff5 | ths | cris_clearf_di_op}, |
578 | 450d4ff5 | ths | |
579 | 450d4ff5 | ths | {"dip", DIP_OPCODE, DIP_Z_BITS, "ps", 0, SIZE_FIX_32, |
580 | 450d4ff5 | ths | cris_ver_v0_10, |
581 | 450d4ff5 | ths | cris_dip_prefix}, |
582 | 450d4ff5 | ths | |
583 | 450d4ff5 | ths | {"div", 0x0980, 0x0640, "m R,r", 0, SIZE_FIELD, 0, |
584 | 450d4ff5 | ths | cris_not_implemented_op}, |
585 | 450d4ff5 | ths | |
586 | 450d4ff5 | ths | {"dstep", 0x06f0, 0x0900, "r,R", 0, SIZE_NONE, 0, |
587 | 450d4ff5 | ths | cris_dstep_logshift_mstep_neg_not_op}, |
588 | 450d4ff5 | ths | |
589 | 450d4ff5 | ths | {"ei", 0x25B0, 0xDA4F, "", 0, SIZE_NONE, 0, |
590 | 450d4ff5 | ths | cris_ax_ei_setf_op}, |
591 | 450d4ff5 | ths | |
592 | 450d4ff5 | ths | {"fidxd", 0x0ab0, 0xf540, "[r]", 0, SIZE_NONE, |
593 | 450d4ff5 | ths | cris_ver_v32p, |
594 | 450d4ff5 | ths | cris_not_implemented_op}, |
595 | 450d4ff5 | ths | |
596 | 450d4ff5 | ths | {"fidxi", 0x0d30, 0xF2C0, "[r]", 0, SIZE_NONE, |
597 | 450d4ff5 | ths | cris_ver_v32p, |
598 | 450d4ff5 | ths | cris_not_implemented_op}, |
599 | 450d4ff5 | ths | |
600 | 450d4ff5 | ths | {"ftagd", 0x1AB0, 0xE540, "[r]", 0, SIZE_NONE, |
601 | 450d4ff5 | ths | cris_ver_v32p, |
602 | 450d4ff5 | ths | cris_not_implemented_op}, |
603 | 450d4ff5 | ths | |
604 | 450d4ff5 | ths | {"ftagi", 0x1D30, 0xE2C0, "[r]", 0, SIZE_NONE, |
605 | 450d4ff5 | ths | cris_ver_v32p, |
606 | 450d4ff5 | ths | cris_not_implemented_op}, |
607 | 450d4ff5 | ths | |
608 | 450d4ff5 | ths | {"halt", 0xF930, 0x06CF, "", 0, SIZE_NONE, |
609 | 450d4ff5 | ths | cris_ver_v32p, |
610 | 450d4ff5 | ths | cris_not_implemented_op}, |
611 | 450d4ff5 | ths | |
612 | 450d4ff5 | ths | {"jas", 0x09B0, 0x0640, "r,P", 0, SIZE_NONE, |
613 | 450d4ff5 | ths | cris_ver_v32p, |
614 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
615 | 450d4ff5 | ths | |
616 | 450d4ff5 | ths | {"jas", 0x0DBF, 0x0240, "N,P", 0, SIZE_FIX_32, |
617 | 450d4ff5 | ths | cris_ver_v32p, |
618 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
619 | 450d4ff5 | ths | |
620 | 450d4ff5 | ths | {"jasc", 0x0B30, 0x04C0, "r,P", 0, SIZE_NONE, |
621 | 450d4ff5 | ths | cris_ver_v32p, |
622 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
623 | 450d4ff5 | ths | |
624 | 450d4ff5 | ths | {"jasc", 0x0F3F, 0x00C0, "N,P", 0, SIZE_FIX_32, |
625 | 450d4ff5 | ths | cris_ver_v32p, |
626 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
627 | 450d4ff5 | ths | |
628 | 450d4ff5 | ths | {"jbrc", 0x69b0, 0x9640, "r", 0, SIZE_NONE, |
629 | 450d4ff5 | ths | cris_ver_v8_10, |
630 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
631 | 450d4ff5 | ths | |
632 | 450d4ff5 | ths | {"jbrc", 0x6930, 0x92c0, "s", 0, SIZE_FIX_32, |
633 | 450d4ff5 | ths | cris_ver_v8_10, |
634 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
635 | 450d4ff5 | ths | |
636 | 450d4ff5 | ths | {"jbrc", 0x6930, 0x92c0, "S", 0, SIZE_NONE, |
637 | 450d4ff5 | ths | cris_ver_v8_10, |
638 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
639 | 450d4ff5 | ths | |
640 | 450d4ff5 | ths | {"jir", 0xA9b0, 0x5640, "r", 0, SIZE_NONE, |
641 | 450d4ff5 | ths | cris_ver_v8_10, |
642 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
643 | 450d4ff5 | ths | |
644 | 450d4ff5 | ths | {"jir", 0xA930, 0x52c0, "s", 0, SIZE_FIX_32, |
645 | 450d4ff5 | ths | cris_ver_v8_10, |
646 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
647 | 450d4ff5 | ths | |
648 | 450d4ff5 | ths | {"jir", 0xA930, 0x52c0, "S", 0, SIZE_NONE, |
649 | 450d4ff5 | ths | cris_ver_v8_10, |
650 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
651 | 450d4ff5 | ths | |
652 | 450d4ff5 | ths | {"jirc", 0x29b0, 0xd640, "r", 0, SIZE_NONE, |
653 | 450d4ff5 | ths | cris_ver_v8_10, |
654 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
655 | 450d4ff5 | ths | |
656 | 450d4ff5 | ths | {"jirc", 0x2930, 0xd2c0, "s", 0, SIZE_FIX_32, |
657 | 450d4ff5 | ths | cris_ver_v8_10, |
658 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
659 | 450d4ff5 | ths | |
660 | 450d4ff5 | ths | {"jirc", 0x2930, 0xd2c0, "S", 0, SIZE_NONE, |
661 | 450d4ff5 | ths | cris_ver_v8_10, |
662 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
663 | 450d4ff5 | ths | |
664 | 450d4ff5 | ths | {"jsr", 0xB9b0, 0x4640, "r", 0, SIZE_NONE, 0, |
665 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
666 | 450d4ff5 | ths | |
667 | 450d4ff5 | ths | {"jsr", 0xB930, 0x42c0, "s", 0, SIZE_FIX_32, |
668 | 450d4ff5 | ths | cris_ver_v0_10, |
669 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
670 | 450d4ff5 | ths | |
671 | 450d4ff5 | ths | {"jsr", 0xBDBF, 0x4240, "N", 0, SIZE_FIX_32, |
672 | 450d4ff5 | ths | cris_ver_v32p, |
673 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
674 | 450d4ff5 | ths | |
675 | 450d4ff5 | ths | {"jsr", 0xB930, 0x42c0, "S", 0, SIZE_NONE, |
676 | 450d4ff5 | ths | cris_ver_v0_10, |
677 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
678 | 450d4ff5 | ths | |
679 | 450d4ff5 | ths | {"jsrc", 0x39b0, 0xc640, "r", 0, SIZE_NONE, |
680 | 450d4ff5 | ths | cris_ver_v8_10, |
681 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
682 | 450d4ff5 | ths | |
683 | 450d4ff5 | ths | {"jsrc", 0x3930, 0xc2c0, "s", 0, SIZE_FIX_32, |
684 | 450d4ff5 | ths | cris_ver_v8_10, |
685 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
686 | 450d4ff5 | ths | |
687 | 450d4ff5 | ths | {"jsrc", 0x3930, 0xc2c0, "S", 0, SIZE_NONE, |
688 | 450d4ff5 | ths | cris_ver_v8_10, |
689 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
690 | 450d4ff5 | ths | |
691 | 450d4ff5 | ths | {"jsrc", 0xBB30, 0x44C0, "r", 0, SIZE_NONE, |
692 | 450d4ff5 | ths | cris_ver_v32p, |
693 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
694 | 450d4ff5 | ths | |
695 | 450d4ff5 | ths | {"jsrc", 0xBF3F, 0x40C0, "N", 0, SIZE_FIX_32, |
696 | 450d4ff5 | ths | cris_ver_v32p, |
697 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
698 | 450d4ff5 | ths | |
699 | 450d4ff5 | ths | {"jump", 0x09b0, 0xF640, "r", 0, SIZE_NONE, 0, |
700 | 450d4ff5 | ths | cris_reg_mode_jump_op}, |
701 | 450d4ff5 | ths | |
702 | 450d4ff5 | ths | {"jump",
|
703 | 450d4ff5 | ths | JUMP_INDIR_OPCODE, JUMP_INDIR_Z_BITS, "s", 0, SIZE_FIX_32, |
704 | 450d4ff5 | ths | cris_ver_v0_10, |
705 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
706 | 450d4ff5 | ths | |
707 | 450d4ff5 | ths | {"jump",
|
708 | 450d4ff5 | ths | JUMP_INDIR_OPCODE, JUMP_INDIR_Z_BITS, "S", 0, SIZE_NONE, |
709 | 450d4ff5 | ths | cris_ver_v0_10, |
710 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
711 | 450d4ff5 | ths | |
712 | 450d4ff5 | ths | {"jump", 0x09F0, 0x060F, "P", 0, SIZE_NONE, |
713 | 450d4ff5 | ths | cris_ver_v32p, |
714 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
715 | 450d4ff5 | ths | |
716 | 450d4ff5 | ths | {"jump",
|
717 | 450d4ff5 | ths | JUMP_PC_INCR_OPCODE_V32, |
718 | 450d4ff5 | ths | (0xffff & ~JUMP_PC_INCR_OPCODE_V32), "N", 0, SIZE_FIX_32, |
719 | 450d4ff5 | ths | cris_ver_v32p, |
720 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
721 | 450d4ff5 | ths | |
722 | 450d4ff5 | ths | {"jmpu", 0x8930, 0x72c0, "s", 0, SIZE_FIX_32, |
723 | 450d4ff5 | ths | cris_ver_v10, |
724 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
725 | 450d4ff5 | ths | |
726 | 450d4ff5 | ths | {"jmpu", 0x8930, 0x72c0, "S", 0, SIZE_NONE, |
727 | 450d4ff5 | ths | cris_ver_v10, |
728 | 450d4ff5 | ths | cris_none_reg_mode_jump_op}, |
729 | 450d4ff5 | ths | |
730 | 450d4ff5 | ths | {"lapc", 0x0970, 0x0680, "U,R", 0, SIZE_NONE, |
731 | 450d4ff5 | ths | cris_ver_v32p, |
732 | 450d4ff5 | ths | cris_not_implemented_op}, |
733 | 450d4ff5 | ths | |
734 | 450d4ff5 | ths | {"lapc", 0x0D7F, 0x0280, "dn,R", 0, SIZE_FIX_32, |
735 | 450d4ff5 | ths | cris_ver_v32p, |
736 | 450d4ff5 | ths | cris_not_implemented_op}, |
737 | 450d4ff5 | ths | |
738 | 450d4ff5 | ths | {"lapcq", 0x0970, 0x0680, "u,R", 0, SIZE_NONE, |
739 | 450d4ff5 | ths | cris_ver_v32p, |
740 | 450d4ff5 | ths | cris_addi_op}, |
741 | 450d4ff5 | ths | |
742 | 450d4ff5 | ths | {"lsl", 0x04C0, 0x0B00, "m r,R", 0, SIZE_NONE, 0, |
743 | 450d4ff5 | ths | cris_dstep_logshift_mstep_neg_not_op}, |
744 | 450d4ff5 | ths | |
745 | 450d4ff5 | ths | {"lslq", 0x03c0, 0x0C20, "c,R", 0, SIZE_NONE, 0, |
746 | 450d4ff5 | ths | cris_dstep_logshift_mstep_neg_not_op}, |
747 | 450d4ff5 | ths | |
748 | 450d4ff5 | ths | {"lsr", 0x07C0, 0x0800, "m r,R", 0, SIZE_NONE, 0, |
749 | 450d4ff5 | ths | cris_dstep_logshift_mstep_neg_not_op}, |
750 | 450d4ff5 | ths | |
751 | 450d4ff5 | ths | {"lsrq", 0x03e0, 0x0C00, "c,R", 0, SIZE_NONE, 0, |
752 | 450d4ff5 | ths | cris_dstep_logshift_mstep_neg_not_op}, |
753 | 450d4ff5 | ths | |
754 | 450d4ff5 | ths | {"lz", 0x0730, 0x08C0, "r,R", 0, SIZE_NONE, |
755 | 450d4ff5 | ths | cris_ver_v3p, |
756 | 450d4ff5 | ths | cris_not_implemented_op}, |
757 | 450d4ff5 | ths | |
758 | 450d4ff5 | ths | {"mcp", 0x07f0, 0x0800, "P,r", 0, SIZE_NONE, |
759 | 450d4ff5 | ths | cris_ver_v32p, |
760 | 450d4ff5 | ths | cris_not_implemented_op}, |
761 | 450d4ff5 | ths | |
762 | 450d4ff5 | ths | {"move", 0x0640, 0x0980, "m r,R", 0, SIZE_NONE, 0, |
763 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
764 | 450d4ff5 | ths | |
765 | 450d4ff5 | ths | {"move", 0x0A40, 0x0180, "m s,R", 0, SIZE_FIELD, 0, |
766 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
767 | 450d4ff5 | ths | |
768 | 450d4ff5 | ths | {"move", 0x0A40, 0x0180, "m S,D", 0, SIZE_NONE, |
769 | 450d4ff5 | ths | cris_ver_v0_10, |
770 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
771 | 450d4ff5 | ths | |
772 | 450d4ff5 | ths | {"move", 0x0630, 0x09c0, "r,P", 0, SIZE_NONE, 0, |
773 | 450d4ff5 | ths | cris_move_to_preg_op}, |
774 | 450d4ff5 | ths | |
775 | 450d4ff5 | ths | {"move", 0x0670, 0x0980, "P,r", 0, SIZE_NONE, 0, |
776 | 450d4ff5 | ths | cris_reg_mode_move_from_preg_op}, |
777 | 450d4ff5 | ths | |
778 | 450d4ff5 | ths | {"move", 0x0BC0, 0x0000, "m R,y", 0, SIZE_FIELD, 0, |
779 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
780 | 450d4ff5 | ths | |
781 | 450d4ff5 | ths | {"move", 0x0BC0, 0x0000, "m D,S", 0, SIZE_NONE, |
782 | 450d4ff5 | ths | cris_ver_v0_10, |
783 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
784 | 450d4ff5 | ths | |
785 | 450d4ff5 | ths | {"move",
|
786 | 450d4ff5 | ths | MOVE_M_TO_PREG_OPCODE, MOVE_M_TO_PREG_ZBITS, |
787 | 450d4ff5 | ths | "s,P", 0, SIZE_SPEC_REG, 0, |
788 | 450d4ff5 | ths | cris_move_to_preg_op}, |
789 | 450d4ff5 | ths | |
790 | 450d4ff5 | ths | {"move", 0x0A30, 0x01c0, "S,P", 0, SIZE_NONE, |
791 | 450d4ff5 | ths | cris_ver_v0_10, |
792 | 450d4ff5 | ths | cris_move_to_preg_op}, |
793 | 450d4ff5 | ths | |
794 | 450d4ff5 | ths | {"move", 0x0A70, 0x0180, "P,y", 0, SIZE_SPEC_REG, 0, |
795 | 450d4ff5 | ths | cris_none_reg_mode_move_from_preg_op}, |
796 | 450d4ff5 | ths | |
797 | 450d4ff5 | ths | {"move", 0x0A70, 0x0180, "P,S", 0, SIZE_NONE, |
798 | 450d4ff5 | ths | cris_ver_v0_10, |
799 | 450d4ff5 | ths | cris_none_reg_mode_move_from_preg_op}, |
800 | 450d4ff5 | ths | |
801 | 450d4ff5 | ths | {"move", 0x0B70, 0x0480, "r,T", 0, SIZE_NONE, |
802 | 450d4ff5 | ths | cris_ver_v32p, |
803 | 450d4ff5 | ths | cris_not_implemented_op}, |
804 | 450d4ff5 | ths | |
805 | 450d4ff5 | ths | {"move", 0x0F70, 0x0080, "T,r", 0, SIZE_NONE, |
806 | 450d4ff5 | ths | cris_ver_v32p, |
807 | 450d4ff5 | ths | cris_not_implemented_op}, |
808 | 450d4ff5 | ths | |
809 | 450d4ff5 | ths | {"movem", 0x0BF0, 0x0000, "R,y", 0, SIZE_FIX_32, 0, |
810 | 450d4ff5 | ths | cris_move_reg_to_mem_movem_op}, |
811 | 450d4ff5 | ths | |
812 | 450d4ff5 | ths | {"movem", 0x0BF0, 0x0000, "D,S", 0, SIZE_NONE, |
813 | 450d4ff5 | ths | cris_ver_v0_10, |
814 | 450d4ff5 | ths | cris_move_reg_to_mem_movem_op}, |
815 | 450d4ff5 | ths | |
816 | 450d4ff5 | ths | {"movem", 0x0BB0, 0x0040, "s,R", 0, SIZE_FIX_32, 0, |
817 | 450d4ff5 | ths | cris_move_mem_to_reg_movem_op}, |
818 | 450d4ff5 | ths | |
819 | 450d4ff5 | ths | {"movem", 0x0BB0, 0x0040, "S,D", 0, SIZE_NONE, |
820 | 450d4ff5 | ths | cris_ver_v0_10, |
821 | 450d4ff5 | ths | cris_move_mem_to_reg_movem_op}, |
822 | 450d4ff5 | ths | |
823 | 450d4ff5 | ths | {"moveq", 0x0240, 0x0D80, "i,R", 0, SIZE_NONE, 0, |
824 | 450d4ff5 | ths | cris_quick_mode_and_cmp_move_or_op}, |
825 | 450d4ff5 | ths | |
826 | 450d4ff5 | ths | {"movs", 0x0460, 0x0B80, "z r,R", 0, SIZE_NONE, 0, |
827 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
828 | 450d4ff5 | ths | |
829 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_SIGNED and all necessary changes. */
|
830 | 450d4ff5 | ths | {"movs", 0x0860, 0x0380, "z s,R", 0, SIZE_FIELD, 0, |
831 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
832 | 450d4ff5 | ths | |
833 | 450d4ff5 | ths | {"movs", 0x0860, 0x0380, "z S,D", 0, SIZE_NONE, |
834 | 450d4ff5 | ths | cris_ver_v0_10, |
835 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
836 | 450d4ff5 | ths | |
837 | 450d4ff5 | ths | {"movu", 0x0440, 0x0Ba0, "z r,R", 0, SIZE_NONE, 0, |
838 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
839 | 450d4ff5 | ths | |
840 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
|
841 | 450d4ff5 | ths | {"movu", 0x0840, 0x03a0, "z s,R", 0, SIZE_FIELD, 0, |
842 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
843 | 450d4ff5 | ths | |
844 | 450d4ff5 | ths | {"movu", 0x0840, 0x03a0, "z S,D", 0, SIZE_NONE, |
845 | 450d4ff5 | ths | cris_ver_v0_10, |
846 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
847 | 450d4ff5 | ths | |
848 | 450d4ff5 | ths | {"mstep", 0x07f0, 0x0800, "r,R", 0, SIZE_NONE, |
849 | 450d4ff5 | ths | cris_ver_v0_10, |
850 | 450d4ff5 | ths | cris_dstep_logshift_mstep_neg_not_op}, |
851 | 450d4ff5 | ths | |
852 | 450d4ff5 | ths | {"muls", 0x0d00, 0x02c0, "m r,R", 0, SIZE_NONE, |
853 | 450d4ff5 | ths | cris_ver_v10p, |
854 | 450d4ff5 | ths | cris_muls_op}, |
855 | 450d4ff5 | ths | |
856 | 450d4ff5 | ths | {"mulu", 0x0900, 0x06c0, "m r,R", 0, SIZE_NONE, |
857 | 450d4ff5 | ths | cris_ver_v10p, |
858 | 450d4ff5 | ths | cris_mulu_op}, |
859 | 450d4ff5 | ths | |
860 | 450d4ff5 | ths | {"neg", 0x0580, 0x0A40, "m r,R", 0, SIZE_NONE, 0, |
861 | 450d4ff5 | ths | cris_dstep_logshift_mstep_neg_not_op}, |
862 | 450d4ff5 | ths | |
863 | 450d4ff5 | ths | {"nop", NOP_OPCODE, NOP_Z_BITS, "", 0, SIZE_NONE, |
864 | 450d4ff5 | ths | cris_ver_v0_10, |
865 | 450d4ff5 | ths | cris_btst_nop_op}, |
866 | 450d4ff5 | ths | |
867 | 450d4ff5 | ths | {"nop", NOP_OPCODE_V32, NOP_Z_BITS_V32, "", 0, SIZE_NONE, |
868 | 450d4ff5 | ths | cris_ver_v32p, |
869 | 450d4ff5 | ths | cris_btst_nop_op}, |
870 | 450d4ff5 | ths | |
871 | 450d4ff5 | ths | {"not", 0x8770, 0x7880, "r", 0, SIZE_NONE, 0, |
872 | 450d4ff5 | ths | cris_dstep_logshift_mstep_neg_not_op}, |
873 | 450d4ff5 | ths | |
874 | 450d4ff5 | ths | {"or", 0x0740, 0x0880, "m r,R", 0, SIZE_NONE, 0, |
875 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
876 | 450d4ff5 | ths | |
877 | 450d4ff5 | ths | {"or", 0x0B40, 0x0080, "m s,R", 0, SIZE_FIELD, 0, |
878 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
879 | 450d4ff5 | ths | |
880 | 450d4ff5 | ths | {"or", 0x0B40, 0x0080, "m S,D", 0, SIZE_NONE, |
881 | 450d4ff5 | ths | cris_ver_v0_10, |
882 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
883 | 450d4ff5 | ths | |
884 | 450d4ff5 | ths | {"or", 0x0B40, 0x0480, "m S,R,r", 0, SIZE_NONE, |
885 | 450d4ff5 | ths | cris_ver_v0_10, |
886 | 450d4ff5 | ths | cris_three_operand_add_sub_cmp_and_or_op}, |
887 | 450d4ff5 | ths | |
888 | 450d4ff5 | ths | {"orq", 0x0340, 0x0C80, "i,R", 0, SIZE_NONE, 0, |
889 | 450d4ff5 | ths | cris_quick_mode_and_cmp_move_or_op}, |
890 | 450d4ff5 | ths | |
891 | 450d4ff5 | ths | {"pop", 0x0E6E, 0x0191, "!R", 0, SIZE_NONE, |
892 | 450d4ff5 | ths | cris_ver_v0_10, |
893 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
894 | 450d4ff5 | ths | |
895 | 450d4ff5 | ths | {"pop", 0x0e3e, 0x01c1, "!P", 0, SIZE_NONE, |
896 | 450d4ff5 | ths | cris_ver_v0_10, |
897 | 450d4ff5 | ths | cris_none_reg_mode_move_from_preg_op}, |
898 | 450d4ff5 | ths | |
899 | 450d4ff5 | ths | {"push", 0x0FEE, 0x0011, "BR", 0, SIZE_NONE, |
900 | 450d4ff5 | ths | cris_ver_v0_10, |
901 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
902 | 450d4ff5 | ths | |
903 | 450d4ff5 | ths | {"push", 0x0E7E, 0x0181, "BP", 0, SIZE_NONE, |
904 | 450d4ff5 | ths | cris_ver_v0_10, |
905 | 450d4ff5 | ths | cris_move_to_preg_op}, |
906 | 450d4ff5 | ths | |
907 | 450d4ff5 | ths | {"rbf", 0x3b30, 0xc0c0, "y", 0, SIZE_NONE, |
908 | 450d4ff5 | ths | cris_ver_v10, |
909 | 450d4ff5 | ths | cris_not_implemented_op}, |
910 | 450d4ff5 | ths | |
911 | 450d4ff5 | ths | {"rbf", 0x3b30, 0xc0c0, "S", 0, SIZE_NONE, |
912 | 450d4ff5 | ths | cris_ver_v10, |
913 | 450d4ff5 | ths | cris_not_implemented_op}, |
914 | 450d4ff5 | ths | |
915 | 450d4ff5 | ths | {"rfe", 0x2930, 0xD6CF, "", 0, SIZE_NONE, |
916 | 450d4ff5 | ths | cris_ver_v32p, |
917 | 450d4ff5 | ths | cris_not_implemented_op}, |
918 | 450d4ff5 | ths | |
919 | 450d4ff5 | ths | {"rfg", 0x4930, 0xB6CF, "", 0, SIZE_NONE, |
920 | 450d4ff5 | ths | cris_ver_v32p, |
921 | 450d4ff5 | ths | cris_not_implemented_op}, |
922 | 450d4ff5 | ths | |
923 | 450d4ff5 | ths | {"rfn", 0x5930, 0xA6CF, "", 0, SIZE_NONE, |
924 | 450d4ff5 | ths | cris_ver_v32p, |
925 | 450d4ff5 | ths | cris_not_implemented_op}, |
926 | 450d4ff5 | ths | |
927 | 450d4ff5 | ths | {"ret", 0xB67F, 0x4980, "", 1, SIZE_NONE, |
928 | 450d4ff5 | ths | cris_ver_v0_10, |
929 | 450d4ff5 | ths | cris_reg_mode_move_from_preg_op}, |
930 | 450d4ff5 | ths | |
931 | 450d4ff5 | ths | {"ret", 0xB9F0, 0x460F, "", 1, SIZE_NONE, |
932 | 450d4ff5 | ths | cris_ver_v32p, |
933 | 450d4ff5 | ths | cris_reg_mode_move_from_preg_op}, |
934 | 450d4ff5 | ths | |
935 | 450d4ff5 | ths | {"retb", 0xe67f, 0x1980, "", 1, SIZE_NONE, |
936 | 450d4ff5 | ths | cris_ver_v0_10, |
937 | 450d4ff5 | ths | cris_reg_mode_move_from_preg_op}, |
938 | 450d4ff5 | ths | |
939 | 450d4ff5 | ths | {"rete", 0xA9F0, 0x560F, "", 1, SIZE_NONE, |
940 | 450d4ff5 | ths | cris_ver_v32p, |
941 | 450d4ff5 | ths | cris_reg_mode_move_from_preg_op}, |
942 | 450d4ff5 | ths | |
943 | 450d4ff5 | ths | {"reti", 0xA67F, 0x5980, "", 1, SIZE_NONE, |
944 | 450d4ff5 | ths | cris_ver_v0_10, |
945 | 450d4ff5 | ths | cris_reg_mode_move_from_preg_op}, |
946 | 450d4ff5 | ths | |
947 | 450d4ff5 | ths | {"retn", 0xC9F0, 0x360F, "", 1, SIZE_NONE, |
948 | 450d4ff5 | ths | cris_ver_v32p, |
949 | 450d4ff5 | ths | cris_reg_mode_move_from_preg_op}, |
950 | 450d4ff5 | ths | |
951 | 450d4ff5 | ths | {"sbfs", 0x3b70, 0xc080, "y", 0, SIZE_NONE, |
952 | 450d4ff5 | ths | cris_ver_v10, |
953 | 450d4ff5 | ths | cris_not_implemented_op}, |
954 | 450d4ff5 | ths | |
955 | 450d4ff5 | ths | {"sbfs", 0x3b70, 0xc080, "S", 0, SIZE_NONE, |
956 | 450d4ff5 | ths | cris_ver_v10, |
957 | 450d4ff5 | ths | cris_not_implemented_op}, |
958 | 450d4ff5 | ths | |
959 | 450d4ff5 | ths | {"sa",
|
960 | 450d4ff5 | ths | 0x0530+CC_A*0x1000, |
961 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_A)*0x1000, "r", 0, SIZE_NONE, 0, |
962 | 450d4ff5 | ths | cris_scc_op}, |
963 | 450d4ff5 | ths | |
964 | 450d4ff5 | ths | {"ssb",
|
965 | 450d4ff5 | ths | 0x0530+CC_EXT*0x1000, |
966 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_EXT)*0x1000, "r", 0, SIZE_NONE, |
967 | 450d4ff5 | ths | cris_ver_v32p, |
968 | 450d4ff5 | ths | cris_scc_op}, |
969 | 450d4ff5 | ths | |
970 | 450d4ff5 | ths | {"scc",
|
971 | 450d4ff5 | ths | 0x0530+CC_CC*0x1000, |
972 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_CC)*0x1000, "r", 0, SIZE_NONE, 0, |
973 | 450d4ff5 | ths | cris_scc_op}, |
974 | 450d4ff5 | ths | |
975 | 450d4ff5 | ths | {"scs",
|
976 | 450d4ff5 | ths | 0x0530+CC_CS*0x1000, |
977 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_CS)*0x1000, "r", 0, SIZE_NONE, 0, |
978 | 450d4ff5 | ths | cris_scc_op}, |
979 | 450d4ff5 | ths | |
980 | 450d4ff5 | ths | {"seq",
|
981 | 450d4ff5 | ths | 0x0530+CC_EQ*0x1000, |
982 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_EQ)*0x1000, "r", 0, SIZE_NONE, 0, |
983 | 450d4ff5 | ths | cris_scc_op}, |
984 | 450d4ff5 | ths | |
985 | 450d4ff5 | ths | {"setf", 0x05b0, 0x0A40, "f", 0, SIZE_NONE, 0, |
986 | 450d4ff5 | ths | cris_ax_ei_setf_op}, |
987 | 450d4ff5 | ths | |
988 | 450d4ff5 | ths | {"sfe", 0x3930, 0xC6CF, "", 0, SIZE_NONE, |
989 | 450d4ff5 | ths | cris_ver_v32p, |
990 | 450d4ff5 | ths | cris_not_implemented_op}, |
991 | 450d4ff5 | ths | |
992 | 450d4ff5 | ths | /* Need to have "swf" in front of "sext" so it is the one displayed in
|
993 | 450d4ff5 | ths | disassembly. */
|
994 | 450d4ff5 | ths | {"swf",
|
995 | 450d4ff5 | ths | 0x0530+CC_EXT*0x1000, |
996 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_EXT)*0x1000, "r", 0, SIZE_NONE, |
997 | 450d4ff5 | ths | cris_ver_v10, |
998 | 450d4ff5 | ths | cris_scc_op}, |
999 | 450d4ff5 | ths | |
1000 | 450d4ff5 | ths | {"sext",
|
1001 | 450d4ff5 | ths | 0x0530+CC_EXT*0x1000, |
1002 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_EXT)*0x1000, "r", 0, SIZE_NONE, |
1003 | 450d4ff5 | ths | cris_ver_v0_3, |
1004 | 450d4ff5 | ths | cris_scc_op}, |
1005 | 450d4ff5 | ths | |
1006 | 450d4ff5 | ths | {"sge",
|
1007 | 450d4ff5 | ths | 0x0530+CC_GE*0x1000, |
1008 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_GE)*0x1000, "r", 0, SIZE_NONE, 0, |
1009 | 450d4ff5 | ths | cris_scc_op}, |
1010 | 450d4ff5 | ths | |
1011 | 450d4ff5 | ths | {"sgt",
|
1012 | 450d4ff5 | ths | 0x0530+CC_GT*0x1000, |
1013 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_GT)*0x1000, "r", 0, SIZE_NONE, 0, |
1014 | 450d4ff5 | ths | cris_scc_op}, |
1015 | 450d4ff5 | ths | |
1016 | 450d4ff5 | ths | {"shi",
|
1017 | 450d4ff5 | ths | 0x0530+CC_HI*0x1000, |
1018 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_HI)*0x1000, "r", 0, SIZE_NONE, 0, |
1019 | 450d4ff5 | ths | cris_scc_op}, |
1020 | 450d4ff5 | ths | |
1021 | 450d4ff5 | ths | {"shs",
|
1022 | 450d4ff5 | ths | 0x0530+CC_HS*0x1000, |
1023 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_HS)*0x1000, "r", 0, SIZE_NONE, 0, |
1024 | 450d4ff5 | ths | cris_scc_op}, |
1025 | 450d4ff5 | ths | |
1026 | 450d4ff5 | ths | {"sle",
|
1027 | 450d4ff5 | ths | 0x0530+CC_LE*0x1000, |
1028 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_LE)*0x1000, "r", 0, SIZE_NONE, 0, |
1029 | 450d4ff5 | ths | cris_scc_op}, |
1030 | 450d4ff5 | ths | |
1031 | 450d4ff5 | ths | {"slo",
|
1032 | 450d4ff5 | ths | 0x0530+CC_LO*0x1000, |
1033 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_LO)*0x1000, "r", 0, SIZE_NONE, 0, |
1034 | 450d4ff5 | ths | cris_scc_op}, |
1035 | 450d4ff5 | ths | |
1036 | 450d4ff5 | ths | {"sls",
|
1037 | 450d4ff5 | ths | 0x0530+CC_LS*0x1000, |
1038 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_LS)*0x1000, "r", 0, SIZE_NONE, 0, |
1039 | 450d4ff5 | ths | cris_scc_op}, |
1040 | 450d4ff5 | ths | |
1041 | 450d4ff5 | ths | {"slt",
|
1042 | 450d4ff5 | ths | 0x0530+CC_LT*0x1000, |
1043 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_LT)*0x1000, "r", 0, SIZE_NONE, 0, |
1044 | 450d4ff5 | ths | cris_scc_op}, |
1045 | 450d4ff5 | ths | |
1046 | 450d4ff5 | ths | {"smi",
|
1047 | 450d4ff5 | ths | 0x0530+CC_MI*0x1000, |
1048 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_MI)*0x1000, "r", 0, SIZE_NONE, 0, |
1049 | 450d4ff5 | ths | cris_scc_op}, |
1050 | 450d4ff5 | ths | |
1051 | 450d4ff5 | ths | {"sne",
|
1052 | 450d4ff5 | ths | 0x0530+CC_NE*0x1000, |
1053 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_NE)*0x1000, "r", 0, SIZE_NONE, 0, |
1054 | 450d4ff5 | ths | cris_scc_op}, |
1055 | 450d4ff5 | ths | |
1056 | 450d4ff5 | ths | {"spl",
|
1057 | 450d4ff5 | ths | 0x0530+CC_PL*0x1000, |
1058 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_PL)*0x1000, "r", 0, SIZE_NONE, 0, |
1059 | 450d4ff5 | ths | cris_scc_op}, |
1060 | 450d4ff5 | ths | |
1061 | 450d4ff5 | ths | {"sub", 0x0680, 0x0940, "m r,R", 0, SIZE_NONE, 0, |
1062 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
1063 | 450d4ff5 | ths | |
1064 | 450d4ff5 | ths | {"sub", 0x0a80, 0x0140, "m s,R", 0, SIZE_FIELD, 0, |
1065 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
1066 | 450d4ff5 | ths | |
1067 | 450d4ff5 | ths | {"sub", 0x0a80, 0x0140, "m S,D", 0, SIZE_NONE, |
1068 | 450d4ff5 | ths | cris_ver_v0_10, |
1069 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
1070 | 450d4ff5 | ths | |
1071 | 450d4ff5 | ths | {"sub", 0x0a80, 0x0540, "m S,R,r", 0, SIZE_NONE, |
1072 | 450d4ff5 | ths | cris_ver_v0_10, |
1073 | 450d4ff5 | ths | cris_three_operand_add_sub_cmp_and_or_op}, |
1074 | 450d4ff5 | ths | |
1075 | 450d4ff5 | ths | {"subq", 0x0280, 0x0d40, "I,R", 0, SIZE_NONE, 0, |
1076 | 450d4ff5 | ths | cris_quick_mode_add_sub_op}, |
1077 | 450d4ff5 | ths | |
1078 | 450d4ff5 | ths | {"subs", 0x04a0, 0x0b40, "z r,R", 0, SIZE_NONE, 0, |
1079 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
1080 | 450d4ff5 | ths | |
1081 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_SIGNED and all necessary changes. */
|
1082 | 450d4ff5 | ths | {"subs", 0x08a0, 0x0340, "z s,R", 0, SIZE_FIELD, 0, |
1083 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
1084 | 450d4ff5 | ths | |
1085 | 450d4ff5 | ths | {"subs", 0x08a0, 0x0340, "z S,D", 0, SIZE_NONE, |
1086 | 450d4ff5 | ths | cris_ver_v0_10, |
1087 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
1088 | 450d4ff5 | ths | |
1089 | 450d4ff5 | ths | {"subs", 0x08a0, 0x0740, "z S,R,r", 0, SIZE_NONE, |
1090 | 450d4ff5 | ths | cris_ver_v0_10, |
1091 | 450d4ff5 | ths | cris_three_operand_add_sub_cmp_and_or_op}, |
1092 | 450d4ff5 | ths | |
1093 | 450d4ff5 | ths | {"subu", 0x0480, 0x0b60, "z r,R", 0, SIZE_NONE, 0, |
1094 | 450d4ff5 | ths | cris_reg_mode_add_sub_cmp_and_or_move_op}, |
1095 | 450d4ff5 | ths | |
1096 | 450d4ff5 | ths | /* FIXME: SIZE_FIELD_UNSIGNED and all necessary changes. */
|
1097 | 450d4ff5 | ths | {"subu", 0x0880, 0x0360, "z s,R", 0, SIZE_FIELD, 0, |
1098 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
1099 | 450d4ff5 | ths | |
1100 | 450d4ff5 | ths | {"subu", 0x0880, 0x0360, "z S,D", 0, SIZE_NONE, |
1101 | 450d4ff5 | ths | cris_ver_v0_10, |
1102 | 450d4ff5 | ths | cris_none_reg_mode_add_sub_cmp_and_or_move_op}, |
1103 | 450d4ff5 | ths | |
1104 | 450d4ff5 | ths | {"subu", 0x0880, 0x0760, "z S,R,r", 0, SIZE_NONE, |
1105 | 450d4ff5 | ths | cris_ver_v0_10, |
1106 | 450d4ff5 | ths | cris_three_operand_add_sub_cmp_and_or_op}, |
1107 | 450d4ff5 | ths | |
1108 | 450d4ff5 | ths | {"svc",
|
1109 | 450d4ff5 | ths | 0x0530+CC_VC*0x1000, |
1110 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_VC)*0x1000, "r", 0, SIZE_NONE, 0, |
1111 | 450d4ff5 | ths | cris_scc_op}, |
1112 | 450d4ff5 | ths | |
1113 | 450d4ff5 | ths | {"svs",
|
1114 | 450d4ff5 | ths | 0x0530+CC_VS*0x1000, |
1115 | 450d4ff5 | ths | 0x0AC0+(0xf-CC_VS)*0x1000, "r", 0, SIZE_NONE, 0, |
1116 | 450d4ff5 | ths | cris_scc_op}, |
1117 | 450d4ff5 | ths | |
1118 | 450d4ff5 | ths | /* The insn "swapn" is the same as "not" and will be disassembled as
|
1119 | 450d4ff5 | ths | such, but the swap* family of mnmonics are generally v8-and-higher
|
1120 | 450d4ff5 | ths | only, so count it in. */
|
1121 | 450d4ff5 | ths | {"swapn", 0x8770, 0x7880, "r", 0, SIZE_NONE, |
1122 | 450d4ff5 | ths | cris_ver_v8p, |
1123 | 450d4ff5 | ths | cris_not_implemented_op}, |
1124 | 450d4ff5 | ths | |
1125 | 450d4ff5 | ths | {"swapw", 0x4770, 0xb880, "r", 0, SIZE_NONE, |
1126 | 450d4ff5 | ths | cris_ver_v8p, |
1127 | 450d4ff5 | ths | cris_not_implemented_op}, |
1128 | 450d4ff5 | ths | |
1129 | 450d4ff5 | ths | {"swapnw", 0xc770, 0x3880, "r", 0, SIZE_NONE, |
1130 | 450d4ff5 | ths | cris_ver_v8p, |
1131 | 450d4ff5 | ths | cris_not_implemented_op}, |
1132 | 450d4ff5 | ths | |
1133 | 450d4ff5 | ths | {"swapb", 0x2770, 0xd880, "r", 0, SIZE_NONE, |
1134 | 450d4ff5 | ths | cris_ver_v8p, |
1135 | 450d4ff5 | ths | cris_not_implemented_op}, |
1136 | 450d4ff5 | ths | |
1137 | 450d4ff5 | ths | {"swapnb", 0xA770, 0x5880, "r", 0, SIZE_NONE, |
1138 | 450d4ff5 | ths | cris_ver_v8p, |
1139 | 450d4ff5 | ths | cris_not_implemented_op}, |
1140 | 450d4ff5 | ths | |
1141 | 450d4ff5 | ths | {"swapwb", 0x6770, 0x9880, "r", 0, SIZE_NONE, |
1142 | 450d4ff5 | ths | cris_ver_v8p, |
1143 | 450d4ff5 | ths | cris_not_implemented_op}, |
1144 | 450d4ff5 | ths | |
1145 | 450d4ff5 | ths | {"swapnwb", 0xE770, 0x1880, "r", 0, SIZE_NONE, |
1146 | 450d4ff5 | ths | cris_ver_v8p, |
1147 | 450d4ff5 | ths | cris_not_implemented_op}, |
1148 | 450d4ff5 | ths | |
1149 | 450d4ff5 | ths | {"swapr", 0x1770, 0xe880, "r", 0, SIZE_NONE, |
1150 | 450d4ff5 | ths | cris_ver_v8p, |
1151 | 450d4ff5 | ths | cris_not_implemented_op}, |
1152 | 450d4ff5 | ths | |
1153 | 450d4ff5 | ths | {"swapnr", 0x9770, 0x6880, "r", 0, SIZE_NONE, |
1154 | 450d4ff5 | ths | cris_ver_v8p, |
1155 | 450d4ff5 | ths | cris_not_implemented_op}, |
1156 | 450d4ff5 | ths | |
1157 | 450d4ff5 | ths | {"swapwr", 0x5770, 0xa880, "r", 0, SIZE_NONE, |
1158 | 450d4ff5 | ths | cris_ver_v8p, |
1159 | 450d4ff5 | ths | cris_not_implemented_op}, |
1160 | 450d4ff5 | ths | |
1161 | 450d4ff5 | ths | {"swapnwr", 0xd770, 0x2880, "r", 0, SIZE_NONE, |
1162 | 450d4ff5 | ths | cris_ver_v8p, |
1163 | 450d4ff5 | ths | cris_not_implemented_op}, |
1164 | 450d4ff5 | ths | |
1165 | 450d4ff5 | ths | {"swapbr", 0x3770, 0xc880, "r", 0, SIZE_NONE, |
1166 | 450d4ff5 | ths | cris_ver_v8p, |
1167 | 450d4ff5 | ths | cris_not_implemented_op}, |
1168 | 450d4ff5 | ths | |
1169 | 450d4ff5 | ths | {"swapnbr", 0xb770, 0x4880, "r", 0, SIZE_NONE, |
1170 | 450d4ff5 | ths | cris_ver_v8p, |
1171 | 450d4ff5 | ths | cris_not_implemented_op}, |
1172 | 450d4ff5 | ths | |
1173 | 450d4ff5 | ths | {"swapwbr", 0x7770, 0x8880, "r", 0, SIZE_NONE, |
1174 | 450d4ff5 | ths | cris_ver_v8p, |
1175 | 450d4ff5 | ths | cris_not_implemented_op}, |
1176 | 450d4ff5 | ths | |
1177 | 450d4ff5 | ths | {"swapnwbr", 0xf770, 0x0880, "r", 0, SIZE_NONE, |
1178 | 450d4ff5 | ths | cris_ver_v8p, |
1179 | 450d4ff5 | ths | cris_not_implemented_op}, |
1180 | 450d4ff5 | ths | |
1181 | 450d4ff5 | ths | {"test", 0x0640, 0x0980, "m D", 0, SIZE_NONE, |
1182 | 450d4ff5 | ths | cris_ver_v0_10, |
1183 | 450d4ff5 | ths | cris_reg_mode_test_op}, |
1184 | 450d4ff5 | ths | |
1185 | 450d4ff5 | ths | {"test", 0x0b80, 0xf040, "m y", 0, SIZE_FIELD, 0, |
1186 | 450d4ff5 | ths | cris_none_reg_mode_clear_test_op}, |
1187 | 450d4ff5 | ths | |
1188 | 450d4ff5 | ths | {"test", 0x0b80, 0xf040, "m S", 0, SIZE_NONE, |
1189 | 450d4ff5 | ths | cris_ver_v0_10, |
1190 | 450d4ff5 | ths | cris_none_reg_mode_clear_test_op}, |
1191 | 450d4ff5 | ths | |
1192 | 450d4ff5 | ths | {"xor", 0x07B0, 0x0840, "r,R", 0, SIZE_NONE, 0, |
1193 | 450d4ff5 | ths | cris_xor_op}, |
1194 | 450d4ff5 | ths | |
1195 | 450d4ff5 | ths | {NULL, 0, 0, NULL, 0, 0, 0, cris_not_implemented_op} |
1196 | 450d4ff5 | ths | }; |
1197 | 450d4ff5 | ths | |
1198 | 450d4ff5 | ths | /* Condition-names, indexed by the CC_* numbers as found in cris.h. */
|
1199 | 450d4ff5 | ths | const char * const |
1200 | 450d4ff5 | ths | cris_cc_strings[] = |
1201 | 450d4ff5 | ths | { |
1202 | 450d4ff5 | ths | "hs",
|
1203 | 450d4ff5 | ths | "lo",
|
1204 | 450d4ff5 | ths | "ne",
|
1205 | 450d4ff5 | ths | "eq",
|
1206 | 450d4ff5 | ths | "vc",
|
1207 | 450d4ff5 | ths | "vs",
|
1208 | 450d4ff5 | ths | "pl",
|
1209 | 450d4ff5 | ths | "mi",
|
1210 | 450d4ff5 | ths | "ls",
|
1211 | 450d4ff5 | ths | "hi",
|
1212 | 450d4ff5 | ths | "ge",
|
1213 | 450d4ff5 | ths | "lt",
|
1214 | 450d4ff5 | ths | "gt",
|
1215 | 450d4ff5 | ths | "le",
|
1216 | 450d4ff5 | ths | "a",
|
1217 | 450d4ff5 | ths | /* This is a placeholder. In v0, this would be "ext". In v32, this
|
1218 | 450d4ff5 | ths | is "sb". See cris_conds15. */
|
1219 | 450d4ff5 | ths | "wf"
|
1220 | 450d4ff5 | ths | }; |
1221 | 450d4ff5 | ths | |
1222 | 450d4ff5 | ths | /* Different names and semantics for condition 1111 (0xf). */
|
1223 | 450d4ff5 | ths | const struct cris_cond15 cris_cond15s[] = |
1224 | 450d4ff5 | ths | { |
1225 | 450d4ff5 | ths | /* FIXME: In what version did condition "ext" disappear? */
|
1226 | 450d4ff5 | ths | {"ext", cris_ver_v0_3},
|
1227 | 450d4ff5 | ths | {"wf", cris_ver_v10},
|
1228 | 450d4ff5 | ths | {"sb", cris_ver_v32p},
|
1229 | 450d4ff5 | ths | {NULL, 0} |
1230 | 450d4ff5 | ths | }; |
1231 | 450d4ff5 | ths | |
1232 | 450d4ff5 | ths | |
1233 | 450d4ff5 | ths | /*
|
1234 | 450d4ff5 | ths | * Local variables:
|
1235 | 450d4ff5 | ths | * eval: (c-set-style "gnu")
|
1236 | 450d4ff5 | ths | * indent-tabs-mode: t
|
1237 | 450d4ff5 | ths | * End:
|
1238 | 450d4ff5 | ths | */
|
1239 | 450d4ff5 | ths | |
1240 | 450d4ff5 | ths | |
1241 | 450d4ff5 | ths | /* No instruction will be disassembled longer than this. In theory, and
|
1242 | 450d4ff5 | ths | in silicon, address prefixes can be cascaded. In practice, cascading
|
1243 | 450d4ff5 | ths | is not used by GCC, and not supported by the assembler. */
|
1244 | 450d4ff5 | ths | #ifndef MAX_BYTES_PER_CRIS_INSN
|
1245 | 450d4ff5 | ths | #define MAX_BYTES_PER_CRIS_INSN 8 |
1246 | 450d4ff5 | ths | #endif
|
1247 | 450d4ff5 | ths | |
1248 | 450d4ff5 | ths | /* Whether or not to decode prefixes, folding it into the following
|
1249 | 450d4ff5 | ths | instruction. FIXME: Make this optional later. */
|
1250 | 450d4ff5 | ths | #ifndef PARSE_PREFIX
|
1251 | 450d4ff5 | ths | #define PARSE_PREFIX 1 |
1252 | 450d4ff5 | ths | #endif
|
1253 | 450d4ff5 | ths | |
1254 | 450d4ff5 | ths | /* Sometimes we prefix all registers with this character. */
|
1255 | 450d4ff5 | ths | #define REGISTER_PREFIX_CHAR '$' |
1256 | 450d4ff5 | ths | |
1257 | 450d4ff5 | ths | /* Whether or not to trace the following sequence:
|
1258 | 450d4ff5 | ths | sub* X,r%d
|
1259 | 450d4ff5 | ths | bound* Y,r%d
|
1260 | 450d4ff5 | ths | adds.w [pc+r%d.w],pc
|
1261 | 450d4ff5 | ths | |
1262 | 450d4ff5 | ths | This is the assembly form of a switch-statement in C.
|
1263 | 450d4ff5 | ths | The "sub is optional. If there is none, then X will be zero.
|
1264 | 450d4ff5 | ths | X is the value of the first case,
|
1265 | 450d4ff5 | ths | Y is the number of cases (including default).
|
1266 | 450d4ff5 | ths | |
1267 | 450d4ff5 | ths | This results in case offsets printed on the form:
|
1268 | 450d4ff5 | ths | case N: -> case_address
|
1269 | 450d4ff5 | ths | where N is an estimation on the corresponding 'case' operand in C,
|
1270 | 450d4ff5 | ths | and case_address is where execution of that case continues after the
|
1271 | 450d4ff5 | ths | sequence presented above.
|
1272 | 450d4ff5 | ths | |
1273 | 450d4ff5 | ths | The old style of output was to print the offsets as instructions,
|
1274 | 450d4ff5 | ths | which made it hard to follow "case"-constructs in the disassembly,
|
1275 | 450d4ff5 | ths | and caused a lot of annoying warnings about undefined instructions.
|
1276 | 450d4ff5 | ths | |
1277 | 450d4ff5 | ths | FIXME: Make this optional later. */
|
1278 | 450d4ff5 | ths | #ifndef TRACE_CASE
|
1279 | 450d4ff5 | ths | #define TRACE_CASE (disdata->trace_case)
|
1280 | 450d4ff5 | ths | #endif
|
1281 | 450d4ff5 | ths | |
1282 | 450d4ff5 | ths | enum cris_disass_family
|
1283 | 450d4ff5 | ths | { cris_dis_v0_v10, cris_dis_common_v10_v32, cris_dis_v32 }; |
1284 | 450d4ff5 | ths | |
1285 | 450d4ff5 | ths | /* Stored in the disasm_info->private_data member. */
|
1286 | 450d4ff5 | ths | struct cris_disasm_data
|
1287 | 450d4ff5 | ths | { |
1288 | 450d4ff5 | ths | /* Whether to print something less confusing if we find something
|
1289 | 450d4ff5 | ths | matching a switch-construct. */
|
1290 | 450d4ff5 | ths | bfd_boolean trace_case; |
1291 | 450d4ff5 | ths | |
1292 | 450d4ff5 | ths | /* Whether this code is flagged as crisv32. FIXME: Should be an enum
|
1293 | 450d4ff5 | ths | that includes "compatible". */
|
1294 | 450d4ff5 | ths | enum cris_disass_family distype;
|
1295 | 450d4ff5 | ths | }; |
1296 | 450d4ff5 | ths | |
1297 | 450d4ff5 | ths | /* Value of first element in switch. */
|
1298 | 450d4ff5 | ths | static long case_offset = 0; |
1299 | 450d4ff5 | ths | |
1300 | 450d4ff5 | ths | /* How many more case-offsets to print. */
|
1301 | 450d4ff5 | ths | static long case_offset_counter = 0; |
1302 | 450d4ff5 | ths | |
1303 | 450d4ff5 | ths | /* Number of case offsets. */
|
1304 | 450d4ff5 | ths | static long no_of_case_offsets = 0; |
1305 | 450d4ff5 | ths | |
1306 | 450d4ff5 | ths | /* Candidate for next case_offset. */
|
1307 | 450d4ff5 | ths | static long last_immediate = 0; |
1308 | 450d4ff5 | ths | |
1309 | 450d4ff5 | ths | static int cris_constraint |
1310 | 450d4ff5 | ths | (const char *, unsigned, unsigned, struct cris_disasm_data *); |
1311 | 450d4ff5 | ths | |
1312 | 450d4ff5 | ths | /* Parse disassembler options and store state in info. FIXME: For the
|
1313 | 450d4ff5 | ths | time being, we abuse static variables. */
|
1314 | 450d4ff5 | ths | |
1315 | 450d4ff5 | ths | static bfd_boolean
|
1316 | 450d4ff5 | ths | cris_parse_disassembler_options (disassemble_info *info, |
1317 | 450d4ff5 | ths | enum cris_disass_family distype)
|
1318 | 450d4ff5 | ths | { |
1319 | 450d4ff5 | ths | struct cris_disasm_data *disdata;
|
1320 | 450d4ff5 | ths | |
1321 | 450d4ff5 | ths | info->private_data = calloc (1, sizeof (struct cris_disasm_data)); |
1322 | 450d4ff5 | ths | disdata = (struct cris_disasm_data *) info->private_data;
|
1323 | 450d4ff5 | ths | if (disdata == NULL) |
1324 | 450d4ff5 | ths | return FALSE;
|
1325 | 450d4ff5 | ths | |
1326 | 450d4ff5 | ths | /* Default true. */
|
1327 | 450d4ff5 | ths | disdata->trace_case |
1328 | 450d4ff5 | ths | = (info->disassembler_options == NULL
|
1329 | 450d4ff5 | ths | || (strcmp (info->disassembler_options, "nocase") != 0)); |
1330 | 450d4ff5 | ths | |
1331 | 450d4ff5 | ths | disdata->distype = distype; |
1332 | 450d4ff5 | ths | return TRUE;
|
1333 | 450d4ff5 | ths | } |
1334 | 450d4ff5 | ths | |
1335 | 450d4ff5 | ths | static const struct cris_spec_reg * |
1336 | 450d4ff5 | ths | spec_reg_info (unsigned int sreg, enum cris_disass_family distype) |
1337 | 450d4ff5 | ths | { |
1338 | 450d4ff5 | ths | int i;
|
1339 | 450d4ff5 | ths | |
1340 | 450d4ff5 | ths | for (i = 0; cris_spec_regs[i].name != NULL; i++) |
1341 | 450d4ff5 | ths | { |
1342 | 450d4ff5 | ths | if (cris_spec_regs[i].number == sreg)
|
1343 | 450d4ff5 | ths | { |
1344 | 450d4ff5 | ths | if (distype == cris_dis_v32)
|
1345 | 450d4ff5 | ths | switch (cris_spec_regs[i].applicable_version)
|
1346 | 450d4ff5 | ths | { |
1347 | 450d4ff5 | ths | case cris_ver_warning:
|
1348 | 450d4ff5 | ths | case cris_ver_version_all:
|
1349 | 450d4ff5 | ths | case cris_ver_v3p:
|
1350 | 450d4ff5 | ths | case cris_ver_v8p:
|
1351 | 450d4ff5 | ths | case cris_ver_v10p:
|
1352 | 450d4ff5 | ths | case cris_ver_v32p:
|
1353 | 450d4ff5 | ths | /* No ambiguous sizes or register names with CRISv32. */
|
1354 | 450d4ff5 | ths | if (cris_spec_regs[i].warning == NULL) |
1355 | 450d4ff5 | ths | return &cris_spec_regs[i];
|
1356 | 450d4ff5 | ths | default:
|
1357 | 450d4ff5 | ths | ; |
1358 | 450d4ff5 | ths | } |
1359 | 450d4ff5 | ths | else if (cris_spec_regs[i].applicable_version != cris_ver_v32p) |
1360 | 450d4ff5 | ths | return &cris_spec_regs[i];
|
1361 | 450d4ff5 | ths | } |
1362 | 450d4ff5 | ths | } |
1363 | 450d4ff5 | ths | |
1364 | 450d4ff5 | ths | return NULL; |
1365 | 450d4ff5 | ths | } |
1366 | 450d4ff5 | ths | |
1367 | 450d4ff5 | ths | /* Return the number of bits in the argument. */
|
1368 | 450d4ff5 | ths | |
1369 | 450d4ff5 | ths | static int |
1370 | 450d4ff5 | ths | number_of_bits (unsigned int val) |
1371 | 450d4ff5 | ths | { |
1372 | 450d4ff5 | ths | int bits;
|
1373 | 450d4ff5 | ths | |
1374 | 450d4ff5 | ths | for (bits = 0; val != 0; val &= val - 1) |
1375 | 450d4ff5 | ths | bits++; |
1376 | 450d4ff5 | ths | |
1377 | 450d4ff5 | ths | return bits;
|
1378 | 450d4ff5 | ths | } |
1379 | 450d4ff5 | ths | |
1380 | 450d4ff5 | ths | /* Get an entry in the opcode-table. */
|
1381 | 450d4ff5 | ths | |
1382 | 450d4ff5 | ths | static const struct cris_opcode * |
1383 | 450d4ff5 | ths | get_opcode_entry (unsigned int insn, |
1384 | 450d4ff5 | ths | unsigned int prefix_insn, |
1385 | 450d4ff5 | ths | struct cris_disasm_data *disdata)
|
1386 | 450d4ff5 | ths | { |
1387 | 450d4ff5 | ths | /* For non-prefixed insns, we keep a table of pointers, indexed by the
|
1388 | 450d4ff5 | ths | insn code. Each entry is initialized when found to be NULL. */
|
1389 | 450d4ff5 | ths | static const struct cris_opcode **opc_table = NULL; |
1390 | 450d4ff5 | ths | |
1391 | 450d4ff5 | ths | const struct cris_opcode *max_matchedp = NULL; |
1392 | 450d4ff5 | ths | const struct cris_opcode **prefix_opc_table = NULL; |
1393 | 450d4ff5 | ths | |
1394 | 450d4ff5 | ths | /* We hold a table for each prefix that need to be handled differently. */
|
1395 | 450d4ff5 | ths | static const struct cris_opcode **dip_prefixes = NULL; |
1396 | 450d4ff5 | ths | static const struct cris_opcode **bdapq_m1_prefixes = NULL; |
1397 | 450d4ff5 | ths | static const struct cris_opcode **bdapq_m2_prefixes = NULL; |
1398 | 450d4ff5 | ths | static const struct cris_opcode **bdapq_m4_prefixes = NULL; |
1399 | 450d4ff5 | ths | static const struct cris_opcode **rest_prefixes = NULL; |
1400 | 450d4ff5 | ths | |
1401 | 450d4ff5 | ths | /* Allocate and clear the opcode-table. */
|
1402 | 450d4ff5 | ths | if (opc_table == NULL) |
1403 | 450d4ff5 | ths | { |
1404 | 450d4ff5 | ths | opc_table = malloc (65536 * sizeof (opc_table[0])); |
1405 | 450d4ff5 | ths | if (opc_table == NULL) |
1406 | 450d4ff5 | ths | return NULL; |
1407 | 450d4ff5 | ths | |
1408 | 450d4ff5 | ths | memset (opc_table, 0, 65536 * sizeof (const struct cris_opcode *)); |
1409 | 450d4ff5 | ths | |
1410 | 450d4ff5 | ths | dip_prefixes |
1411 | 450d4ff5 | ths | = malloc (65536 * sizeof (const struct cris_opcode **)); |
1412 | 450d4ff5 | ths | if (dip_prefixes == NULL) |
1413 | 450d4ff5 | ths | return NULL; |
1414 | 450d4ff5 | ths | |
1415 | 450d4ff5 | ths | memset (dip_prefixes, 0, 65536 * sizeof (dip_prefixes[0])); |
1416 | 450d4ff5 | ths | |
1417 | 450d4ff5 | ths | bdapq_m1_prefixes |
1418 | 450d4ff5 | ths | = malloc (65536 * sizeof (const struct cris_opcode **)); |
1419 | 450d4ff5 | ths | if (bdapq_m1_prefixes == NULL) |
1420 | 450d4ff5 | ths | return NULL; |
1421 | 450d4ff5 | ths | |
1422 | 450d4ff5 | ths | memset (bdapq_m1_prefixes, 0, 65536 * sizeof (bdapq_m1_prefixes[0])); |
1423 | 450d4ff5 | ths | |
1424 | 450d4ff5 | ths | bdapq_m2_prefixes |
1425 | 450d4ff5 | ths | = malloc (65536 * sizeof (const struct cris_opcode **)); |
1426 | 450d4ff5 | ths | if (bdapq_m2_prefixes == NULL) |
1427 | 450d4ff5 | ths | return NULL; |
1428 | 450d4ff5 | ths | |
1429 | 450d4ff5 | ths | memset (bdapq_m2_prefixes, 0, 65536 * sizeof (bdapq_m2_prefixes[0])); |
1430 | 450d4ff5 | ths | |
1431 | 450d4ff5 | ths | bdapq_m4_prefixes |
1432 | 450d4ff5 | ths | = malloc (65536 * sizeof (const struct cris_opcode **)); |
1433 | 450d4ff5 | ths | if (bdapq_m4_prefixes == NULL) |
1434 | 450d4ff5 | ths | return NULL; |
1435 | 450d4ff5 | ths | |
1436 | 450d4ff5 | ths | memset (bdapq_m4_prefixes, 0, 65536 * sizeof (bdapq_m4_prefixes[0])); |
1437 | 450d4ff5 | ths | |
1438 | 450d4ff5 | ths | rest_prefixes |
1439 | 450d4ff5 | ths | = malloc (65536 * sizeof (const struct cris_opcode **)); |
1440 | 450d4ff5 | ths | if (rest_prefixes == NULL) |
1441 | 450d4ff5 | ths | return NULL; |
1442 | 450d4ff5 | ths | |
1443 | 450d4ff5 | ths | memset (rest_prefixes, 0, 65536 * sizeof (rest_prefixes[0])); |
1444 | 450d4ff5 | ths | } |
1445 | 450d4ff5 | ths | |
1446 | 450d4ff5 | ths | /* Get the right table if this is a prefix.
|
1447 | 450d4ff5 | ths | This code is connected to cris_constraints in that it knows what
|
1448 | 450d4ff5 | ths | prefixes play a role in recognition of patterns; the necessary
|
1449 | 450d4ff5 | ths | state is reflected by which table is used. If constraints
|
1450 | 450d4ff5 | ths | involving match or non-match of prefix insns are changed, then this
|
1451 | 450d4ff5 | ths | probably needs changing too. */
|
1452 | 450d4ff5 | ths | if (prefix_insn != NO_CRIS_PREFIX)
|
1453 | 450d4ff5 | ths | { |
1454 | 450d4ff5 | ths | const struct cris_opcode *popcodep |
1455 | 450d4ff5 | ths | = (opc_table[prefix_insn] != NULL
|
1456 | 450d4ff5 | ths | ? opc_table[prefix_insn] |
1457 | 450d4ff5 | ths | : get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata)); |
1458 | 450d4ff5 | ths | |
1459 | 450d4ff5 | ths | if (popcodep == NULL) |
1460 | 450d4ff5 | ths | return NULL; |
1461 | 450d4ff5 | ths | |
1462 | 450d4ff5 | ths | if (popcodep->match == BDAP_QUICK_OPCODE)
|
1463 | 450d4ff5 | ths | { |
1464 | 450d4ff5 | ths | /* Since some offsets are recognized with "push" macros, we
|
1465 | 450d4ff5 | ths | have to have different tables for them. */
|
1466 | 450d4ff5 | ths | int offset = (prefix_insn & 255); |
1467 | 450d4ff5 | ths | |
1468 | 450d4ff5 | ths | if (offset > 127) |
1469 | 450d4ff5 | ths | offset -= 256;
|
1470 | 450d4ff5 | ths | |
1471 | 450d4ff5 | ths | switch (offset)
|
1472 | 450d4ff5 | ths | { |
1473 | 450d4ff5 | ths | case -4: |
1474 | 450d4ff5 | ths | prefix_opc_table = bdapq_m4_prefixes; |
1475 | 450d4ff5 | ths | break;
|
1476 | 450d4ff5 | ths | |
1477 | 450d4ff5 | ths | case -2: |
1478 | 450d4ff5 | ths | prefix_opc_table = bdapq_m2_prefixes; |
1479 | 450d4ff5 | ths | break;
|
1480 | 450d4ff5 | ths | |
1481 | 450d4ff5 | ths | case -1: |
1482 | 450d4ff5 | ths | prefix_opc_table = bdapq_m1_prefixes; |
1483 | 450d4ff5 | ths | break;
|
1484 | 450d4ff5 | ths | |
1485 | 450d4ff5 | ths | default:
|
1486 | 450d4ff5 | ths | prefix_opc_table = rest_prefixes; |
1487 | 450d4ff5 | ths | break;
|
1488 | 450d4ff5 | ths | } |
1489 | 450d4ff5 | ths | } |
1490 | 450d4ff5 | ths | else if (popcodep->match == DIP_OPCODE) |
1491 | 450d4ff5 | ths | /* We don't allow postincrement when the prefix is DIP, so use a
|
1492 | 450d4ff5 | ths | different table for DIP. */
|
1493 | 450d4ff5 | ths | prefix_opc_table = dip_prefixes; |
1494 | 450d4ff5 | ths | else
|
1495 | 450d4ff5 | ths | prefix_opc_table = rest_prefixes; |
1496 | 450d4ff5 | ths | } |
1497 | 450d4ff5 | ths | |
1498 | 450d4ff5 | ths | if (prefix_insn != NO_CRIS_PREFIX
|
1499 | 450d4ff5 | ths | && prefix_opc_table[insn] != NULL)
|
1500 | 450d4ff5 | ths | max_matchedp = prefix_opc_table[insn]; |
1501 | 450d4ff5 | ths | else if (prefix_insn == NO_CRIS_PREFIX && opc_table[insn] != NULL) |
1502 | 450d4ff5 | ths | max_matchedp = opc_table[insn]; |
1503 | 450d4ff5 | ths | else
|
1504 | 450d4ff5 | ths | { |
1505 | 450d4ff5 | ths | const struct cris_opcode *opcodep; |
1506 | 450d4ff5 | ths | int max_level_of_match = -1; |
1507 | 450d4ff5 | ths | |
1508 | 450d4ff5 | ths | for (opcodep = cris_opcodes;
|
1509 | 450d4ff5 | ths | opcodep->name != NULL;
|
1510 | 450d4ff5 | ths | opcodep++) |
1511 | 450d4ff5 | ths | { |
1512 | 450d4ff5 | ths | int level_of_match;
|
1513 | 450d4ff5 | ths | |
1514 | 450d4ff5 | ths | if (disdata->distype == cris_dis_v32)
|
1515 | 450d4ff5 | ths | { |
1516 | 450d4ff5 | ths | switch (opcodep->applicable_version)
|
1517 | 450d4ff5 | ths | { |
1518 | 450d4ff5 | ths | case cris_ver_version_all:
|
1519 | 450d4ff5 | ths | break;
|
1520 | 450d4ff5 | ths | |
1521 | 450d4ff5 | ths | case cris_ver_v0_3:
|
1522 | 450d4ff5 | ths | case cris_ver_v0_10:
|
1523 | 450d4ff5 | ths | case cris_ver_v3_10:
|
1524 | 450d4ff5 | ths | case cris_ver_sim_v0_10:
|
1525 | 450d4ff5 | ths | case cris_ver_v8_10:
|
1526 | 450d4ff5 | ths | case cris_ver_v10:
|
1527 | 450d4ff5 | ths | case cris_ver_warning:
|
1528 | 450d4ff5 | ths | continue;
|
1529 | 450d4ff5 | ths | |
1530 | 450d4ff5 | ths | case cris_ver_v3p:
|
1531 | 450d4ff5 | ths | case cris_ver_v8p:
|
1532 | 450d4ff5 | ths | case cris_ver_v10p:
|
1533 | 450d4ff5 | ths | case cris_ver_v32p:
|
1534 | 450d4ff5 | ths | break;
|
1535 | 450d4ff5 | ths | |
1536 | 450d4ff5 | ths | case cris_ver_v8:
|
1537 | 450d4ff5 | ths | abort (); |
1538 | 450d4ff5 | ths | default:
|
1539 | 450d4ff5 | ths | abort (); |
1540 | 450d4ff5 | ths | } |
1541 | 450d4ff5 | ths | } |
1542 | 450d4ff5 | ths | else
|
1543 | 450d4ff5 | ths | { |
1544 | 450d4ff5 | ths | switch (opcodep->applicable_version)
|
1545 | 450d4ff5 | ths | { |
1546 | 450d4ff5 | ths | case cris_ver_version_all:
|
1547 | 450d4ff5 | ths | case cris_ver_v0_3:
|
1548 | 450d4ff5 | ths | case cris_ver_v3p:
|
1549 | 450d4ff5 | ths | case cris_ver_v0_10:
|
1550 | 450d4ff5 | ths | case cris_ver_v8p:
|
1551 | 450d4ff5 | ths | case cris_ver_v8_10:
|
1552 | 450d4ff5 | ths | case cris_ver_v10:
|
1553 | 450d4ff5 | ths | case cris_ver_sim_v0_10:
|
1554 | 450d4ff5 | ths | case cris_ver_v10p:
|
1555 | 450d4ff5 | ths | case cris_ver_warning:
|
1556 | 450d4ff5 | ths | break;
|
1557 | 450d4ff5 | ths | |
1558 | 450d4ff5 | ths | case cris_ver_v32p:
|
1559 | 450d4ff5 | ths | continue;
|
1560 | 450d4ff5 | ths | |
1561 | 450d4ff5 | ths | case cris_ver_v8:
|
1562 | 450d4ff5 | ths | abort (); |
1563 | 450d4ff5 | ths | default:
|
1564 | 450d4ff5 | ths | abort (); |
1565 | 450d4ff5 | ths | } |
1566 | 450d4ff5 | ths | } |
1567 | 450d4ff5 | ths | |
1568 | 450d4ff5 | ths | /* We give a double lead for bits matching the template in
|
1569 | 450d4ff5 | ths | cris_opcodes. Not even, because then "move p8,r10" would
|
1570 | 450d4ff5 | ths | be given 2 bits lead over "clear.d r10". When there's a
|
1571 | 450d4ff5 | ths | tie, the first entry in the table wins. This is
|
1572 | 450d4ff5 | ths | deliberate, to avoid a more complicated recognition
|
1573 | 450d4ff5 | ths | formula. */
|
1574 | 450d4ff5 | ths | if ((opcodep->match & insn) == opcodep->match
|
1575 | 450d4ff5 | ths | && (opcodep->lose & insn) == 0
|
1576 | 450d4ff5 | ths | && ((level_of_match |
1577 | 450d4ff5 | ths | = cris_constraint (opcodep->args, |
1578 | 450d4ff5 | ths | insn, |
1579 | 450d4ff5 | ths | prefix_insn, |
1580 | 450d4ff5 | ths | disdata)) |
1581 | 450d4ff5 | ths | >= 0)
|
1582 | 450d4ff5 | ths | && ((level_of_match |
1583 | 450d4ff5 | ths | += 2 * number_of_bits (opcodep->match
|
1584 | 450d4ff5 | ths | | opcodep->lose)) |
1585 | 450d4ff5 | ths | > max_level_of_match)) |
1586 | 450d4ff5 | ths | { |
1587 | 450d4ff5 | ths | max_matchedp = opcodep; |
1588 | 450d4ff5 | ths | max_level_of_match = level_of_match; |
1589 | 450d4ff5 | ths | |
1590 | 450d4ff5 | ths | /* If there was a full match, never mind looking
|
1591 | 450d4ff5 | ths | further. */
|
1592 | 450d4ff5 | ths | if (level_of_match >= 2 * 16) |
1593 | 450d4ff5 | ths | break;
|
1594 | 450d4ff5 | ths | } |
1595 | 450d4ff5 | ths | } |
1596 | 450d4ff5 | ths | /* Fill in the new entry.
|
1597 | 450d4ff5 | ths | |
1598 | 450d4ff5 | ths | If there are changes to the opcode-table involving prefixes, and
|
1599 | 450d4ff5 | ths | disassembly then does not work correctly, try removing the
|
1600 | 450d4ff5 | ths | else-clause below that fills in the prefix-table. If that
|
1601 | 450d4ff5 | ths | helps, you need to change the prefix_opc_table setting above, or
|
1602 | 450d4ff5 | ths | something related. */
|
1603 | 450d4ff5 | ths | if (prefix_insn == NO_CRIS_PREFIX)
|
1604 | 450d4ff5 | ths | opc_table[insn] = max_matchedp; |
1605 | 450d4ff5 | ths | else
|
1606 | 450d4ff5 | ths | prefix_opc_table[insn] = max_matchedp; |
1607 | 450d4ff5 | ths | } |
1608 | 450d4ff5 | ths | |
1609 | 450d4ff5 | ths | return max_matchedp;
|
1610 | 450d4ff5 | ths | } |
1611 | 450d4ff5 | ths | |
1612 | 450d4ff5 | ths | /* Return -1 if the constraints of a bitwise-matched instruction say
|
1613 | 450d4ff5 | ths | that there is no match. Otherwise return a nonnegative number
|
1614 | 450d4ff5 | ths | indicating the confidence in the match (higher is better). */
|
1615 | 450d4ff5 | ths | |
1616 | 450d4ff5 | ths | static int |
1617 | 450d4ff5 | ths | cris_constraint (const char *cs, |
1618 | 450d4ff5 | ths | unsigned int insn, |
1619 | 450d4ff5 | ths | unsigned int prefix_insn, |
1620 | 450d4ff5 | ths | struct cris_disasm_data *disdata)
|
1621 | 450d4ff5 | ths | { |
1622 | 450d4ff5 | ths | int retval = 0; |
1623 | 450d4ff5 | ths | int tmp;
|
1624 | 450d4ff5 | ths | int prefix_ok = 0; |
1625 | 450d4ff5 | ths | const char *s; |
1626 | 450d4ff5 | ths | |
1627 | 450d4ff5 | ths | for (s = cs; *s; s++)
|
1628 | 450d4ff5 | ths | switch (*s)
|
1629 | 450d4ff5 | ths | { |
1630 | 450d4ff5 | ths | case '!': |
1631 | 450d4ff5 | ths | /* Do not recognize "pop" if there's a prefix and then only for
|
1632 | 450d4ff5 | ths | v0..v10. */
|
1633 | 450d4ff5 | ths | if (prefix_insn != NO_CRIS_PREFIX
|
1634 | 450d4ff5 | ths | || disdata->distype != cris_dis_v0_v10) |
1635 | 450d4ff5 | ths | return -1; |
1636 | 450d4ff5 | ths | break;
|
1637 | 450d4ff5 | ths | |
1638 | 450d4ff5 | ths | case 'U': |
1639 | 450d4ff5 | ths | /* Not recognized at disassembly. */
|
1640 | 450d4ff5 | ths | return -1; |
1641 | 450d4ff5 | ths | |
1642 | 450d4ff5 | ths | case 'M': |
1643 | 450d4ff5 | ths | /* Size modifier for "clear", i.e. special register 0, 4 or 8.
|
1644 | 450d4ff5 | ths | Check that it is one of them. Only special register 12 could
|
1645 | 450d4ff5 | ths | be mismatched, but checking for matches is more logical than
|
1646 | 450d4ff5 | ths | checking for mismatches when there are only a few cases. */
|
1647 | 450d4ff5 | ths | tmp = ((insn >> 12) & 0xf); |
1648 | 450d4ff5 | ths | if (tmp != 0 && tmp != 4 && tmp != 8) |
1649 | 450d4ff5 | ths | return -1; |
1650 | 450d4ff5 | ths | break;
|
1651 | 450d4ff5 | ths | |
1652 | 450d4ff5 | ths | case 'm': |
1653 | 450d4ff5 | ths | if ((insn & 0x30) == 0x30) |
1654 | 450d4ff5 | ths | return -1; |
1655 | 450d4ff5 | ths | break;
|
1656 | 450d4ff5 | ths | |
1657 | 450d4ff5 | ths | case 'S': |
1658 | 450d4ff5 | ths | /* A prefix operand without side-effect. */
|
1659 | 450d4ff5 | ths | if (prefix_insn != NO_CRIS_PREFIX && (insn & 0x400) == 0) |
1660 | 450d4ff5 | ths | { |
1661 | 450d4ff5 | ths | prefix_ok = 1;
|
1662 | 450d4ff5 | ths | break;
|
1663 | 450d4ff5 | ths | } |
1664 | 450d4ff5 | ths | else
|
1665 | 450d4ff5 | ths | return -1; |
1666 | 450d4ff5 | ths | |
1667 | 450d4ff5 | ths | case 's': |
1668 | 450d4ff5 | ths | case 'y': |
1669 | 450d4ff5 | ths | case 'Y': |
1670 | 450d4ff5 | ths | /* If this is a prefixed insn with postincrement (side-effect),
|
1671 | 450d4ff5 | ths | the prefix must not be DIP. */
|
1672 | 450d4ff5 | ths | if (prefix_insn != NO_CRIS_PREFIX)
|
1673 | 450d4ff5 | ths | { |
1674 | 450d4ff5 | ths | if (insn & 0x400) |
1675 | 450d4ff5 | ths | { |
1676 | 450d4ff5 | ths | const struct cris_opcode *prefix_opcodep |
1677 | 450d4ff5 | ths | = get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata); |
1678 | 450d4ff5 | ths | |
1679 | 450d4ff5 | ths | if (prefix_opcodep->match == DIP_OPCODE)
|
1680 | 450d4ff5 | ths | return -1; |
1681 | 450d4ff5 | ths | } |
1682 | 450d4ff5 | ths | |
1683 | 450d4ff5 | ths | prefix_ok = 1;
|
1684 | 450d4ff5 | ths | } |
1685 | 450d4ff5 | ths | break;
|
1686 | 450d4ff5 | ths | |
1687 | 450d4ff5 | ths | case 'B': |
1688 | 450d4ff5 | ths | /* If we don't fall through, then the prefix is ok. */
|
1689 | 450d4ff5 | ths | prefix_ok = 1;
|
1690 | 450d4ff5 | ths | |
1691 | 450d4ff5 | ths | /* A "push" prefix. Check for valid "push" size.
|
1692 | 450d4ff5 | ths | In case of special register, it may be != 4. */
|
1693 | 450d4ff5 | ths | if (prefix_insn != NO_CRIS_PREFIX)
|
1694 | 450d4ff5 | ths | { |
1695 | 450d4ff5 | ths | /* Match the prefix insn to BDAPQ. */
|
1696 | 450d4ff5 | ths | const struct cris_opcode *prefix_opcodep |
1697 | 450d4ff5 | ths | = get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata); |
1698 | 450d4ff5 | ths | |
1699 | 450d4ff5 | ths | if (prefix_opcodep->match == BDAP_QUICK_OPCODE)
|
1700 | 450d4ff5 | ths | { |
1701 | 450d4ff5 | ths | int pushsize = (prefix_insn & 255); |
1702 | 450d4ff5 | ths | |
1703 | 450d4ff5 | ths | if (pushsize > 127) |
1704 | 450d4ff5 | ths | pushsize -= 256;
|
1705 | 450d4ff5 | ths | |
1706 | 450d4ff5 | ths | if (s[1] == 'P') |
1707 | 450d4ff5 | ths | { |
1708 | 450d4ff5 | ths | unsigned int spec_reg = (insn >> 12) & 15; |
1709 | 450d4ff5 | ths | const struct cris_spec_reg *sregp |
1710 | 450d4ff5 | ths | = spec_reg_info (spec_reg, disdata->distype); |
1711 | 450d4ff5 | ths | |
1712 | 450d4ff5 | ths | /* For a special-register, the "prefix size" must
|
1713 | 450d4ff5 | ths | match the size of the register. */
|
1714 | 450d4ff5 | ths | if (sregp && sregp->reg_size == (unsigned int) -pushsize) |
1715 | 450d4ff5 | ths | break;
|
1716 | 450d4ff5 | ths | } |
1717 | 450d4ff5 | ths | else if (s[1] == 'R') |
1718 | 450d4ff5 | ths | { |
1719 | 450d4ff5 | ths | if ((insn & 0x30) == 0x20 && pushsize == -4) |
1720 | 450d4ff5 | ths | break;
|
1721 | 450d4ff5 | ths | } |
1722 | 450d4ff5 | ths | /* FIXME: Should abort here; next constraint letter
|
1723 | 450d4ff5 | ths | *must* be 'P' or 'R'. */
|
1724 | 450d4ff5 | ths | } |
1725 | 450d4ff5 | ths | } |
1726 | 450d4ff5 | ths | return -1; |
1727 | 450d4ff5 | ths | |
1728 | 450d4ff5 | ths | case 'D': |
1729 | 450d4ff5 | ths | retval = (((insn >> 12) & 15) == (insn & 15)); |
1730 | 450d4ff5 | ths | if (!retval)
|
1731 | 450d4ff5 | ths | return -1; |
1732 | 450d4ff5 | ths | else
|
1733 | 450d4ff5 | ths | retval += 4;
|
1734 | 450d4ff5 | ths | break;
|
1735 | 450d4ff5 | ths | |
1736 | 450d4ff5 | ths | case 'P': |
1737 | 450d4ff5 | ths | { |
1738 | 450d4ff5 | ths | const struct cris_spec_reg *sregp |
1739 | 450d4ff5 | ths | = spec_reg_info ((insn >> 12) & 15, disdata->distype); |
1740 | 450d4ff5 | ths | |
1741 | 450d4ff5 | ths | /* Since we match four bits, we will give a value of 4-1 = 3
|
1742 | 450d4ff5 | ths | in a match. If there is a corresponding exact match of a
|
1743 | 450d4ff5 | ths | special register in another pattern, it will get a value of
|
1744 | 450d4ff5 | ths | 4, which will be higher. This should be correct in that an
|
1745 | 450d4ff5 | ths | exact pattern would match better than a general pattern.
|
1746 | 450d4ff5 | ths | |
1747 | 450d4ff5 | ths | Note that there is a reason for not returning zero; the
|
1748 | 450d4ff5 | ths | pattern for "clear" is partly matched in the bit-pattern
|
1749 | 450d4ff5 | ths | (the two lower bits must be zero), while the bit-pattern
|
1750 | 450d4ff5 | ths | for a move from a special register is matched in the
|
1751 | 450d4ff5 | ths | register constraint. */
|
1752 | 450d4ff5 | ths | |
1753 | 450d4ff5 | ths | if (sregp != NULL) |
1754 | 450d4ff5 | ths | { |
1755 | 450d4ff5 | ths | retval += 3;
|
1756 | 450d4ff5 | ths | break;
|
1757 | 450d4ff5 | ths | } |
1758 | 450d4ff5 | ths | else
|
1759 | 450d4ff5 | ths | return -1; |
1760 | 450d4ff5 | ths | } |
1761 | 450d4ff5 | ths | } |
1762 | 450d4ff5 | ths | |
1763 | 450d4ff5 | ths | if (prefix_insn != NO_CRIS_PREFIX && ! prefix_ok)
|
1764 | 450d4ff5 | ths | return -1; |
1765 | 450d4ff5 | ths | |
1766 | 450d4ff5 | ths | return retval;
|
1767 | 450d4ff5 | ths | } |
1768 | 450d4ff5 | ths | |
1769 | 450d4ff5 | ths | /* Format number as hex with a leading "0x" into outbuffer. */
|
1770 | 450d4ff5 | ths | |
1771 | 450d4ff5 | ths | static char * |
1772 | 450d4ff5 | ths | format_hex (unsigned long number, |
1773 | 450d4ff5 | ths | char *outbuffer,
|
1774 | 450d4ff5 | ths | struct cris_disasm_data *disdata)
|
1775 | 450d4ff5 | ths | { |
1776 | 450d4ff5 | ths | /* Truncate negative numbers on >32-bit hosts. */
|
1777 | 450d4ff5 | ths | number &= 0xffffffff;
|
1778 | 450d4ff5 | ths | |
1779 | 450d4ff5 | ths | sprintf (outbuffer, "0x%lx", number);
|
1780 | 450d4ff5 | ths | |
1781 | 450d4ff5 | ths | /* Save this value for the "case" support. */
|
1782 | 450d4ff5 | ths | if (TRACE_CASE)
|
1783 | 450d4ff5 | ths | last_immediate = number; |
1784 | 450d4ff5 | ths | |
1785 | 450d4ff5 | ths | return outbuffer + strlen (outbuffer);
|
1786 | 450d4ff5 | ths | } |
1787 | 450d4ff5 | ths | |
1788 | 450d4ff5 | ths | /* Format number as decimal into outbuffer. Parameter signedp says
|
1789 | 450d4ff5 | ths | whether the number should be formatted as signed (!= 0) or
|
1790 | 450d4ff5 | ths | unsigned (== 0). */
|
1791 | 450d4ff5 | ths | |
1792 | 450d4ff5 | ths | static char * |
1793 | 450d4ff5 | ths | format_dec (long number, char *outbuffer, int signedp) |
1794 | 450d4ff5 | ths | { |
1795 | 450d4ff5 | ths | last_immediate = number; |
1796 | 450d4ff5 | ths | sprintf (outbuffer, signedp ? "%ld" : "%lu", number); |
1797 | 450d4ff5 | ths | |
1798 | 450d4ff5 | ths | return outbuffer + strlen (outbuffer);
|
1799 | 450d4ff5 | ths | } |
1800 | 450d4ff5 | ths | |
1801 | 450d4ff5 | ths | /* Format the name of the general register regno into outbuffer. */
|
1802 | 450d4ff5 | ths | |
1803 | 450d4ff5 | ths | static char * |
1804 | 450d4ff5 | ths | format_reg (struct cris_disasm_data *disdata,
|
1805 | 450d4ff5 | ths | int regno,
|
1806 | 450d4ff5 | ths | char *outbuffer_start,
|
1807 | 450d4ff5 | ths | bfd_boolean with_reg_prefix) |
1808 | 450d4ff5 | ths | { |
1809 | 450d4ff5 | ths | char *outbuffer = outbuffer_start;
|
1810 | 450d4ff5 | ths | |
1811 | 450d4ff5 | ths | if (with_reg_prefix)
|
1812 | 450d4ff5 | ths | *outbuffer++ = REGISTER_PREFIX_CHAR; |
1813 | 450d4ff5 | ths | |
1814 | 450d4ff5 | ths | switch (regno)
|
1815 | 450d4ff5 | ths | { |
1816 | 450d4ff5 | ths | case 15: |
1817 | 450d4ff5 | ths | /* For v32, there is no context in which we output PC. */
|
1818 | 450d4ff5 | ths | if (disdata->distype == cris_dis_v32)
|
1819 | 450d4ff5 | ths | strcpy (outbuffer, "acr");
|
1820 | 450d4ff5 | ths | else
|
1821 | 450d4ff5 | ths | strcpy (outbuffer, "pc");
|
1822 | 450d4ff5 | ths | break;
|
1823 | 450d4ff5 | ths | |
1824 | 450d4ff5 | ths | case 14: |
1825 | 450d4ff5 | ths | strcpy (outbuffer, "sp");
|
1826 | 450d4ff5 | ths | break;
|
1827 | 450d4ff5 | ths | |
1828 | 450d4ff5 | ths | default:
|
1829 | 450d4ff5 | ths | sprintf (outbuffer, "r%d", regno);
|
1830 | 450d4ff5 | ths | break;
|
1831 | 450d4ff5 | ths | } |
1832 | 450d4ff5 | ths | |
1833 | 450d4ff5 | ths | return outbuffer_start + strlen (outbuffer_start);
|
1834 | 450d4ff5 | ths | } |
1835 | 450d4ff5 | ths | |
1836 | 450d4ff5 | ths | /* Format the name of a support register into outbuffer. */
|
1837 | 450d4ff5 | ths | |
1838 | 450d4ff5 | ths | static char * |
1839 | 450d4ff5 | ths | format_sup_reg (unsigned int regno, |
1840 | 450d4ff5 | ths | char *outbuffer_start,
|
1841 | 450d4ff5 | ths | bfd_boolean with_reg_prefix) |
1842 | 450d4ff5 | ths | { |
1843 | 450d4ff5 | ths | char *outbuffer = outbuffer_start;
|
1844 | 450d4ff5 | ths | int i;
|
1845 | 450d4ff5 | ths | |
1846 | 450d4ff5 | ths | if (with_reg_prefix)
|
1847 | 450d4ff5 | ths | *outbuffer++ = REGISTER_PREFIX_CHAR; |
1848 | 450d4ff5 | ths | |
1849 | 450d4ff5 | ths | for (i = 0; cris_support_regs[i].name != NULL; i++) |
1850 | 450d4ff5 | ths | if (cris_support_regs[i].number == regno)
|
1851 | 450d4ff5 | ths | { |
1852 | 450d4ff5 | ths | sprintf (outbuffer, "%s", cris_support_regs[i].name);
|
1853 | 450d4ff5 | ths | return outbuffer_start + strlen (outbuffer_start);
|
1854 | 450d4ff5 | ths | } |
1855 | 450d4ff5 | ths | |
1856 | 450d4ff5 | ths | /* There's supposed to be register names covering all numbers, though
|
1857 | 450d4ff5 | ths | some may be generic names. */
|
1858 | 450d4ff5 | ths | sprintf (outbuffer, "format_sup_reg-BUG");
|
1859 | 450d4ff5 | ths | return outbuffer_start + strlen (outbuffer_start);
|
1860 | 450d4ff5 | ths | } |
1861 | 450d4ff5 | ths | |
1862 | 450d4ff5 | ths | /* Return the length of an instruction. */
|
1863 | 450d4ff5 | ths | |
1864 | 450d4ff5 | ths | static unsigned |
1865 | 450d4ff5 | ths | bytes_to_skip (unsigned int insn, |
1866 | 450d4ff5 | ths | const struct cris_opcode *matchedp, |
1867 | 450d4ff5 | ths | enum cris_disass_family distype,
|
1868 | 450d4ff5 | ths | const struct cris_opcode *prefix_matchedp) |
1869 | 450d4ff5 | ths | { |
1870 | 450d4ff5 | ths | /* Each insn is a word plus "immediate" operands. */
|
1871 | 450d4ff5 | ths | unsigned to_skip = 2; |
1872 | 450d4ff5 | ths | const char *template = matchedp->args; |
1873 | 450d4ff5 | ths | const char *s; |
1874 | 450d4ff5 | ths | |
1875 | 450d4ff5 | ths | for (s = template; *s; s++)
|
1876 | 450d4ff5 | ths | if ((*s == 's' || *s == 'N' || *s == 'Y') |
1877 | 450d4ff5 | ths | && (insn & 0x400) && (insn & 15) == 15 |
1878 | 450d4ff5 | ths | && prefix_matchedp == NULL)
|
1879 | 450d4ff5 | ths | { |
1880 | 450d4ff5 | ths | /* Immediate via [pc+], so we have to check the size of the
|
1881 | 450d4ff5 | ths | operand. */
|
1882 | 450d4ff5 | ths | int mode_size = 1 << ((insn >> 4) & (*template == 'z' ? 1 : 3)); |
1883 | 450d4ff5 | ths | |
1884 | 450d4ff5 | ths | if (matchedp->imm_oprnd_size == SIZE_FIX_32)
|
1885 | 450d4ff5 | ths | to_skip += 4;
|
1886 | 450d4ff5 | ths | else if (matchedp->imm_oprnd_size == SIZE_SPEC_REG) |
1887 | 450d4ff5 | ths | { |
1888 | 450d4ff5 | ths | const struct cris_spec_reg *sregp |
1889 | 450d4ff5 | ths | = spec_reg_info ((insn >> 12) & 15, distype); |
1890 | 450d4ff5 | ths | |
1891 | 450d4ff5 | ths | /* FIXME: Improve error handling; should have been caught
|
1892 | 450d4ff5 | ths | earlier. */
|
1893 | 450d4ff5 | ths | if (sregp == NULL) |
1894 | 450d4ff5 | ths | return 2; |
1895 | 450d4ff5 | ths | |
1896 | 450d4ff5 | ths | /* PC is incremented by two, not one, for a byte. Except on
|
1897 | 450d4ff5 | ths | CRISv32, where constants are always DWORD-size for
|
1898 | 450d4ff5 | ths | special registers. */
|
1899 | 450d4ff5 | ths | to_skip += |
1900 | 450d4ff5 | ths | distype == cris_dis_v32 ? 4 : (sregp->reg_size + 1) & ~1; |
1901 | 450d4ff5 | ths | } |
1902 | 450d4ff5 | ths | else
|
1903 | 450d4ff5 | ths | to_skip += (mode_size + 1) & ~1; |
1904 | 450d4ff5 | ths | } |
1905 | 450d4ff5 | ths | else if (*s == 'n') |
1906 | 450d4ff5 | ths | to_skip += 4;
|
1907 | 450d4ff5 | ths | else if (*s == 'b') |
1908 | 450d4ff5 | ths | to_skip += 2;
|
1909 | 450d4ff5 | ths | |
1910 | 450d4ff5 | ths | return to_skip;
|
1911 | 450d4ff5 | ths | } |
1912 | 450d4ff5 | ths | |
1913 | 450d4ff5 | ths | /* Print condition code flags. */
|
1914 | 450d4ff5 | ths | |
1915 | 450d4ff5 | ths | static char * |
1916 | 450d4ff5 | ths | print_flags (struct cris_disasm_data *disdata, unsigned int insn, char *cp) |
1917 | 450d4ff5 | ths | { |
1918 | 450d4ff5 | ths | /* Use the v8 (Etrax 100) flag definitions for disassembly.
|
1919 | 450d4ff5 | ths | The differences with v0 (Etrax 1..4) vs. Svinto are:
|
1920 | 450d4ff5 | ths | v0 'd' <=> v8 'm'
|
1921 | 450d4ff5 | ths | v0 'e' <=> v8 'b'.
|
1922 | 450d4ff5 | ths | FIXME: Emit v0..v3 flag names somehow. */
|
1923 | 450d4ff5 | ths | static const char v8_fnames[] = "cvznxibm"; |
1924 | 450d4ff5 | ths | static const char v32_fnames[] = "cvznxiup"; |
1925 | 450d4ff5 | ths | const char *fnames |
1926 | 450d4ff5 | ths | = disdata->distype == cris_dis_v32 ? v32_fnames : v8_fnames; |
1927 | 450d4ff5 | ths | |
1928 | 450d4ff5 | ths | unsigned char flagbits = (((insn >> 8) & 0xf0) | (insn & 15)); |
1929 | 450d4ff5 | ths | int i;
|
1930 | 450d4ff5 | ths | |
1931 | 450d4ff5 | ths | for (i = 0; i < 8; i++) |
1932 | 450d4ff5 | ths | if (flagbits & (1 << i)) |
1933 | 450d4ff5 | ths | *cp++ = fnames[i]; |
1934 | 450d4ff5 | ths | |
1935 | 450d4ff5 | ths | return cp;
|
1936 | 450d4ff5 | ths | } |
1937 | 450d4ff5 | ths | |
1938 | 450d4ff5 | ths | /* Print out an insn with its operands, and update the info->insn_type
|
1939 | 450d4ff5 | ths | fields. The prefix_opcodep and the rest hold a prefix insn that is
|
1940 | 450d4ff5 | ths | supposed to be output as an address mode. */
|
1941 | 450d4ff5 | ths | |
1942 | 450d4ff5 | ths | static void |
1943 | 450d4ff5 | ths | print_with_operands (const struct cris_opcode *opcodep, |
1944 | 450d4ff5 | ths | unsigned int insn, |
1945 | 450d4ff5 | ths | unsigned char *buffer, |
1946 | 450d4ff5 | ths | bfd_vma addr, |
1947 | 450d4ff5 | ths | disassemble_info *info, |
1948 | 450d4ff5 | ths | /* If a prefix insn was before this insn (and is supposed
|
1949 | 450d4ff5 | ths | to be output as an address), here is a description of
|
1950 | 450d4ff5 | ths | it. */
|
1951 | 450d4ff5 | ths | const struct cris_opcode *prefix_opcodep, |
1952 | 450d4ff5 | ths | unsigned int prefix_insn, |
1953 | 450d4ff5 | ths | unsigned char *prefix_buffer, |
1954 | 450d4ff5 | ths | bfd_boolean with_reg_prefix) |
1955 | 450d4ff5 | ths | { |
1956 | 450d4ff5 | ths | /* Get a buffer of somewhat reasonable size where we store
|
1957 | 450d4ff5 | ths | intermediate parts of the insn. */
|
1958 | 450d4ff5 | ths | char temp[sizeof (".d [$r13=$r12-2147483648],$r10") * 2]; |
1959 | 450d4ff5 | ths | char *tp = temp;
|
1960 | 450d4ff5 | ths | static const char mode_char[] = "bwd?"; |
1961 | 450d4ff5 | ths | const char *s; |
1962 | 450d4ff5 | ths | const char *cs; |
1963 | 450d4ff5 | ths | struct cris_disasm_data *disdata
|
1964 | 450d4ff5 | ths | = (struct cris_disasm_data *) info->private_data;
|
1965 | 450d4ff5 | ths | |
1966 | 450d4ff5 | ths | /* Print out the name first thing we do. */
|
1967 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s", opcodep->name);
|
1968 | 450d4ff5 | ths | |
1969 | 450d4ff5 | ths | cs = opcodep->args; |
1970 | 450d4ff5 | ths | s = cs; |
1971 | 450d4ff5 | ths | |
1972 | 450d4ff5 | ths | /* Ignore any prefix indicator. */
|
1973 | 450d4ff5 | ths | if (*s == 'p') |
1974 | 450d4ff5 | ths | s++; |
1975 | 450d4ff5 | ths | |
1976 | 450d4ff5 | ths | if (*s == 'm' || *s == 'M' || *s == 'z') |
1977 | 450d4ff5 | ths | { |
1978 | 450d4ff5 | ths | *tp++ = '.';
|
1979 | 450d4ff5 | ths | |
1980 | 450d4ff5 | ths | /* Get the size-letter. */
|
1981 | 450d4ff5 | ths | *tp++ = *s == 'M'
|
1982 | 450d4ff5 | ths | ? (insn & 0x8000 ? 'd' |
1983 | 450d4ff5 | ths | : insn & 0x4000 ? 'w' : 'b') |
1984 | 450d4ff5 | ths | : mode_char[(insn >> 4) & (*s == 'z' ? 1 : 3)]; |
1985 | 450d4ff5 | ths | |
1986 | 450d4ff5 | ths | /* Ignore the size and the space character that follows. */
|
1987 | 450d4ff5 | ths | s += 2;
|
1988 | 450d4ff5 | ths | } |
1989 | 450d4ff5 | ths | |
1990 | 450d4ff5 | ths | /* Add a space if this isn't a long-branch, because for those will add
|
1991 | 450d4ff5 | ths | the condition part of the name later. */
|
1992 | 450d4ff5 | ths | if (opcodep->match != (BRANCH_PC_LOW + BRANCH_INCR_HIGH * 256)) |
1993 | 450d4ff5 | ths | *tp++ = ' ';
|
1994 | 450d4ff5 | ths | |
1995 | 450d4ff5 | ths | /* Fill in the insn-type if deducible from the name (and there's no
|
1996 | 450d4ff5 | ths | better way). */
|
1997 | 450d4ff5 | ths | if (opcodep->name[0] == 'j') |
1998 | 450d4ff5 | ths | { |
1999 | 450d4ff5 | ths | if (CONST_STRNEQ (opcodep->name, "jsr")) |
2000 | 450d4ff5 | ths | /* It's "jsr" or "jsrc". */
|
2001 | 450d4ff5 | ths | info->insn_type = dis_jsr; |
2002 | 450d4ff5 | ths | else
|
2003 | 450d4ff5 | ths | /* Any other jump-type insn is considered a branch. */
|
2004 | 450d4ff5 | ths | info->insn_type = dis_branch; |
2005 | 450d4ff5 | ths | } |
2006 | 450d4ff5 | ths | |
2007 | 450d4ff5 | ths | /* We might know some more fields right now. */
|
2008 | 450d4ff5 | ths | info->branch_delay_insns = opcodep->delayed; |
2009 | 450d4ff5 | ths | |
2010 | 450d4ff5 | ths | /* Handle operands. */
|
2011 | 450d4ff5 | ths | for (; *s; s++)
|
2012 | 450d4ff5 | ths | { |
2013 | 450d4ff5 | ths | switch (*s)
|
2014 | 450d4ff5 | ths | { |
2015 | 450d4ff5 | ths | case 'T': |
2016 | 450d4ff5 | ths | tp = format_sup_reg ((insn >> 12) & 15, tp, with_reg_prefix); |
2017 | 450d4ff5 | ths | break;
|
2018 | 450d4ff5 | ths | |
2019 | 450d4ff5 | ths | case 'A': |
2020 | 450d4ff5 | ths | if (with_reg_prefix)
|
2021 | 450d4ff5 | ths | *tp++ = REGISTER_PREFIX_CHAR; |
2022 | 450d4ff5 | ths | *tp++ = 'a';
|
2023 | 450d4ff5 | ths | *tp++ = 'c';
|
2024 | 450d4ff5 | ths | *tp++ = 'r';
|
2025 | 450d4ff5 | ths | break;
|
2026 | 450d4ff5 | ths | |
2027 | 450d4ff5 | ths | case '[': |
2028 | 450d4ff5 | ths | case ']': |
2029 | 450d4ff5 | ths | case ',': |
2030 | 450d4ff5 | ths | *tp++ = *s; |
2031 | 450d4ff5 | ths | break;
|
2032 | 450d4ff5 | ths | |
2033 | 450d4ff5 | ths | case '!': |
2034 | 450d4ff5 | ths | /* Ignore at this point; used at earlier stages to avoid
|
2035 | 450d4ff5 | ths | recognition if there's a prefix at something that in other
|
2036 | 450d4ff5 | ths | ways looks like a "pop". */
|
2037 | 450d4ff5 | ths | break;
|
2038 | 450d4ff5 | ths | |
2039 | 450d4ff5 | ths | case 'd': |
2040 | 450d4ff5 | ths | /* Ignore. This is an optional ".d " on the large one of
|
2041 | 450d4ff5 | ths | relaxable insns. */
|
2042 | 450d4ff5 | ths | break;
|
2043 | 450d4ff5 | ths | |
2044 | 450d4ff5 | ths | case 'B': |
2045 | 450d4ff5 | ths | /* This was the prefix that made this a "push". We've already
|
2046 | 450d4ff5 | ths | handled it by recognizing it, so signal that the prefix is
|
2047 | 450d4ff5 | ths | handled by setting it to NULL. */
|
2048 | 450d4ff5 | ths | prefix_opcodep = NULL;
|
2049 | 450d4ff5 | ths | break;
|
2050 | 450d4ff5 | ths | |
2051 | 450d4ff5 | ths | case 'D': |
2052 | 450d4ff5 | ths | case 'r': |
2053 | 450d4ff5 | ths | tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
|
2054 | 450d4ff5 | ths | break;
|
2055 | 450d4ff5 | ths | |
2056 | 450d4ff5 | ths | case 'R': |
2057 | 450d4ff5 | ths | tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix); |
2058 | 450d4ff5 | ths | break;
|
2059 | 450d4ff5 | ths | |
2060 | 450d4ff5 | ths | case 'n': |
2061 | 450d4ff5 | ths | { |
2062 | 450d4ff5 | ths | /* Like N but pc-relative to the start of the insn. */
|
2063 | 450d4ff5 | ths | unsigned long number |
2064 | 450d4ff5 | ths | = (buffer[2] + buffer[3] * 256 + buffer[4] * 65536 |
2065 | 450d4ff5 | ths | + buffer[5] * 0x1000000 + addr); |
2066 | 450d4ff5 | ths | |
2067 | 450d4ff5 | ths | /* Finish off and output previous formatted bytes. */
|
2068 | 450d4ff5 | ths | *tp = 0;
|
2069 | 450d4ff5 | ths | if (temp[0]) |
2070 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s", temp);
|
2071 | 450d4ff5 | ths | tp = temp; |
2072 | 450d4ff5 | ths | |
2073 | 450d4ff5 | ths | (*info->print_address_func) ((bfd_vma) number, info); |
2074 | 450d4ff5 | ths | } |
2075 | 450d4ff5 | ths | break;
|
2076 | 450d4ff5 | ths | |
2077 | 450d4ff5 | ths | case 'u': |
2078 | 450d4ff5 | ths | { |
2079 | 450d4ff5 | ths | /* Like n but the offset is bits <3:0> in the instruction. */
|
2080 | 450d4ff5 | ths | unsigned long number = (buffer[0] & 0xf) * 2 + addr; |
2081 | 450d4ff5 | ths | |
2082 | 450d4ff5 | ths | /* Finish off and output previous formatted bytes. */
|
2083 | 450d4ff5 | ths | *tp = 0;
|
2084 | 450d4ff5 | ths | if (temp[0]) |
2085 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s", temp);
|
2086 | 450d4ff5 | ths | tp = temp; |
2087 | 450d4ff5 | ths | |
2088 | 450d4ff5 | ths | (*info->print_address_func) ((bfd_vma) number, info); |
2089 | 450d4ff5 | ths | } |
2090 | 450d4ff5 | ths | break;
|
2091 | 450d4ff5 | ths | |
2092 | 450d4ff5 | ths | case 'N': |
2093 | 450d4ff5 | ths | case 'y': |
2094 | 450d4ff5 | ths | case 'Y': |
2095 | 450d4ff5 | ths | case 'S': |
2096 | 450d4ff5 | ths | case 's': |
2097 | 450d4ff5 | ths | /* Any "normal" memory operand. */
|
2098 | 450d4ff5 | ths | if ((insn & 0x400) && (insn & 15) == 15 && prefix_opcodep == NULL) |
2099 | 450d4ff5 | ths | { |
2100 | 450d4ff5 | ths | /* We're looking at [pc+], i.e. we need to output an immediate
|
2101 | 450d4ff5 | ths | number, where the size can depend on different things. */
|
2102 | 450d4ff5 | ths | long number;
|
2103 | 450d4ff5 | ths | int signedp
|
2104 | 450d4ff5 | ths | = ((*cs == 'z' && (insn & 0x20)) |
2105 | 450d4ff5 | ths | || opcodep->match == BDAP_QUICK_OPCODE); |
2106 | 450d4ff5 | ths | int nbytes;
|
2107 | 450d4ff5 | ths | |
2108 | 450d4ff5 | ths | if (opcodep->imm_oprnd_size == SIZE_FIX_32)
|
2109 | 450d4ff5 | ths | nbytes = 4;
|
2110 | 450d4ff5 | ths | else if (opcodep->imm_oprnd_size == SIZE_SPEC_REG) |
2111 | 450d4ff5 | ths | { |
2112 | 450d4ff5 | ths | const struct cris_spec_reg *sregp |
2113 | 450d4ff5 | ths | = spec_reg_info ((insn >> 12) & 15, disdata->distype); |
2114 | 450d4ff5 | ths | |
2115 | 450d4ff5 | ths | /* A NULL return should have been as a non-match earlier,
|
2116 | 450d4ff5 | ths | so catch it as an internal error in the error-case
|
2117 | 450d4ff5 | ths | below. */
|
2118 | 450d4ff5 | ths | if (sregp == NULL) |
2119 | 450d4ff5 | ths | /* Whatever non-valid size. */
|
2120 | 450d4ff5 | ths | nbytes = 42;
|
2121 | 450d4ff5 | ths | else
|
2122 | 450d4ff5 | ths | /* PC is always incremented by a multiple of two.
|
2123 | 450d4ff5 | ths | For CRISv32, immediates are always 4 bytes for
|
2124 | 450d4ff5 | ths | special registers. */
|
2125 | 450d4ff5 | ths | nbytes = disdata->distype == cris_dis_v32 |
2126 | 450d4ff5 | ths | ? 4 : (sregp->reg_size + 1) & ~1; |
2127 | 450d4ff5 | ths | } |
2128 | 450d4ff5 | ths | else
|
2129 | 450d4ff5 | ths | { |
2130 | 450d4ff5 | ths | int mode_size = 1 << ((insn >> 4) & (*cs == 'z' ? 1 : 3)); |
2131 | 450d4ff5 | ths | |
2132 | 450d4ff5 | ths | if (mode_size == 1) |
2133 | 450d4ff5 | ths | nbytes = 2;
|
2134 | 450d4ff5 | ths | else
|
2135 | 450d4ff5 | ths | nbytes = mode_size; |
2136 | 450d4ff5 | ths | } |
2137 | 450d4ff5 | ths | |
2138 | 450d4ff5 | ths | switch (nbytes)
|
2139 | 450d4ff5 | ths | { |
2140 | 450d4ff5 | ths | case 1: |
2141 | 450d4ff5 | ths | number = buffer[2];
|
2142 | 450d4ff5 | ths | if (signedp && number > 127) |
2143 | 450d4ff5 | ths | number -= 256;
|
2144 | 450d4ff5 | ths | break;
|
2145 | 450d4ff5 | ths | |
2146 | 450d4ff5 | ths | case 2: |
2147 | 450d4ff5 | ths | number = buffer[2] + buffer[3] * 256; |
2148 | 450d4ff5 | ths | if (signedp && number > 32767) |
2149 | 450d4ff5 | ths | number -= 65536;
|
2150 | 450d4ff5 | ths | break;
|
2151 | 450d4ff5 | ths | |
2152 | 450d4ff5 | ths | case 4: |
2153 | 450d4ff5 | ths | number |
2154 | 450d4ff5 | ths | = buffer[2] + buffer[3] * 256 + buffer[4] * 65536 |
2155 | 450d4ff5 | ths | + buffer[5] * 0x1000000; |
2156 | 450d4ff5 | ths | break;
|
2157 | 450d4ff5 | ths | |
2158 | 450d4ff5 | ths | default:
|
2159 | 450d4ff5 | ths | strcpy (tp, "bug");
|
2160 | 450d4ff5 | ths | tp += 3;
|
2161 | 450d4ff5 | ths | number = 42;
|
2162 | 450d4ff5 | ths | } |
2163 | 450d4ff5 | ths | |
2164 | 450d4ff5 | ths | if ((*cs == 'z' && (insn & 0x20)) |
2165 | 450d4ff5 | ths | || (opcodep->match == BDAP_QUICK_OPCODE |
2166 | 450d4ff5 | ths | && (nbytes <= 2 || buffer[1 + nbytes] == 0))) |
2167 | 450d4ff5 | ths | tp = format_dec (number, tp, signedp); |
2168 | 450d4ff5 | ths | else
|
2169 | 450d4ff5 | ths | { |
2170 | 450d4ff5 | ths | unsigned int highbyte = (number >> 24) & 0xff; |
2171 | 450d4ff5 | ths | |
2172 | 450d4ff5 | ths | /* Either output this as an address or as a number. If it's
|
2173 | 450d4ff5 | ths | a dword with the same high-byte as the address of the
|
2174 | 450d4ff5 | ths | insn, assume it's an address, and also if it's a non-zero
|
2175 | 450d4ff5 | ths | non-0xff high-byte. If this is a jsr or a jump, then
|
2176 | 450d4ff5 | ths | it's definitely an address. */
|
2177 | 450d4ff5 | ths | if (nbytes == 4 |
2178 | 450d4ff5 | ths | && (highbyte == ((addr >> 24) & 0xff) |
2179 | 450d4ff5 | ths | || (highbyte != 0 && highbyte != 0xff) |
2180 | 450d4ff5 | ths | || info->insn_type == dis_branch |
2181 | 450d4ff5 | ths | || info->insn_type == dis_jsr)) |
2182 | 450d4ff5 | ths | { |
2183 | 450d4ff5 | ths | /* Finish off and output previous formatted bytes. */
|
2184 | 450d4ff5 | ths | *tp = 0;
|
2185 | 450d4ff5 | ths | tp = temp; |
2186 | 450d4ff5 | ths | if (temp[0]) |
2187 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s", temp);
|
2188 | 450d4ff5 | ths | |
2189 | 450d4ff5 | ths | (*info->print_address_func) ((bfd_vma) number, info); |
2190 | 450d4ff5 | ths | |
2191 | 450d4ff5 | ths | info->target = number; |
2192 | 450d4ff5 | ths | } |
2193 | 450d4ff5 | ths | else
|
2194 | 450d4ff5 | ths | tp = format_hex (number, tp, disdata); |
2195 | 450d4ff5 | ths | } |
2196 | 450d4ff5 | ths | } |
2197 | 450d4ff5 | ths | else
|
2198 | 450d4ff5 | ths | { |
2199 | 450d4ff5 | ths | /* Not an immediate number. Then this is a (possibly
|
2200 | 450d4ff5 | ths | prefixed) memory operand. */
|
2201 | 450d4ff5 | ths | if (info->insn_type != dis_nonbranch)
|
2202 | 450d4ff5 | ths | { |
2203 | 450d4ff5 | ths | int mode_size
|
2204 | 450d4ff5 | ths | = 1 << ((insn >> 4) |
2205 | 450d4ff5 | ths | & (opcodep->args[0] == 'z' ? 1 : 3)); |
2206 | 450d4ff5 | ths | int size;
|
2207 | 450d4ff5 | ths | info->insn_type = dis_dref; |
2208 | 450d4ff5 | ths | info->flags |= CRIS_DIS_FLAG_MEMREF; |
2209 | 450d4ff5 | ths | |
2210 | 450d4ff5 | ths | if (opcodep->imm_oprnd_size == SIZE_FIX_32)
|
2211 | 450d4ff5 | ths | size = 4;
|
2212 | 450d4ff5 | ths | else if (opcodep->imm_oprnd_size == SIZE_SPEC_REG) |
2213 | 450d4ff5 | ths | { |
2214 | 450d4ff5 | ths | const struct cris_spec_reg *sregp |
2215 | 450d4ff5 | ths | = spec_reg_info ((insn >> 12) & 15, disdata->distype); |
2216 | 450d4ff5 | ths | |
2217 | 450d4ff5 | ths | /* FIXME: Improve error handling; should have been caught
|
2218 | 450d4ff5 | ths | earlier. */
|
2219 | 450d4ff5 | ths | if (sregp == NULL) |
2220 | 450d4ff5 | ths | size = 4;
|
2221 | 450d4ff5 | ths | else
|
2222 | 450d4ff5 | ths | size = sregp->reg_size; |
2223 | 450d4ff5 | ths | } |
2224 | 450d4ff5 | ths | else
|
2225 | 450d4ff5 | ths | size = mode_size; |
2226 | 450d4ff5 | ths | |
2227 | 450d4ff5 | ths | info->data_size = size; |
2228 | 450d4ff5 | ths | } |
2229 | 450d4ff5 | ths | |
2230 | 450d4ff5 | ths | *tp++ = '[';
|
2231 | 450d4ff5 | ths | |
2232 | 450d4ff5 | ths | if (prefix_opcodep
|
2233 | 450d4ff5 | ths | /* We don't match dip with a postincremented field
|
2234 | 450d4ff5 | ths | as a side-effect address mode. */
|
2235 | 450d4ff5 | ths | && ((insn & 0x400) == 0 |
2236 | 450d4ff5 | ths | || prefix_opcodep->match != DIP_OPCODE)) |
2237 | 450d4ff5 | ths | { |
2238 | 450d4ff5 | ths | if (insn & 0x400) |
2239 | 450d4ff5 | ths | { |
2240 | 450d4ff5 | ths | tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
|
2241 | 450d4ff5 | ths | *tp++ = '=';
|
2242 | 450d4ff5 | ths | } |
2243 | 450d4ff5 | ths | |
2244 | 450d4ff5 | ths | |
2245 | 450d4ff5 | ths | /* We mainly ignore the prefix format string when the
|
2246 | 450d4ff5 | ths | address-mode syntax is output. */
|
2247 | 450d4ff5 | ths | switch (prefix_opcodep->match)
|
2248 | 450d4ff5 | ths | { |
2249 | 450d4ff5 | ths | case DIP_OPCODE:
|
2250 | 450d4ff5 | ths | /* It's [r], [r+] or [pc+]. */
|
2251 | 450d4ff5 | ths | if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15) |
2252 | 450d4ff5 | ths | { |
2253 | 450d4ff5 | ths | /* It's [pc+]. This cannot possibly be anything
|
2254 | 450d4ff5 | ths | but an address. */
|
2255 | 450d4ff5 | ths | unsigned long number |
2256 | 450d4ff5 | ths | = prefix_buffer[2] + prefix_buffer[3] * 256 |
2257 | 450d4ff5 | ths | + prefix_buffer[4] * 65536 |
2258 | 450d4ff5 | ths | + prefix_buffer[5] * 0x1000000; |
2259 | 450d4ff5 | ths | |
2260 | 450d4ff5 | ths | info->target = (bfd_vma) number; |
2261 | 450d4ff5 | ths | |
2262 | 450d4ff5 | ths | /* Finish off and output previous formatted
|
2263 | 450d4ff5 | ths | data. */
|
2264 | 450d4ff5 | ths | *tp = 0;
|
2265 | 450d4ff5 | ths | tp = temp; |
2266 | 450d4ff5 | ths | if (temp[0]) |
2267 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s", temp);
|
2268 | 450d4ff5 | ths | |
2269 | 450d4ff5 | ths | (*info->print_address_func) ((bfd_vma) number, info); |
2270 | 450d4ff5 | ths | } |
2271 | 450d4ff5 | ths | else
|
2272 | 450d4ff5 | ths | { |
2273 | 450d4ff5 | ths | /* For a memref in an address, we use target2.
|
2274 | 450d4ff5 | ths | In this case, target is zero. */
|
2275 | 450d4ff5 | ths | info->flags |
2276 | 450d4ff5 | ths | |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG |
2277 | 450d4ff5 | ths | | CRIS_DIS_FLAG_MEM_TARGET2_MEM); |
2278 | 450d4ff5 | ths | |
2279 | 450d4ff5 | ths | info->target2 = prefix_insn & 15;
|
2280 | 450d4ff5 | ths | |
2281 | 450d4ff5 | ths | *tp++ = '[';
|
2282 | 450d4ff5 | ths | tp = format_reg (disdata, prefix_insn & 15, tp,
|
2283 | 450d4ff5 | ths | with_reg_prefix); |
2284 | 450d4ff5 | ths | if (prefix_insn & 0x400) |
2285 | 450d4ff5 | ths | *tp++ = '+';
|
2286 | 450d4ff5 | ths | *tp++ = ']';
|
2287 | 450d4ff5 | ths | } |
2288 | 450d4ff5 | ths | break;
|
2289 | 450d4ff5 | ths | |
2290 | 450d4ff5 | ths | case BDAP_QUICK_OPCODE:
|
2291 | 450d4ff5 | ths | { |
2292 | 450d4ff5 | ths | int number;
|
2293 | 450d4ff5 | ths | |
2294 | 450d4ff5 | ths | number = prefix_buffer[0];
|
2295 | 450d4ff5 | ths | if (number > 127) |
2296 | 450d4ff5 | ths | number -= 256;
|
2297 | 450d4ff5 | ths | |
2298 | 450d4ff5 | ths | /* Output "reg+num" or, if num < 0, "reg-num". */
|
2299 | 450d4ff5 | ths | tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp, |
2300 | 450d4ff5 | ths | with_reg_prefix); |
2301 | 450d4ff5 | ths | if (number >= 0) |
2302 | 450d4ff5 | ths | *tp++ = '+';
|
2303 | 450d4ff5 | ths | tp = format_dec (number, tp, 1);
|
2304 | 450d4ff5 | ths | |
2305 | 450d4ff5 | ths | info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG; |
2306 | 450d4ff5 | ths | info->target = (prefix_insn >> 12) & 15; |
2307 | 450d4ff5 | ths | info->target2 = (bfd_vma) number; |
2308 | 450d4ff5 | ths | break;
|
2309 | 450d4ff5 | ths | } |
2310 | 450d4ff5 | ths | |
2311 | 450d4ff5 | ths | case BIAP_OPCODE:
|
2312 | 450d4ff5 | ths | /* Output "r+R.m". */
|
2313 | 450d4ff5 | ths | tp = format_reg (disdata, prefix_insn & 15, tp,
|
2314 | 450d4ff5 | ths | with_reg_prefix); |
2315 | 450d4ff5 | ths | *tp++ = '+';
|
2316 | 450d4ff5 | ths | tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp, |
2317 | 450d4ff5 | ths | with_reg_prefix); |
2318 | 450d4ff5 | ths | *tp++ = '.';
|
2319 | 450d4ff5 | ths | *tp++ = mode_char[(prefix_insn >> 4) & 3]; |
2320 | 450d4ff5 | ths | |
2321 | 450d4ff5 | ths | info->flags |
2322 | 450d4ff5 | ths | |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG |
2323 | 450d4ff5 | ths | | CRIS_DIS_FLAG_MEM_TARGET_IS_REG |
2324 | 450d4ff5 | ths | |
2325 | 450d4ff5 | ths | | ((prefix_insn & 0x8000)
|
2326 | 450d4ff5 | ths | ? CRIS_DIS_FLAG_MEM_TARGET2_MULT4 |
2327 | 450d4ff5 | ths | : ((prefix_insn & 0x8000)
|
2328 | 450d4ff5 | ths | ? CRIS_DIS_FLAG_MEM_TARGET2_MULT2 : 0)));
|
2329 | 450d4ff5 | ths | |
2330 | 450d4ff5 | ths | /* Is it the casejump? It's a "adds.w [pc+r%d.w],pc". */
|
2331 | 450d4ff5 | ths | if (insn == 0xf83f && (prefix_insn & ~0xf000) == 0x55f) |
2332 | 450d4ff5 | ths | /* Then start interpreting data as offsets. */
|
2333 | 450d4ff5 | ths | case_offset_counter = no_of_case_offsets; |
2334 | 450d4ff5 | ths | break;
|
2335 | 450d4ff5 | ths | |
2336 | 450d4ff5 | ths | case BDAP_INDIR_OPCODE:
|
2337 | 450d4ff5 | ths | /* Output "r+s.m", or, if "s" is [pc+], "r+s" or
|
2338 | 450d4ff5 | ths | "r-s". */
|
2339 | 450d4ff5 | ths | tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp, |
2340 | 450d4ff5 | ths | with_reg_prefix); |
2341 | 450d4ff5 | ths | |
2342 | 450d4ff5 | ths | if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15) |
2343 | 450d4ff5 | ths | { |
2344 | 450d4ff5 | ths | long number;
|
2345 | 450d4ff5 | ths | unsigned int nbytes; |
2346 | 450d4ff5 | ths | |
2347 | 450d4ff5 | ths | /* It's a value. Get its size. */
|
2348 | 450d4ff5 | ths | int mode_size = 1 << ((prefix_insn >> 4) & 3); |
2349 | 450d4ff5 | ths | |
2350 | 450d4ff5 | ths | if (mode_size == 1) |
2351 | 450d4ff5 | ths | nbytes = 2;
|
2352 | 450d4ff5 | ths | else
|
2353 | 450d4ff5 | ths | nbytes = mode_size; |
2354 | 450d4ff5 | ths | |
2355 | 450d4ff5 | ths | switch (nbytes)
|
2356 | 450d4ff5 | ths | { |
2357 | 450d4ff5 | ths | case 1: |
2358 | 450d4ff5 | ths | number = prefix_buffer[2];
|
2359 | 450d4ff5 | ths | if (number > 127) |
2360 | 450d4ff5 | ths | number -= 256;
|
2361 | 450d4ff5 | ths | break;
|
2362 | 450d4ff5 | ths | |
2363 | 450d4ff5 | ths | case 2: |
2364 | 450d4ff5 | ths | number = prefix_buffer[2] + prefix_buffer[3] * 256; |
2365 | 450d4ff5 | ths | if (number > 32767) |
2366 | 450d4ff5 | ths | number -= 65536;
|
2367 | 450d4ff5 | ths | break;
|
2368 | 450d4ff5 | ths | |
2369 | 450d4ff5 | ths | case 4: |
2370 | 450d4ff5 | ths | number |
2371 | 450d4ff5 | ths | = prefix_buffer[2] + prefix_buffer[3] * 256 |
2372 | 450d4ff5 | ths | + prefix_buffer[4] * 65536 |
2373 | 450d4ff5 | ths | + prefix_buffer[5] * 0x1000000; |
2374 | 450d4ff5 | ths | break;
|
2375 | 450d4ff5 | ths | |
2376 | 450d4ff5 | ths | default:
|
2377 | 450d4ff5 | ths | strcpy (tp, "bug");
|
2378 | 450d4ff5 | ths | tp += 3;
|
2379 | 450d4ff5 | ths | number = 42;
|
2380 | 450d4ff5 | ths | } |
2381 | 450d4ff5 | ths | |
2382 | 450d4ff5 | ths | info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG; |
2383 | 450d4ff5 | ths | info->target2 = (bfd_vma) number; |
2384 | 450d4ff5 | ths | |
2385 | 450d4ff5 | ths | /* If the size is dword, then assume it's an
|
2386 | 450d4ff5 | ths | address. */
|
2387 | 450d4ff5 | ths | if (nbytes == 4) |
2388 | 450d4ff5 | ths | { |
2389 | 450d4ff5 | ths | /* Finish off and output previous formatted
|
2390 | 450d4ff5 | ths | bytes. */
|
2391 | 450d4ff5 | ths | *tp++ = '+';
|
2392 | 450d4ff5 | ths | *tp = 0;
|
2393 | 450d4ff5 | ths | tp = temp; |
2394 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s", temp);
|
2395 | 450d4ff5 | ths | |
2396 | 450d4ff5 | ths | (*info->print_address_func) ((bfd_vma) number, info); |
2397 | 450d4ff5 | ths | } |
2398 | 450d4ff5 | ths | else
|
2399 | 450d4ff5 | ths | { |
2400 | 450d4ff5 | ths | if (number >= 0) |
2401 | 450d4ff5 | ths | *tp++ = '+';
|
2402 | 450d4ff5 | ths | tp = format_dec (number, tp, 1);
|
2403 | 450d4ff5 | ths | } |
2404 | 450d4ff5 | ths | } |
2405 | 450d4ff5 | ths | else
|
2406 | 450d4ff5 | ths | { |
2407 | 450d4ff5 | ths | /* Output "r+[R].m" or "r+[R+].m". */
|
2408 | 450d4ff5 | ths | *tp++ = '+';
|
2409 | 450d4ff5 | ths | *tp++ = '[';
|
2410 | 450d4ff5 | ths | tp = format_reg (disdata, prefix_insn & 15, tp,
|
2411 | 450d4ff5 | ths | with_reg_prefix); |
2412 | 450d4ff5 | ths | if (prefix_insn & 0x400) |
2413 | 450d4ff5 | ths | *tp++ = '+';
|
2414 | 450d4ff5 | ths | *tp++ = ']';
|
2415 | 450d4ff5 | ths | *tp++ = '.';
|
2416 | 450d4ff5 | ths | *tp++ = mode_char[(prefix_insn >> 4) & 3]; |
2417 | 450d4ff5 | ths | |
2418 | 450d4ff5 | ths | info->flags |
2419 | 450d4ff5 | ths | |= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG |
2420 | 450d4ff5 | ths | | CRIS_DIS_FLAG_MEM_TARGET2_MEM |
2421 | 450d4ff5 | ths | | CRIS_DIS_FLAG_MEM_TARGET_IS_REG |
2422 | 450d4ff5 | ths | |
2423 | 450d4ff5 | ths | | (((prefix_insn >> 4) == 2) |
2424 | 450d4ff5 | ths | ? 0
|
2425 | 450d4ff5 | ths | : (((prefix_insn >> 4) & 3) == 1 |
2426 | 450d4ff5 | ths | ? CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD |
2427 | 450d4ff5 | ths | : CRIS_DIS_FLAG_MEM_TARGET2_MEM_BYTE))); |
2428 | 450d4ff5 | ths | } |
2429 | 450d4ff5 | ths | break;
|
2430 | 450d4ff5 | ths | |
2431 | 450d4ff5 | ths | default:
|
2432 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "?prefix-bug");
|
2433 | 450d4ff5 | ths | } |
2434 | 450d4ff5 | ths | |
2435 | 450d4ff5 | ths | /* To mark that the prefix is used, reset it. */
|
2436 | 450d4ff5 | ths | prefix_opcodep = NULL;
|
2437 | 450d4ff5 | ths | } |
2438 | 450d4ff5 | ths | else
|
2439 | 450d4ff5 | ths | { |
2440 | 450d4ff5 | ths | tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
|
2441 | 450d4ff5 | ths | |
2442 | 450d4ff5 | ths | info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG; |
2443 | 450d4ff5 | ths | info->target = insn & 15;
|
2444 | 450d4ff5 | ths | |
2445 | 450d4ff5 | ths | if (insn & 0x400) |
2446 | 450d4ff5 | ths | *tp++ = '+';
|
2447 | 450d4ff5 | ths | } |
2448 | 450d4ff5 | ths | *tp++ = ']';
|
2449 | 450d4ff5 | ths | } |
2450 | 450d4ff5 | ths | break;
|
2451 | 450d4ff5 | ths | |
2452 | 450d4ff5 | ths | case 'x': |
2453 | 450d4ff5 | ths | tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix); |
2454 | 450d4ff5 | ths | *tp++ = '.';
|
2455 | 450d4ff5 | ths | *tp++ = mode_char[(insn >> 4) & 3]; |
2456 | 450d4ff5 | ths | break;
|
2457 | 450d4ff5 | ths | |
2458 | 450d4ff5 | ths | case 'I': |
2459 | 450d4ff5 | ths | tp = format_dec (insn & 63, tp, 0); |
2460 | 450d4ff5 | ths | break;
|
2461 | 450d4ff5 | ths | |
2462 | 450d4ff5 | ths | case 'b': |
2463 | 450d4ff5 | ths | { |
2464 | 450d4ff5 | ths | int where = buffer[2] + buffer[3] * 256; |
2465 | 450d4ff5 | ths | |
2466 | 450d4ff5 | ths | if (where > 32767) |
2467 | 450d4ff5 | ths | where -= 65536;
|
2468 | 450d4ff5 | ths | |
2469 | 450d4ff5 | ths | where += addr + ((disdata->distype == cris_dis_v32) ? 0 : 4); |
2470 | 450d4ff5 | ths | |
2471 | 450d4ff5 | ths | if (insn == BA_PC_INCR_OPCODE)
|
2472 | 450d4ff5 | ths | info->insn_type = dis_branch; |
2473 | 450d4ff5 | ths | else
|
2474 | 450d4ff5 | ths | info->insn_type = dis_condbranch; |
2475 | 450d4ff5 | ths | |
2476 | 450d4ff5 | ths | info->target = (bfd_vma) where; |
2477 | 450d4ff5 | ths | |
2478 | 450d4ff5 | ths | *tp = 0;
|
2479 | 450d4ff5 | ths | tp = temp; |
2480 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s%s ",
|
2481 | 450d4ff5 | ths | temp, cris_cc_strings[insn >> 12]);
|
2482 | 450d4ff5 | ths | |
2483 | 450d4ff5 | ths | (*info->print_address_func) ((bfd_vma) where, info); |
2484 | 450d4ff5 | ths | } |
2485 | 450d4ff5 | ths | break;
|
2486 | 450d4ff5 | ths | |
2487 | 450d4ff5 | ths | case 'c': |
2488 | 450d4ff5 | ths | tp = format_dec (insn & 31, tp, 0); |
2489 | 450d4ff5 | ths | break;
|
2490 | 450d4ff5 | ths | |
2491 | 450d4ff5 | ths | case 'C': |
2492 | 450d4ff5 | ths | tp = format_dec (insn & 15, tp, 0); |
2493 | 450d4ff5 | ths | break;
|
2494 | 450d4ff5 | ths | |
2495 | 450d4ff5 | ths | case 'o': |
2496 | 450d4ff5 | ths | { |
2497 | 450d4ff5 | ths | long offset = insn & 0xfe; |
2498 | 450d4ff5 | ths | bfd_vma target; |
2499 | 450d4ff5 | ths | |
2500 | 450d4ff5 | ths | if (insn & 1) |
2501 | 450d4ff5 | ths | offset |= ~0xff;
|
2502 | 450d4ff5 | ths | |
2503 | 450d4ff5 | ths | if (opcodep->match == BA_QUICK_OPCODE)
|
2504 | 450d4ff5 | ths | info->insn_type = dis_branch; |
2505 | 450d4ff5 | ths | else
|
2506 | 450d4ff5 | ths | info->insn_type = dis_condbranch; |
2507 | 450d4ff5 | ths | |
2508 | 450d4ff5 | ths | target = addr + ((disdata->distype == cris_dis_v32) ? 0 : 2) + offset; |
2509 | 450d4ff5 | ths | info->target = target; |
2510 | 450d4ff5 | ths | *tp = 0;
|
2511 | 450d4ff5 | ths | tp = temp; |
2512 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s", temp);
|
2513 | 450d4ff5 | ths | (*info->print_address_func) (target, info); |
2514 | 450d4ff5 | ths | } |
2515 | 450d4ff5 | ths | break;
|
2516 | 450d4ff5 | ths | |
2517 | 450d4ff5 | ths | case 'Q': |
2518 | 450d4ff5 | ths | case 'O': |
2519 | 450d4ff5 | ths | { |
2520 | 450d4ff5 | ths | long number = buffer[0]; |
2521 | 450d4ff5 | ths | |
2522 | 450d4ff5 | ths | if (number > 127) |
2523 | 450d4ff5 | ths | number = number - 256;
|
2524 | 450d4ff5 | ths | |
2525 | 450d4ff5 | ths | tp = format_dec (number, tp, 1);
|
2526 | 450d4ff5 | ths | *tp++ = ',';
|
2527 | 450d4ff5 | ths | tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix); |
2528 | 450d4ff5 | ths | } |
2529 | 450d4ff5 | ths | break;
|
2530 | 450d4ff5 | ths | |
2531 | 450d4ff5 | ths | case 'f': |
2532 | 450d4ff5 | ths | tp = print_flags (disdata, insn, tp); |
2533 | 450d4ff5 | ths | break;
|
2534 | 450d4ff5 | ths | |
2535 | 450d4ff5 | ths | case 'i': |
2536 | 450d4ff5 | ths | tp = format_dec ((insn & 32) ? (insn & 31) | ~31L : insn & 31, tp, 1); |
2537 | 450d4ff5 | ths | break;
|
2538 | 450d4ff5 | ths | |
2539 | 450d4ff5 | ths | case 'P': |
2540 | 450d4ff5 | ths | { |
2541 | 450d4ff5 | ths | const struct cris_spec_reg *sregp |
2542 | 450d4ff5 | ths | = spec_reg_info ((insn >> 12) & 15, disdata->distype); |
2543 | 450d4ff5 | ths | |
2544 | 450d4ff5 | ths | if (sregp->name == NULL) |
2545 | 450d4ff5 | ths | /* Should have been caught as a non-match eariler. */
|
2546 | 450d4ff5 | ths | *tp++ = '?';
|
2547 | 450d4ff5 | ths | else
|
2548 | 450d4ff5 | ths | { |
2549 | 450d4ff5 | ths | if (with_reg_prefix)
|
2550 | 450d4ff5 | ths | *tp++ = REGISTER_PREFIX_CHAR; |
2551 | 450d4ff5 | ths | strcpy (tp, sregp->name); |
2552 | 450d4ff5 | ths | tp += strlen (tp); |
2553 | 450d4ff5 | ths | } |
2554 | 450d4ff5 | ths | } |
2555 | 450d4ff5 | ths | break;
|
2556 | 450d4ff5 | ths | |
2557 | 450d4ff5 | ths | default:
|
2558 | 450d4ff5 | ths | strcpy (tp, "???");
|
2559 | 450d4ff5 | ths | tp += 3;
|
2560 | 450d4ff5 | ths | } |
2561 | 450d4ff5 | ths | } |
2562 | 450d4ff5 | ths | |
2563 | 450d4ff5 | ths | *tp = 0;
|
2564 | 450d4ff5 | ths | |
2565 | 450d4ff5 | ths | if (prefix_opcodep)
|
2566 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, " (OOPS unused prefix \"%s: %s\")",
|
2567 | 450d4ff5 | ths | prefix_opcodep->name, prefix_opcodep->args); |
2568 | 450d4ff5 | ths | |
2569 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "%s", temp);
|
2570 | 450d4ff5 | ths | |
2571 | 450d4ff5 | ths | /* Get info for matching case-tables, if we don't have any active.
|
2572 | 450d4ff5 | ths | We assume that the last constant seen is used; either in the insn
|
2573 | 450d4ff5 | ths | itself or in a "move.d const,rN, sub.d rN,rM"-like sequence. */
|
2574 | 450d4ff5 | ths | if (TRACE_CASE && case_offset_counter == 0) |
2575 | 450d4ff5 | ths | { |
2576 | 450d4ff5 | ths | if (CONST_STRNEQ (opcodep->name, "sub")) |
2577 | 450d4ff5 | ths | case_offset = last_immediate; |
2578 | 450d4ff5 | ths | |
2579 | 450d4ff5 | ths | /* It could also be an "add", if there are negative case-values. */
|
2580 | 450d4ff5 | ths | else if (CONST_STRNEQ (opcodep->name, "add")) |
2581 | 450d4ff5 | ths | /* The first case is the negated operand to the add. */
|
2582 | 450d4ff5 | ths | case_offset = -last_immediate; |
2583 | 450d4ff5 | ths | |
2584 | 450d4ff5 | ths | /* A bound insn will tell us the number of cases. */
|
2585 | 450d4ff5 | ths | else if (CONST_STRNEQ (opcodep->name, "bound")) |
2586 | 450d4ff5 | ths | no_of_case_offsets = last_immediate + 1;
|
2587 | 450d4ff5 | ths | |
2588 | 450d4ff5 | ths | /* A jump or jsr or branch breaks the chain of insns for a
|
2589 | 450d4ff5 | ths | case-table, so assume default first-case again. */
|
2590 | 450d4ff5 | ths | else if (info->insn_type == dis_jsr |
2591 | 450d4ff5 | ths | || info->insn_type == dis_branch |
2592 | 450d4ff5 | ths | || info->insn_type == dis_condbranch) |
2593 | 450d4ff5 | ths | case_offset = 0;
|
2594 | 450d4ff5 | ths | } |
2595 | 450d4ff5 | ths | } |
2596 | 450d4ff5 | ths | |
2597 | 450d4ff5 | ths | |
2598 | 450d4ff5 | ths | /* Print the CRIS instruction at address memaddr on stream. Returns
|
2599 | 450d4ff5 | ths | length of the instruction, in bytes. Prefix register names with `$' if
|
2600 | 450d4ff5 | ths | WITH_REG_PREFIX. */
|
2601 | 450d4ff5 | ths | |
2602 | 450d4ff5 | ths | static int |
2603 | 450d4ff5 | ths | print_insn_cris_generic (bfd_vma memaddr, |
2604 | 450d4ff5 | ths | disassemble_info *info, |
2605 | 450d4ff5 | ths | bfd_boolean with_reg_prefix) |
2606 | 450d4ff5 | ths | { |
2607 | 450d4ff5 | ths | int nbytes;
|
2608 | 450d4ff5 | ths | unsigned int insn; |
2609 | 450d4ff5 | ths | const struct cris_opcode *matchedp; |
2610 | 450d4ff5 | ths | int advance = 0; |
2611 | 450d4ff5 | ths | struct cris_disasm_data *disdata
|
2612 | 450d4ff5 | ths | = (struct cris_disasm_data *) info->private_data;
|
2613 | 450d4ff5 | ths | |
2614 | 450d4ff5 | ths | /* No instruction will be disassembled as longer than this number of
|
2615 | 450d4ff5 | ths | bytes; stacked prefixes will not be expanded. */
|
2616 | 450d4ff5 | ths | unsigned char buffer[MAX_BYTES_PER_CRIS_INSN]; |
2617 | 450d4ff5 | ths | unsigned char *bufp; |
2618 | 450d4ff5 | ths | int status = 0; |
2619 | 450d4ff5 | ths | bfd_vma addr; |
2620 | 450d4ff5 | ths | |
2621 | 450d4ff5 | ths | /* There will be an "out of range" error after the last instruction.
|
2622 | 450d4ff5 | ths | Reading pairs of bytes in decreasing number, we hope that we will get
|
2623 | 450d4ff5 | ths | at least the amount that we will consume.
|
2624 | 450d4ff5 | ths | |
2625 | 450d4ff5 | ths | If we can't get any data, or we do not get enough data, we print
|
2626 | 450d4ff5 | ths | the error message. */
|
2627 | 450d4ff5 | ths | |
2628 | bfaf9a43 | edgar_igl | nbytes = info->buffer_length; |
2629 | bfaf9a43 | edgar_igl | if (nbytes > MAX_BYTES_PER_CRIS_INSN)
|
2630 | bfaf9a43 | edgar_igl | nbytes = MAX_BYTES_PER_CRIS_INSN; |
2631 | bfaf9a43 | edgar_igl | status = (*info->read_memory_func) (memaddr, buffer, nbytes, info); |
2632 | 450d4ff5 | ths | |
2633 | 450d4ff5 | ths | /* If we did not get all we asked for, then clear the rest.
|
2634 | 450d4ff5 | ths | Hopefully this makes a reproducible result in case of errors. */
|
2635 | 450d4ff5 | ths | if (nbytes != MAX_BYTES_PER_CRIS_INSN)
|
2636 | 450d4ff5 | ths | memset (buffer + nbytes, 0, MAX_BYTES_PER_CRIS_INSN - nbytes);
|
2637 | 450d4ff5 | ths | |
2638 | 450d4ff5 | ths | addr = memaddr; |
2639 | 450d4ff5 | ths | bufp = buffer; |
2640 | 450d4ff5 | ths | |
2641 | 450d4ff5 | ths | /* Set some defaults for the insn info. */
|
2642 | 450d4ff5 | ths | info->insn_info_valid = 1;
|
2643 | 450d4ff5 | ths | info->branch_delay_insns = 0;
|
2644 | 450d4ff5 | ths | info->data_size = 0;
|
2645 | 450d4ff5 | ths | info->insn_type = dis_nonbranch; |
2646 | 450d4ff5 | ths | info->flags = 0;
|
2647 | 450d4ff5 | ths | info->target = 0;
|
2648 | 450d4ff5 | ths | info->target2 = 0;
|
2649 | 450d4ff5 | ths | |
2650 | 450d4ff5 | ths | /* If we got any data, disassemble it. */
|
2651 | 450d4ff5 | ths | if (nbytes != 0) |
2652 | 450d4ff5 | ths | { |
2653 | 450d4ff5 | ths | matchedp = NULL;
|
2654 | 450d4ff5 | ths | |
2655 | 450d4ff5 | ths | insn = bufp[0] + bufp[1] * 256; |
2656 | 450d4ff5 | ths | |
2657 | 450d4ff5 | ths | /* If we're in a case-table, don't disassemble the offsets. */
|
2658 | 450d4ff5 | ths | if (TRACE_CASE && case_offset_counter != 0) |
2659 | 450d4ff5 | ths | { |
2660 | 450d4ff5 | ths | info->insn_type = dis_noninsn; |
2661 | 450d4ff5 | ths | advance += 2;
|
2662 | 450d4ff5 | ths | |
2663 | 450d4ff5 | ths | /* If to print data as offsets, then shortcut here. */
|
2664 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "case %ld%s: -> ",
|
2665 | 450d4ff5 | ths | case_offset + no_of_case_offsets |
2666 | 450d4ff5 | ths | - case_offset_counter, |
2667 | 450d4ff5 | ths | case_offset_counter == 1 ? "/default" : |
2668 | 450d4ff5 | ths | "");
|
2669 | 450d4ff5 | ths | |
2670 | 450d4ff5 | ths | (*info->print_address_func) ((bfd_vma) |
2671 | 450d4ff5 | ths | ((short) (insn)
|
2672 | 450d4ff5 | ths | + (long) (addr
|
2673 | 450d4ff5 | ths | - (no_of_case_offsets |
2674 | 450d4ff5 | ths | - case_offset_counter) |
2675 | 450d4ff5 | ths | * 2)), info);
|
2676 | 450d4ff5 | ths | case_offset_counter--; |
2677 | 450d4ff5 | ths | |
2678 | 450d4ff5 | ths | /* The default case start (without a "sub" or "add") must be
|
2679 | 450d4ff5 | ths | zero. */
|
2680 | 450d4ff5 | ths | if (case_offset_counter == 0) |
2681 | 450d4ff5 | ths | case_offset = 0;
|
2682 | 450d4ff5 | ths | } |
2683 | 450d4ff5 | ths | else if (insn == 0) |
2684 | 450d4ff5 | ths | { |
2685 | 450d4ff5 | ths | /* We're often called to disassemble zeroes. While this is a
|
2686 | 450d4ff5 | ths | valid "bcc .+2" insn, it is also useless enough and enough
|
2687 | 450d4ff5 | ths | of a nuiscance that we will just output "bcc .+2" for it
|
2688 | 450d4ff5 | ths | and signal it as a noninsn. */
|
2689 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, |
2690 | 450d4ff5 | ths | disdata->distype == cris_dis_v32 |
2691 | 450d4ff5 | ths | ? "bcc ." : "bcc .+2"); |
2692 | 450d4ff5 | ths | info->insn_type = dis_noninsn; |
2693 | 450d4ff5 | ths | advance += 2;
|
2694 | 450d4ff5 | ths | } |
2695 | 450d4ff5 | ths | else
|
2696 | 450d4ff5 | ths | { |
2697 | 450d4ff5 | ths | const struct cris_opcode *prefix_opcodep = NULL; |
2698 | 450d4ff5 | ths | unsigned char *prefix_buffer = bufp; |
2699 | 450d4ff5 | ths | unsigned int prefix_insn = insn; |
2700 | 450d4ff5 | ths | int prefix_size = 0; |
2701 | 450d4ff5 | ths | |
2702 | 450d4ff5 | ths | matchedp = get_opcode_entry (insn, NO_CRIS_PREFIX, disdata); |
2703 | 450d4ff5 | ths | |
2704 | 450d4ff5 | ths | /* Check if we're supposed to write out prefixes as address
|
2705 | 450d4ff5 | ths | modes and if this was a prefix. */
|
2706 | 450d4ff5 | ths | if (matchedp != NULL && PARSE_PREFIX && matchedp->args[0] == 'p') |
2707 | 450d4ff5 | ths | { |
2708 | 450d4ff5 | ths | /* If it's a prefix, put it into the prefix vars and get the
|
2709 | 450d4ff5 | ths | main insn. */
|
2710 | 450d4ff5 | ths | prefix_size = bytes_to_skip (prefix_insn, matchedp, |
2711 | 450d4ff5 | ths | disdata->distype, NULL);
|
2712 | 450d4ff5 | ths | prefix_opcodep = matchedp; |
2713 | 450d4ff5 | ths | |
2714 | 450d4ff5 | ths | insn = bufp[prefix_size] + bufp[prefix_size + 1] * 256; |
2715 | 450d4ff5 | ths | matchedp = get_opcode_entry (insn, prefix_insn, disdata); |
2716 | 450d4ff5 | ths | |
2717 | 450d4ff5 | ths | if (matchedp != NULL) |
2718 | 450d4ff5 | ths | { |
2719 | 450d4ff5 | ths | addr += prefix_size; |
2720 | 450d4ff5 | ths | bufp += prefix_size; |
2721 | 450d4ff5 | ths | advance += prefix_size; |
2722 | 450d4ff5 | ths | } |
2723 | 450d4ff5 | ths | else
|
2724 | 450d4ff5 | ths | { |
2725 | 450d4ff5 | ths | /* The "main" insn wasn't valid, at least not when
|
2726 | 450d4ff5 | ths | prefixed. Put back things enough to output the
|
2727 | 450d4ff5 | ths | prefix insn only, as a normal insn. */
|
2728 | 450d4ff5 | ths | matchedp = prefix_opcodep; |
2729 | 450d4ff5 | ths | insn = prefix_insn; |
2730 | 450d4ff5 | ths | prefix_opcodep = NULL;
|
2731 | 450d4ff5 | ths | } |
2732 | 450d4ff5 | ths | } |
2733 | 450d4ff5 | ths | |
2734 | 450d4ff5 | ths | if (matchedp == NULL) |
2735 | 450d4ff5 | ths | { |
2736 | 450d4ff5 | ths | (*info->fprintf_func) (info->stream, "??0x%x", insn);
|
2737 | 450d4ff5 | ths | advance += 2;
|
2738 | 450d4ff5 | ths | |
2739 | 450d4ff5 | ths | info->insn_type = dis_noninsn; |
2740 | 450d4ff5 | ths | } |
2741 | 450d4ff5 | ths | else
|
2742 | 450d4ff5 | ths | { |
2743 | 450d4ff5 | ths | advance |
2744 | 450d4ff5 | ths | += bytes_to_skip (insn, matchedp, disdata->distype, |
2745 | 450d4ff5 | ths | prefix_opcodep); |
2746 | 450d4ff5 | ths | |
2747 | 450d4ff5 | ths | /* The info_type and assorted fields will be set according
|
2748 | 450d4ff5 | ths | to the operands. */
|
2749 | 450d4ff5 | ths | print_with_operands (matchedp, insn, bufp, addr, info, |
2750 | 450d4ff5 | ths | prefix_opcodep, prefix_insn, |
2751 | 450d4ff5 | ths | prefix_buffer, with_reg_prefix); |
2752 | 450d4ff5 | ths | } |
2753 | 450d4ff5 | ths | } |
2754 | 450d4ff5 | ths | } |
2755 | 450d4ff5 | ths | else
|
2756 | 450d4ff5 | ths | info->insn_type = dis_noninsn; |
2757 | 450d4ff5 | ths | |
2758 | 450d4ff5 | ths | /* If we read less than MAX_BYTES_PER_CRIS_INSN, i.e. we got an error
|
2759 | 450d4ff5 | ths | status when reading that much, and the insn decoding indicated a
|
2760 | 450d4ff5 | ths | length exceeding what we read, there is an error. */
|
2761 | 450d4ff5 | ths | if (status != 0 && (nbytes == 0 || advance > nbytes)) |
2762 | 450d4ff5 | ths | { |
2763 | 450d4ff5 | ths | (*info->memory_error_func) (status, memaddr, info); |
2764 | 450d4ff5 | ths | return -1; |
2765 | 450d4ff5 | ths | } |
2766 | 450d4ff5 | ths | |
2767 | 450d4ff5 | ths | /* Max supported insn size with one folded prefix insn. */
|
2768 | 450d4ff5 | ths | info->bytes_per_line = MAX_BYTES_PER_CRIS_INSN; |
2769 | 450d4ff5 | ths | |
2770 | 450d4ff5 | ths | /* I would like to set this to a fixed value larger than the actual
|
2771 | 450d4ff5 | ths | number of bytes to print in order to avoid spaces between bytes,
|
2772 | 450d4ff5 | ths | but objdump.c (2.9.1) does not like that, so we print 16-bit
|
2773 | 450d4ff5 | ths | chunks, which is the next choice. */
|
2774 | 450d4ff5 | ths | info->bytes_per_chunk = 2;
|
2775 | 450d4ff5 | ths | |
2776 | 450d4ff5 | ths | /* Printing bytes in order of increasing addresses makes sense,
|
2777 | 450d4ff5 | ths | especially on a little-endian target.
|
2778 | 450d4ff5 | ths | This is completely the opposite of what you think; setting this to
|
2779 | 450d4ff5 | ths | BFD_ENDIAN_LITTLE will print bytes in order N..0 rather than the 0..N
|
2780 | 450d4ff5 | ths | we want. */
|
2781 | 450d4ff5 | ths | info->display_endian = BFD_ENDIAN_BIG; |
2782 | 450d4ff5 | ths | |
2783 | 450d4ff5 | ths | return advance;
|
2784 | 450d4ff5 | ths | } |
2785 | 450d4ff5 | ths | |
2786 | 450d4ff5 | ths | /* Disassemble, prefixing register names with `$'. CRIS v0..v10. */
|
2787 | 450d4ff5 | ths | #if 0
|
2788 | 450d4ff5 | ths | static int
|
2789 | 450d4ff5 | ths | print_insn_cris_with_register_prefix (bfd_vma vma,
|
2790 | 450d4ff5 | ths | disassemble_info *info)
|
2791 | 450d4ff5 | ths | {
|
2792 | 450d4ff5 | ths | if (info->private_data == NULL
|
2793 | 450d4ff5 | ths | && !cris_parse_disassembler_options (info, cris_dis_v0_v10))
|
2794 | 450d4ff5 | ths | return -1;
|
2795 | 450d4ff5 | ths | return print_insn_cris_generic (vma, info, TRUE);
|
2796 | 450d4ff5 | ths | }
|
2797 | 450d4ff5 | ths | #endif
|
2798 | 450d4ff5 | ths | /* Disassemble, prefixing register names with `$'. CRIS v32. */
|
2799 | 450d4ff5 | ths | |
2800 | 450d4ff5 | ths | static int |
2801 | 450d4ff5 | ths | print_insn_crisv32_with_register_prefix (bfd_vma vma, |
2802 | 450d4ff5 | ths | disassemble_info *info) |
2803 | 450d4ff5 | ths | { |
2804 | 450d4ff5 | ths | if (info->private_data == NULL |
2805 | 450d4ff5 | ths | && !cris_parse_disassembler_options (info, cris_dis_v32)) |
2806 | 450d4ff5 | ths | return -1; |
2807 | 450d4ff5 | ths | return print_insn_cris_generic (vma, info, TRUE);
|
2808 | 450d4ff5 | ths | } |
2809 | 450d4ff5 | ths | |
2810 | 450d4ff5 | ths | #if 0
|
2811 | 450d4ff5 | ths | /* Disassemble, prefixing register names with `$'.
|
2812 | 450d4ff5 | ths | Common v10 and v32 subset. */
|
2813 | 450d4ff5 | ths | |
2814 | 450d4ff5 | ths | static int
|
2815 | 450d4ff5 | ths | print_insn_crisv10_v32_with_register_prefix (bfd_vma vma,
|
2816 | 450d4ff5 | ths | disassemble_info *info)
|
2817 | 450d4ff5 | ths | {
|
2818 | 450d4ff5 | ths | if (info->private_data == NULL
|
2819 | 450d4ff5 | ths | && !cris_parse_disassembler_options (info, cris_dis_common_v10_v32))
|
2820 | 450d4ff5 | ths | return -1;
|
2821 | 450d4ff5 | ths | return print_insn_cris_generic (vma, info, TRUE);
|
2822 | 450d4ff5 | ths | }
|
2823 | 450d4ff5 | ths | |
2824 | 450d4ff5 | ths | /* Disassemble, no prefixes on register names. CRIS v0..v10. */
|
2825 | 450d4ff5 | ths | |
2826 | 450d4ff5 | ths | static int
|
2827 | 450d4ff5 | ths | print_insn_cris_without_register_prefix (bfd_vma vma,
|
2828 | 450d4ff5 | ths | disassemble_info *info)
|
2829 | 450d4ff5 | ths | {
|
2830 | 450d4ff5 | ths | if (info->private_data == NULL
|
2831 | 450d4ff5 | ths | && !cris_parse_disassembler_options (info, cris_dis_v0_v10))
|
2832 | 450d4ff5 | ths | return -1;
|
2833 | 450d4ff5 | ths | return print_insn_cris_generic (vma, info, FALSE);
|
2834 | 450d4ff5 | ths | }
|
2835 | 450d4ff5 | ths | |
2836 | 450d4ff5 | ths | /* Disassemble, no prefixes on register names. CRIS v32. */
|
2837 | 450d4ff5 | ths | |
2838 | 450d4ff5 | ths | static int
|
2839 | 450d4ff5 | ths | print_insn_crisv32_without_register_prefix (bfd_vma vma,
|
2840 | 450d4ff5 | ths | disassemble_info *info)
|
2841 | 450d4ff5 | ths | {
|
2842 | 450d4ff5 | ths | if (info->private_data == NULL
|
2843 | 450d4ff5 | ths | && !cris_parse_disassembler_options (info, cris_dis_v32))
|
2844 | 450d4ff5 | ths | return -1;
|
2845 | 450d4ff5 | ths | return print_insn_cris_generic (vma, info, FALSE);
|
2846 | 450d4ff5 | ths | }
|
2847 | 450d4ff5 | ths | |
2848 | 450d4ff5 | ths | /* Disassemble, no prefixes on register names.
|
2849 | 450d4ff5 | ths | Common v10 and v32 subset. */
|
2850 | 450d4ff5 | ths | |
2851 | 450d4ff5 | ths | static int
|
2852 | 450d4ff5 | ths | print_insn_crisv10_v32_without_register_prefix (bfd_vma vma,
|
2853 | 450d4ff5 | ths | disassemble_info *info)
|
2854 | 450d4ff5 | ths | {
|
2855 | 450d4ff5 | ths | if (info->private_data == NULL
|
2856 | 450d4ff5 | ths | && !cris_parse_disassembler_options (info, cris_dis_common_v10_v32))
|
2857 | 450d4ff5 | ths | return -1;
|
2858 | 450d4ff5 | ths | return print_insn_cris_generic (vma, info, FALSE);
|
2859 | 450d4ff5 | ths | }
|
2860 | 450d4ff5 | ths | #endif
|
2861 | 450d4ff5 | ths | |
2862 | 450d4ff5 | ths | int
|
2863 | 450d4ff5 | ths | print_insn_crisv32 (bfd_vma vma, |
2864 | 450d4ff5 | ths | disassemble_info *info) |
2865 | 450d4ff5 | ths | { |
2866 | 450d4ff5 | ths | return print_insn_crisv32_with_register_prefix(vma, info);
|
2867 | 450d4ff5 | ths | } |
2868 | 450d4ff5 | ths | |
2869 | 450d4ff5 | ths | /* Return a disassembler-function that prints registers with a `$' prefix,
|
2870 | 450d4ff5 | ths | or one that prints registers without a prefix.
|
2871 | 450d4ff5 | ths | FIXME: We should improve the solution to avoid the multitude of
|
2872 | 450d4ff5 | ths | functions seen above. */
|
2873 | 450d4ff5 | ths | #if 0
|
2874 | 450d4ff5 | ths | disassembler_ftype
|
2875 | 450d4ff5 | ths | cris_get_disassembler (bfd *abfd)
|
2876 | 450d4ff5 | ths | {
|
2877 | 450d4ff5 | ths | /* If there's no bfd in sight, we return what is valid as input in all
|
2878 | 450d4ff5 | ths | contexts if fed back to the assembler: disassembly *with* register
|
2879 | 450d4ff5 | ths | prefix. Unfortunately this will be totally wrong for v32. */
|
2880 | 450d4ff5 | ths | if (abfd == NULL)
|
2881 | 450d4ff5 | ths | return print_insn_cris_with_register_prefix;
|
2882 | 450d4ff5 | ths | |
2883 | 450d4ff5 | ths | if (bfd_get_symbol_leading_char (abfd) == 0)
|
2884 | 450d4ff5 | ths | {
|
2885 | 450d4ff5 | ths | if (bfd_get_mach (abfd) == bfd_mach_cris_v32)
|
2886 | 450d4ff5 | ths | return print_insn_crisv32_with_register_prefix;
|
2887 | 450d4ff5 | ths | if (bfd_get_mach (abfd) == bfd_mach_cris_v10_v32)
|
2888 | 450d4ff5 | ths | return print_insn_crisv10_v32_with_register_prefix;
|
2889 | 450d4ff5 | ths | |
2890 | 450d4ff5 | ths | /* We default to v10. This may be specifically specified in the
|
2891 | 450d4ff5 | ths | bfd mach, but is also the default setting. */
|
2892 | 450d4ff5 | ths | return print_insn_cris_with_register_prefix;
|
2893 | 450d4ff5 | ths | }
|
2894 | 450d4ff5 | ths | |
2895 | 450d4ff5 | ths | if (bfd_get_mach (abfd) == bfd_mach_cris_v32)
|
2896 | 450d4ff5 | ths | return print_insn_crisv32_without_register_prefix;
|
2897 | 450d4ff5 | ths | if (bfd_get_mach (abfd) == bfd_mach_cris_v10_v32)
|
2898 | 450d4ff5 | ths | return print_insn_crisv10_v32_without_register_prefix;
|
2899 | 450d4ff5 | ths | return print_insn_cris_without_register_prefix;
|
2900 | 450d4ff5 | ths | }
|
2901 | 450d4ff5 | ths | #endif
|
2902 | 450d4ff5 | ths | /* Local variables:
|
2903 | 450d4ff5 | ths | eval: (c-set-style "gnu")
|
2904 | 450d4ff5 | ths | indent-tabs-mode: t
|
2905 | 450d4ff5 | ths | End: */ |