OLD | NEW |
1 /* Disassembler code for CR16. | 1 /* Disassembler code for CR16. |
2 Copyright 2007, 2008, 2009 Free Software Foundation, Inc. | 2 Copyright 2007, 2008, 2009, 2012 Free Software Foundation, Inc. |
3 Contributed by M R Swami Reddy (MR.Swami.Reddy@nsc.com). | 3 Contributed by M R Swami Reddy (MR.Swami.Reddy@nsc.com). |
4 | 4 |
5 This file is part of GAS, GDB and the GNU binutils. | 5 This file is part of GAS, GDB and the GNU binutils. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify it | 7 This program is free software; you can redistribute it and/or modify it |
8 under the terms of the GNU General Public License as published by the | 8 under the terms of the GNU General Public License as published by the |
9 Free Software Foundation; either version 3, or (at your option) | 9 Free Software Foundation; either version 3, or (at your option) |
10 any later version. | 10 any later version. |
11 | 11 |
12 This program is distributed in the hope that it will be useful, but WITHOUT | 12 This program is distributed in the hope that it will be useful, but WITHOUT |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
15 more details. | 15 more details. |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
18 along with this program; if not, write to the Free Software Foundation, | 18 along with this program; if not, write to the Free Software Foundation, |
19 Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ | 19 Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
20 | 20 |
| 21 #include "sysdep.h" |
21 #include "dis-asm.h" | 22 #include "dis-asm.h" |
22 #include "sysdep.h" | |
23 #include "opcode/cr16.h" | 23 #include "opcode/cr16.h" |
24 #include "libiberty.h" | 24 #include "libiberty.h" |
25 | 25 |
26 /* String to print when opcode was not matched. */ | 26 /* String to print when opcode was not matched. */ |
27 #define ILLEGAL "illegal" | 27 #define ILLEGAL "illegal" |
28 /* Escape to 16-bit immediate. */ | 28 /* Escape to 16-bit immediate. */ |
29 #define ESCAPE_16_BIT 0xB | 29 #define ESCAPE_16_BIT 0xB |
30 | 30 |
31 /* Extract 'n_bits' from 'a' starting from offset 'offs'. */ | 31 /* Extract 'n_bits' from 'a' starting from offset 'offs'. */ |
32 #define EXTRACT(a, offs, n_bits) \ | 32 #define EXTRACT(a, offs, n_bits) \ |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 a->constant = (unsigned long int) (longdisp & mask); | 672 a->constant = (unsigned long int) (longdisp & mask); |
673 } | 673 } |
674 /* For branch Neq instruction it is 2*offset + 2. */ | 674 /* For branch Neq instruction it is 2*offset + 2. */ |
675 else if (IS_INSN_TYPE (BRANCH_NEQ_INS)) | 675 else if (IS_INSN_TYPE (BRANCH_NEQ_INS)) |
676 a->constant = 2 * a->constant + 2; | 676 a->constant = 2 * a->constant + 2; |
677 | 677 |
678 if ((!IS_INSN_TYPE (CSTBIT_INS)) && (!IS_INSN_TYPE (LD_STOR_INS))) | 678 if ((!IS_INSN_TYPE (CSTBIT_INS)) && (!IS_INSN_TYPE (LD_STOR_INS))) |
679 (sign_flag) ? func (stream, "%s", "*-"): func (stream, "%s","*+"); | 679 (sign_flag) ? func (stream, "%s", "*-"): func (stream, "%s","*+"); |
680 | 680 |
681 /* PR 10173: Avoid printing the 0x prefix twice. */ | 681 /* PR 10173: Avoid printing the 0x prefix twice. */ |
682 if (info->num_symbols > 0) | 682 if (info->symtab_size > 0) |
683 func (stream, "%s", "0x"); | 683 func (stream, "%s", "0x"); |
684 number = ((relative ? memaddr : 0) + | 684 number = ((relative ? memaddr : 0) + |
685 (sign_flag ? ((- a->constant) & 0xffffffe) : a->constant)); | 685 (sign_flag ? ((- a->constant) & 0xffffffe) : a->constant)); |
686 | 686 |
687 (*info->print_address_func) ((number & ((1 << 24) - 1)), info); | 687 (*info->print_address_func) ((number & ((1 << 24) - 1)), info); |
688 | 688 |
689 func (stream, "%s", print_exp_len (instruction->size * 16)); | 689 func (stream, "%s", print_exp_len (instruction->size * 16)); |
690 break; | 690 break; |
691 | 691 |
692 default: | 692 default: |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 if ((INST_HAS_REG_LIST) && ((words[0] >> 7) & 0x1)) | 822 if ((INST_HAS_REG_LIST) && ((words[0] >> 7) & 0x1)) |
823 currInsn.nargs +=1; | 823 currInsn.nargs +=1; |
824 print_arguments (&currInsn, memaddr, info); | 824 print_arguments (&currInsn, memaddr, info); |
825 return currInsn.size; | 825 return currInsn.size; |
826 } | 826 } |
827 | 827 |
828 /* No match found. */ | 828 /* No match found. */ |
829 info->fprintf_func (info->stream,"%s ",ILLEGAL); | 829 info->fprintf_func (info->stream,"%s ",ILLEGAL); |
830 return 2; | 830 return 2; |
831 } | 831 } |
OLD | NEW |