Changeset 609 for branches/GNU/src/binutils/opcodes/sh-dis.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/opcodes/sh-dis.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Disassemble SH instructions. 2 Copyright 1993, 1994, 1995, 1997, 1998, 2000 2 Copyright 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003 3 3 Free Software Foundation, Inc. 4 4 5 This program is free software; you can redistribute it and/or modify6 it under the terms of the GNU General Public License as published by7 the Free Software Foundation; either version 2 of the License, or8 (at your option) any later version.9 10 This program is distributed in the hope that it will be useful,11 but WITHOUT ANY WARRANTY; without even the implied warranty of12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 GNU General Public License for more details.14 15 You should have received a copy of the GNU General Public License16 along with this program; if not, write to the Free Software17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 18 18 19 19 #include <stdio.h> … … 25 25 #include "dis-asm.h" 26 26 27 #define LITTLE_BIT 2 27 #ifdef ARCH_all 28 #define INCLUDE_SHMEDIA 29 #endif 30 31 static void print_movxy 32 PARAMS ((const sh_opcode_info *, int, int, fprintf_ftype, void *)); 33 static void print_insn_ddt PARAMS ((int, struct disassemble_info *)); 34 static void print_dsp_reg PARAMS ((int, fprintf_ftype, void *)); 35 static void print_insn_ppi PARAMS ((int, struct disassemble_info *)); 28 36 29 37 static void 30 38 print_movxy (op, rn, rm, fprintf_fn, stream) 31 sh_opcode_info *op;39 const sh_opcode_info *op; 32 40 int rn, rm; 33 41 fprintf_ftype fprintf_fn; … … 98 106 else 99 107 { 100 static sh_opcode_info *first_movx, *first_movy;101 sh_opcode_info *opx, *opy;108 static const sh_opcode_info *first_movx, *first_movy; 109 const sh_opcode_info *opx, *opy; 102 110 unsigned int insn_x, insn_y; 103 111 … … 185 193 unsigned int nib1, nib2, nib3; 186 194 char *dc = NULL; 187 sh_opcode_info *op;195 const sh_opcode_info *op; 188 196 189 197 if ((field_b & 0xe800) == 0) … … 280 288 } 281 289 282 staticint283 print_insn_sh x(memaddr, info)290 int 291 print_insn_sh (memaddr, info) 284 292 bfd_vma memaddr; 285 293 struct disassemble_info *info; … … 291 299 int status; 292 300 bfd_vma relmask = ~(bfd_vma) 0; 293 sh_opcode_info *op;301 const sh_opcode_info *op; 294 302 int target_arch; 295 303 … … 298 306 case bfd_mach_sh: 299 307 target_arch = arch_sh1; 308 /* SH coff object files lack information about the machine type, so 309 we end up with bfd_mach_sh unless it was set explicitly (which 310 could have happended if this is a call from gdb or the simulator.) */ 311 if (info->symbols 312 && bfd_asymbol_flavour(*info->symbols) == bfd_target_coff_flavour) 313 target_arch = arch_sh4; 300 314 break; 301 315 case bfd_mach_sh2: 302 316 target_arch = arch_sh2; 303 317 break; 318 case bfd_mach_sh2e: 319 target_arch = arch_sh2e; 320 break; 304 321 case bfd_mach_sh_dsp: 305 322 target_arch = arch_sh_dsp; … … 317 334 target_arch = arch_sh4; 318 335 break; 336 case bfd_mach_sh5: 337 #ifdef INCLUDE_SHMEDIA 338 status = print_insn_sh64 (memaddr, info); 339 if (status != -2) 340 return status; 341 #endif 342 /* When we get here for sh64, it's because we want to disassemble 343 SHcompact, i.e. arch_sh4. */ 344 target_arch = arch_sh4; 345 break; 319 346 default: 320 347 abort (); … … 329 356 } 330 357 331 if (info-> flags & LITTLE_BIT)358 if (info->endian == BFD_ENDIAN_LITTLE) 332 359 { 333 360 nibs[0] = (insn[1] >> 4) & 0xf; … … 360 387 } 361 388 362 if (info-> flags & LITTLE_BIT)389 if (info->endian == BFD_ENDIAN_LITTLE) 363 390 field_b = insn[1] << 8 | insn[0]; 364 391 else … … 459 486 goto fail; 460 487 rn = rn & 0x3; 461 rn |= ( rn & 2) << 1;488 rn |= (!(rn & 2)) << 2; 462 489 break; 463 490 case PPI: … … 666 693 info->flags |= 1; 667 694 fprintf_fn (stream, "\t(slot "); 668 print_insn_sh x(memaddr + 2, info);695 print_insn_sh (memaddr + 2, info); 669 696 info->flags &= ~1; 670 697 fprintf_fn (stream, ")"); … … 689 716 if (size == 2) 690 717 { 691 if ( (info->flags & LITTLE_BIT) != 0)718 if (info->endian == BFD_ENDIAN_LITTLE) 692 719 val = bfd_getl16 (bytes); 693 720 else … … 696 723 else 697 724 { 698 if ( (info->flags & LITTLE_BIT) != 0)725 if (info->endian == BFD_ENDIAN_LITTLE) 699 726 val = bfd_getl32 (bytes); 700 727 else … … 713 740 return 2; 714 741 } 715 716 int717 print_insn_shl (memaddr, info)718 bfd_vma memaddr;719 struct disassemble_info *info;720 {721 int r;722 723 info->flags = LITTLE_BIT;724 r = print_insn_shx (memaddr, info);725 return r;726 }727 728 int729 print_insn_sh (memaddr, info)730 bfd_vma memaddr;731 struct disassemble_info *info;732 {733 int r;734 735 info->flags = 0;736 r = print_insn_shx (memaddr, info);737 return r;738 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.