-static int lookup_opcode PARAMS ((struct d30v_insn *insn, long num, int is_long));
-static void print_insn PARAMS ((struct disassemble_info *info, bfd_vma memaddr, long long num,
- struct d30v_insn *insn, int is_long, int show_ext));
-static int extract_value PARAMS ((long long num, struct d30v_operand *oper, int is_long));
-
-int
-print_insn_d30v (memaddr, info)
- bfd_vma memaddr;
- struct disassemble_info *info;
-{
- int status, result;
- bfd_byte buffer[12];
- unsigned long in1, in2;
- struct d30v_insn insn;
- long long num;
-
- insn.form = (struct d30v_format *) NULL;
-
- info->bytes_per_line = 8;
- info->bytes_per_chunk = 4;
- info->display_endian = BFD_ENDIAN_BIG;
-
- status = (*info->read_memory_func) (memaddr, buffer, 4, info);
- if (status != 0)
- {
- (*info->memory_error_func) (status, memaddr, info);
- return -1;
- }
- in1 = bfd_getb32 (buffer);
-
- status = (*info->read_memory_func) (memaddr + 4, buffer, 4, info);
- if (status != 0)
- {
- info->bytes_per_line = 8;
- if (!(result = lookup_opcode (&insn, in1, 0)))
- (*info->fprintf_func) (info->stream, ".long\t0x%x", in1);
- else
- print_insn (info, memaddr, (long long) in1, &insn, 0, result);
- return 4;
- }
- in2 = bfd_getb32 (buffer);
-
- if (in1 & in2 & FM01)
- {
- /* LONG instruction. */
- if (!(result = lookup_opcode (&insn, in1, 1)))
- {
- (*info->fprintf_func) (info->stream, ".long\t0x%x,0x%x", in1, in2);
- return 8;
- }
- num = (long long) in1 << 32 | in2;
- print_insn (info, memaddr, num, &insn, 1, result);
- }
- else
- {
- num = in1;
- if (!(result = lookup_opcode (&insn, in1, 0)))
- (*info->fprintf_func) (info->stream, ".long\t0x%x", in1);
- else
- print_insn (info, memaddr, num, &insn, 0, result);
-
- switch (((in1 >> 31) << 1) | (in2 >> 31))
- {
- case 0:
- (*info->fprintf_func) (info->stream, "\t||\t");
- break;
- case 1:
- (*info->fprintf_func) (info->stream, "\t->\t");
- break;
- case 2:
- (*info->fprintf_func) (info->stream, "\t<-\t");
- default:
- break;
- }
-
- insn.form = (struct d30v_format *) NULL;
- num = in2;
- if (!(result = lookup_opcode (&insn, in2, 0)))
- (*info->fprintf_func) (info->stream, ".long\t0x%x", in2);
- else
- print_insn (info, memaddr, num, &insn, 0, result);
- }
- return 8;
-}
-