| OLD | NEW |
| 1 /* Instruction printing code for the ARC. | 1 /* Instruction printing code for the ARC. |
| 2 Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2005, 2007, 2009, 2010 | 2 Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2005, 2007, 2009, |
| 3 Free Software Foundation, Inc. | 3 2010, 2012 Free Software Foundation, Inc. |
| 4 Contributed by Doug Evans (dje@cygnus.com). | 4 Contributed by Doug Evans (dje@cygnus.com). |
| 5 | 5 |
| 6 This file is part of libopcodes. | 6 This file is part of libopcodes. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or modify | 8 This library is free software; you can redistribute it and/or modify |
| 9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
| 10 the Free Software Foundation; either version 3, or (at your option) | 10 the Free Software Foundation; either version 3, or (at your option) |
| 11 any later version. | 11 any later version. |
| 12 | 12 |
| 13 It is distributed in the hope that it will be useful, but WITHOUT | 13 It is distributed in the hope that it will be useful, but WITHOUT |
| 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | 15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 16 License for more details. | 16 License for more details. |
| 17 | 17 |
| 18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
| 19 along with this program; if not, write to the Free Software | 19 along with this program; if not, write to the Free Software |
| 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 21 MA 02110-1301, USA. */ | 21 MA 02110-1301, USA. */ |
| 22 | 22 |
| 23 #include "ansidecl.h" | 23 #include "sysdep.h" |
| 24 #include "libiberty.h" | 24 #include "libiberty.h" |
| 25 #include "dis-asm.h" | 25 #include "dis-asm.h" |
| 26 #include "opcode/arc.h" | 26 #include "opcode/arc.h" |
| 27 #include "elf-bfd.h" | 27 #include "elf-bfd.h" |
| 28 #include "elf/arc.h" | 28 #include "elf/arc.h" |
| 29 #include <string.h> | |
| 30 #include "opintl.h" | 29 #include "opintl.h" |
| 31 | 30 |
| 32 #include <stdarg.h> | 31 #include <stdarg.h> |
| 33 #include "arc-dis.h" | 32 #include "arc-dis.h" |
| 34 #include "arc-ext.h" | 33 #include "arc-ext.h" |
| 35 | 34 |
| 36 #ifndef dbg | 35 #ifndef dbg |
| 37 #define dbg (0) | 36 #define dbg (0) |
| 38 #endif | 37 #endif |
| 39 | 38 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 53 CLASS_A4_LD0, | 52 CLASS_A4_LD0, |
| 54 CLASS_A4_LD1, | 53 CLASS_A4_LD1, |
| 55 CLASS_A4_ST, | 54 CLASS_A4_ST, |
| 56 CLASS_A4_SR, | 55 CLASS_A4_SR, |
| 57 /* All single operand instructions. */ | 56 /* All single operand instructions. */ |
| 58 CLASS_A4_OP3_SUBOPC3F, | 57 CLASS_A4_OP3_SUBOPC3F, |
| 59 CLASS_A4_LR | 58 CLASS_A4_LR |
| 60 } a4_decoding_class; | 59 } a4_decoding_class; |
| 61 | 60 |
| 62 #define BIT(word,n) ((word) & (1 << n)) | 61 #define BIT(word,n) ((word) & (1 << n)) |
| 63 #define BITS(word,s,e) (((word) << (31 - e)) >> (s + (31 - e))) | 62 #define BITS(word,s,e) (((word) >> s) & ((1 << (e + 1 - s)) - 1)) |
| 64 #define OPCODE(word) (BITS ((word), 27, 31)) | 63 #define OPCODE(word) (BITS ((word), 27, 31)) |
| 65 #define FIELDA(word) (BITS ((word), 21, 26)) | 64 #define FIELDA(word) (BITS ((word), 21, 26)) |
| 66 #define FIELDB(word) (BITS ((word), 15, 20)) | 65 #define FIELDB(word) (BITS ((word), 15, 20)) |
| 67 #define FIELDC(word) (BITS ((word), 9, 14)) | 66 #define FIELDC(word) (BITS ((word), 9, 14)) |
| 68 | 67 |
| 69 /* FIELD D is signed in all of its uses, so we make sure argument is | 68 /* FIELD D is signed. */ |
| 70 treated as signed for bit shifting purposes: */ | 69 #define FIELDD(word)» ((BITS ((word), 0, 8) ^ 0x100) - 0x100) |
| 71 #define FIELDD(word)» (BITS (((signed int)word), 0, 8)) | |
| 72 | 70 |
| 73 #define PUT_NEXT_WORD_IN(a) \ | 71 #define PUT_NEXT_WORD_IN(a) \ |
| 74 do \ | 72 do \ |
| 75 { \ | 73 { \ |
| 76 if (is_limm == 1 && !NEXT_WORD (1)) \ | 74 if (is_limm == 1 && !NEXT_WORD (1)) \ |
| 77 mwerror (state, _("Illegal limm reference in last instruction!\n")); \ | 75 mwerror (state, _("Illegal limm reference in last instruction!\n")); \ |
| 78 a = state->words[1]; \ | 76 a = state->words[1]; \ |
| 79 } \ | 77 } \ |
| 80 while (0) | 78 while (0) |
| 81 | 79 |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 /* Return the print_insn function to use. | 1219 /* Return the print_insn function to use. |
| 1222 Side effect: load (possibly empty) extension section */ | 1220 Side effect: load (possibly empty) extension section */ |
| 1223 | 1221 |
| 1224 disassembler_ftype | 1222 disassembler_ftype |
| 1225 arc_get_disassembler (void *ptr) | 1223 arc_get_disassembler (void *ptr) |
| 1226 { | 1224 { |
| 1227 if (ptr) | 1225 if (ptr) |
| 1228 build_ARC_extmap ((struct bfd *) ptr); | 1226 build_ARC_extmap ((struct bfd *) ptr); |
| 1229 return decodeInstr; | 1227 return decodeInstr; |
| 1230 } | 1228 } |
| OLD | NEW |