| 1 | /* Disassemble D30V instructions.
|
|---|
| 2 | Copyright 1997, 1998, 2000 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, 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 |
|
|---|
| 26 | static int lookup_opcode PARAMS (( struct d30v_insn *insn, long num, int is_long ));
|
|---|
| 27 | static 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 ));
|
|---|
| 29 | static int extract_value PARAMS (( long long num, struct d30v_operand *oper, int is_long ));
|
|---|
| 30 |
|
|---|
| 31 | int
|
|---|
| 32 | print_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)
|
|---|
|
|---|