| OLD | NEW |
| 1 /* Disassembler code for CRX. | 1 /* Disassembler code for CRX. |
| 2 Copyright 2004, 2005, 2006, 2007 Free Software Foundation, Inc. | 2 Copyright 2004, 2005, 2006, 2007, 2012 Free Software Foundation, Inc. |
| 3 Contributed by Tomer Levi, NSC, Israel. | 3 Contributed by Tomer Levi, NSC, Israel. |
| 4 Written by Tomer Levi. | 4 Written by Tomer Levi. |
| 5 | 5 |
| 6 This file is part of the GNU opcodes library. | 6 This file is part of the GNU opcodes library. |
| 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 "sysdep.h" |
| 23 #include "dis-asm.h" | 24 #include "dis-asm.h" |
| 24 #include "sysdep.h" | |
| 25 #include "opcode/crx.h" | 25 #include "opcode/crx.h" |
| 26 | 26 |
| 27 /* String to print when opcode was not matched. */ | 27 /* String to print when opcode was not matched. */ |
| 28 #define ILLEGAL "illegal" | 28 #define ILLEGAL "illegal" |
| 29 /* Escape to 16-bit immediate. */ | 29 /* Escape to 16-bit immediate. */ |
| 30 #define ESCAPE_16_BIT 0xE | 30 #define ESCAPE_16_BIT 0xE |
| 31 | 31 |
| 32 /* Extract 'n_bits' from 'a' starting from offset 'offs'. */ | 32 /* Extract 'n_bits' from 'a' starting from offset 'offs'. */ |
| 33 #define EXTRACT(a, offs, n_bits) \ | 33 #define EXTRACT(a, offs, n_bits) \ |
| 34 (n_bits == 32 ? (((a) >> (offs)) & 0xffffffffL) \ | 34 (n_bits == 32 ? (((a) >> (offs)) & 0xffffffffL) \ |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 541 |
| 542 if ((reg_arg_type == COP_ARG) || (reg_arg_type == COPS_ARG)) | 542 if ((reg_arg_type == COP_ARG) || (reg_arg_type == COPS_ARG)) |
| 543 { | 543 { |
| 544 /* Check for proper argument number. */ | 544 /* Check for proper argument number. */ |
| 545 if (processing_argument_number == 2) | 545 if (processing_argument_number == 2) |
| 546 { | 546 { |
| 547 getregliststring (a->constant, string, reg_arg_type); | 547 getregliststring (a->constant, string, reg_arg_type); |
| 548 func (stream, "%s", string); | 548 func (stream, "%s", string); |
| 549 } | 549 } |
| 550 else | 550 else |
| 551 » » func (stream, "$0x%lx", a->constant); | 551 » » func (stream, "$0x%lx", a->constant & 0xffffffff); |
| 552 } | 552 } |
| 553 else | 553 else |
| 554 { | 554 { |
| 555 getregliststring (a->constant, string, reg_arg_type); | 555 getregliststring (a->constant, string, reg_arg_type); |
| 556 func (stream, "%s", string); | 556 func (stream, "%s", string); |
| 557 } | 557 } |
| 558 } | 558 } |
| 559 else | 559 else |
| 560 » func (stream, "$0x%lx", a->constant); | 560 » func (stream, "$0x%lx", a->constant & 0xffffffff); |
| 561 break; | 561 break; |
| 562 | 562 |
| 563 case arg_idxr: | 563 case arg_idxr: |
| 564 func (stream, "0x%lx(%s,%s,%d)", a->constant, getregname (a->r), | 564 func (stream, "0x%lx(%s,%s,%d)", a->constant & 0xffffffff, |
| 565 » getregname (a->i_r), powerof2 (a->scale)); | 565 » getregname (a->r), getregname (a->i_r), powerof2 (a->scale)); |
| 566 break; | 566 break; |
| 567 | 567 |
| 568 case arg_rbase: | 568 case arg_rbase: |
| 569 func (stream, "(%s)", getregname (a->r)); | 569 func (stream, "(%s)", getregname (a->r)); |
| 570 break; | 570 break; |
| 571 | 571 |
| 572 case arg_cr: | 572 case arg_cr: |
| 573 func (stream, "0x%lx(%s)", a->constant, getregname (a->r)); | 573 func (stream, "0x%lx(%s)", a->constant & 0xffffffff, getregname (a->r)); |
| 574 | 574 |
| 575 if (IS_INSN_TYPE (LD_STOR_INS_INC)) | 575 if (IS_INSN_TYPE (LD_STOR_INS_INC)) |
| 576 func (stream, "+"); | 576 func (stream, "+"); |
| 577 break; | 577 break; |
| 578 | 578 |
| 579 case arg_c: | 579 case arg_c: |
| 580 /* Removed the *2 part as because implicit zeros are no more required. | 580 /* Removed the *2 part as because implicit zeros are no more required. |
| 581 Have to fix this as this needs a bit of extension in terms of branchins
. | 581 Have to fix this as this needs a bit of extension in terms of branchins
. |
| 582 Have to add support for cmp and branch instructions. */ | 582 Have to add support for cmp and branch instructions. */ |
| 583 if (IS_INSN_TYPE (BRANCH_INS) || IS_INSN_MNEMONIC ("bal") | 583 if (IS_INSN_TYPE (BRANCH_INS) || IS_INSN_MNEMONIC ("bal") |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 info->fprintf_func (info->stream, "\t"); | 736 info->fprintf_func (info->stream, "\t"); |
| 737 make_instruction (); | 737 make_instruction (); |
| 738 print_arguments (&currInsn, memaddr, info); | 738 print_arguments (&currInsn, memaddr, info); |
| 739 return currInsn.size; | 739 return currInsn.size; |
| 740 } | 740 } |
| 741 | 741 |
| 742 /* No match found. */ | 742 /* No match found. */ |
| 743 info->fprintf_func (info->stream,"%s ",ILLEGAL); | 743 info->fprintf_func (info->stream,"%s ",ILLEGAL); |
| 744 return 2; | 744 return 2; |
| 745 } | 745 } |
| OLD | NEW |