1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef __CRIS_H_INCLUDED_
23#define __CRIS_H_INCLUDED_
24
25#if !defined(__STDC__) && !defined(const)
26#define const
27#endif
28
29
30
31#define MAX_REG (15)
32#define REG_SP (14)
33#define REG_PC (15)
34
35
36
37
38enum cris_insn_version_usage
39{
40
41 cris_ver_version_all=0,
42
43
44 cris_ver_warning,
45
46
47 cris_ver_v0_3,
48
49
50 cris_ver_v3p,
51
52
53 cris_ver_v8,
54
55
56 cris_ver_v8p,
57
58
59 cris_ver_sim_v0_10,
60
61
62 cris_ver_v0_10,
63
64
65 cris_ver_v3_10,
66
67
68 cris_ver_v8_10,
69
70
71 cris_ver_v10,
72
73
74 cris_ver_v10p,
75
76
77
78
79 cris_ver_v32p
80};
81
82
83
84struct cris_spec_reg
85{
86 const char *const name;
87 unsigned int number;
88
89
90 unsigned int reg_size;
91
92
93
94 enum cris_insn_version_usage applicable_version;
95
96
97
98 const char *const warning;
99};
100extern const struct cris_spec_reg cris_spec_regs[];
101
102
103
104struct cris_support_reg
105{
106 const char *const name;
107 unsigned int number;
108};
109extern const struct cris_support_reg cris_support_regs[];
110
111struct cris_cond15
112{
113
114 const char *const name;
115
116
117 enum cris_insn_version_usage applicable_version;
118};
119extern const struct cris_cond15 cris_conds15[];
120
121
122#define AUTOINCR_BIT (0x04)
123
124
125#define BDAP_QUICK_OPCODE (0x0100)
126#define BDAP_QUICK_Z_BITS (0x0e00)
127
128#define BIAP_OPCODE (0x0540)
129#define BIAP_Z_BITS (0x0a80)
130
131#define DIP_OPCODE (0x0970)
132#define DIP_Z_BITS (0xf280)
133
134#define BDAP_INDIR_LOW (0x40)
135#define BDAP_INDIR_LOW_Z (0x80)
136#define BDAP_INDIR_HIGH (0x09)
137#define BDAP_INDIR_HIGH_Z (0x02)
138
139#define BDAP_INDIR_OPCODE (BDAP_INDIR_HIGH * 0x0100 + BDAP_INDIR_LOW)
140#define BDAP_INDIR_Z_BITS (BDAP_INDIR_HIGH_Z * 0x100 + BDAP_INDIR_LOW_Z)
141#define BDAP_PC_LOW (BDAP_INDIR_LOW + REG_PC)
142#define BDAP_INCR_HIGH (BDAP_INDIR_HIGH + AUTOINCR_BIT)
143
144
145
146#define NO_CRIS_PREFIX 0
147
148
149#define CC_CC 0x0
150#define CC_HS 0x0
151#define CC_CS 0x1
152#define CC_LO 0x1
153#define CC_NE 0x2
154#define CC_EQ 0x3
155#define CC_VC 0x4
156#define CC_VS 0x5
157#define CC_PL 0x6
158#define CC_MI 0x7
159#define CC_LS 0x8
160#define CC_HI 0x9
161#define CC_GE 0xA
162#define CC_LT 0xB
163#define CC_GT 0xC
164#define CC_LE 0xD
165#define CC_A 0xE
166#define CC_EXT 0xF
167
168
169
170extern const char *const cris_cc_strings[];
171
172
173#define BRANCH_QUICK_LOW (0)
174#define BRANCH_QUICK_HIGH (0)
175#define BRANCH_QUICK_OPCODE (BRANCH_QUICK_HIGH * 0x0100 + BRANCH_QUICK_LOW)
176#define BRANCH_QUICK_Z_BITS (0x0F00)
177
178
179#define BA_QUICK_HIGH (BRANCH_QUICK_HIGH + CC_A * 0x10)
180#define BA_QUICK_OPCODE (BA_QUICK_HIGH * 0x100 + BRANCH_QUICK_LOW)
181
182
183#define BRANCH_PC_LOW (0xFF)
184#define BRANCH_INCR_HIGH (0x0D)
185#define BA_PC_INCR_OPCODE \
186 ((BRANCH_INCR_HIGH + CC_A * 0x10) * 0x0100 + BRANCH_PC_LOW)
187
188
189
190
191
192#define JUMP_INDIR_OPCODE (0x0930)
193#define JUMP_INDIR_Z_BITS (0xf2c0)
194#define JUMP_PC_INCR_OPCODE \
195 (JUMP_INDIR_OPCODE + AUTOINCR_BIT * 0x0100 + REG_PC)
196
197#define MOVE_M_TO_PREG_OPCODE 0x0a30
198#define MOVE_M_TO_PREG_ZBITS 0x01c0
199
200
201#define MOVE_PC_INCR_OPCODE_PREFIX \
202 (((BDAP_INCR_HIGH | (REG_PC << 4)) << 8) | BDAP_PC_LOW | (2 << 4))
203#define MOVE_PC_INCR_OPCODE_SUFFIX \
204 (MOVE_M_TO_PREG_OPCODE | REG_PC | (AUTOINCR_BIT << 8))
205
206#define JUMP_PC_INCR_OPCODE_V32 (0x0DBF)
207
208
209#define BA_DWORD_OPCODE (0x0EBF)
210
211
212#define NOP_OPCODE (0x050F)
213#define NOP_Z_BITS (0xFFFF ^ NOP_OPCODE)
214
215#define NOP_OPCODE_V32 (0x05B0)
216#define NOP_Z_BITS_V32 (0xFFFF ^ NOP_OPCODE_V32)
217
218
219
220
221
222#define NOP_OPCODE_COMMON (0x630)
223#define NOP_OPCODE_ZBITS_COMMON (0xffff & ~NOP_OPCODE_COMMON)
224
225
226#define LAPC_DWORD_OPCODE (0x0D7F)
227#define LAPC_DWORD_Z_BITS (0x0fff & ~LAPC_DWORD_OPCODE)
228
229
230enum cris_imm_oprnd_size_type
231{
232
233 SIZE_NONE,
234
235
236 SIZE_FIX_32,
237
238
239 SIZE_SPEC_REG,
240
241
242 SIZE_FIELD_SIGNED,
243
244
245 SIZE_FIELD_UNSIGNED,
246
247
248 SIZE_FIELD
249};
250
251
252
253enum cris_op_type
254{
255 cris_not_implemented_op = 0,
256 cris_abs_op,
257 cris_addi_op,
258 cris_asr_op,
259 cris_asrq_op,
260 cris_ax_ei_setf_op,
261 cris_bdap_prefix,
262 cris_biap_prefix,
263 cris_break_op,
264 cris_btst_nop_op,
265 cris_clearf_di_op,
266 cris_dip_prefix,
267 cris_dstep_logshift_mstep_neg_not_op,
268 cris_eight_bit_offset_branch_op,
269 cris_move_mem_to_reg_movem_op,
270 cris_move_reg_to_mem_movem_op,
271 cris_move_to_preg_op,
272 cris_muls_op,
273 cris_mulu_op,
274 cris_none_reg_mode_add_sub_cmp_and_or_move_op,
275 cris_none_reg_mode_clear_test_op,
276 cris_none_reg_mode_jump_op,
277 cris_none_reg_mode_move_from_preg_op,
278 cris_quick_mode_add_sub_op,
279 cris_quick_mode_and_cmp_move_or_op,
280 cris_quick_mode_bdap_prefix,
281 cris_reg_mode_add_sub_cmp_and_or_move_op,
282 cris_reg_mode_clear_op,
283 cris_reg_mode_jump_op,
284 cris_reg_mode_move_from_preg_op,
285 cris_reg_mode_test_op,
286 cris_scc_op,
287 cris_sixteen_bit_offset_branch_op,
288 cris_three_operand_add_sub_cmp_and_or_op,
289 cris_three_operand_bound_op,
290 cris_two_operand_bound_op,
291 cris_xor_op
292};
293
294struct cris_opcode
295{
296
297 const char *name;
298
299
300 unsigned int match;
301
302
303 unsigned int lose;
304
305
306 const char *args;
307
308
309 char delayed;
310
311
312 enum cris_imm_oprnd_size_type imm_oprnd_size;
313
314
315 enum cris_insn_version_usage applicable_version;
316
317
318 enum cris_op_type op;
319};
320extern const struct cris_opcode cris_opcodes[];
321
322
323
324
325
326
327
328
329#define CRIS_DIS_FLAG_MEMREF (1 << 0)
330
331
332#define CRIS_DIS_FLAG_MEM_TARGET_IS_REG (1 << 1)
333
334
335#define CRIS_DIS_FLAG_MEM_TARGET2_IS_REG (1 << 2)
336
337
338
339#define CRIS_DIS_FLAG_MEM_TARGET2_MULT2 (1 << 3)
340
341
342
343#define CRIS_DIS_FLAG_MEM_TARGET2_MULT4 (1 << 4)
344
345
346
347
348#define CRIS_DIS_FLAG_MEM_TARGET2_MEM (1 << 5)
349
350
351
352#define CRIS_DIS_FLAG_MEM_TARGET2_MEM_BYTE (1 << 6)
353
354
355
356#define CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD (1 << 7)
357
358#endif
359
360
361
362
363
364
365
366