source: trunk/src/binutils/opcodes/d30v-dis.c@ 239

Last change on this file since 239 was 10, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 9.8 KB
Line 
1/* Disassemble D30V instructions.
2 Copyright 1997, 1998, 2000 Free Software Foundation, Inc.
3
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation; either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17
18#include <stdio.h>
19#include "sysdep.h"
20#include "opcode/d30v.h"
21#include "dis-asm.h"
22#include "opintl.h"
23
24#define PC_MASK 0xFFFFFFFF
25
26static int lookup_opcode PARAMS (( struct d30v_insn *insn, long num, int is_long ));
27static void print_insn PARAMS (( struct disassemble_info *info, bfd_vma memaddr, long long num,
28 struct d30v_insn *insn, int is_long, int show_ext ));
29static int extract_value PARAMS (( long long num, struct d30v_operand *oper, int is_long ));
30
31int
32print_insn_d30v (memaddr, info)
33 bfd_vma memaddr;
34 struct disassemble_info *info;
35{
36 int status, result;
37 bfd_byte buffer[12];
38 unsigned long in1,in2;
39 struct d30v_insn insn;
40 long long num;
41
42 insn.form = (struct d30v_format *)NULL;
43
44 info->bytes_per_line = 8;
45 info->bytes_per_chunk = 4;
46 info->display_endian = BFD_ENDIAN_BIG;
47
48 status = (*info->read_memory_func) (memaddr, buffer, 4, info);
49 if (status != 0)
50 {
51 (*info->memory_error_func) (status, memaddr, info);
52 return -1;
53 }
54 in1 = bfd_getb32 (buffer);
55
56 status = (*info->read_memory_func) (memaddr+4, buffer, 4, info);
57 if (status != 0)