Changeset 609 for branches/GNU/src/binutils/opcodes/sparc-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/sparc-dis.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Print SPARC instructions. 2 2 Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3 2000 Free Software Foundation, Inc.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. */3 2000, 2002, 2003 Free Software Foundation, Inc. 4 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> … … 47 47 #define HASH_INSN(INSN) \ 48 48 ((((INSN) >> 24) & 0xc0) | (((INSN) & opcode_bits[((INSN) >> 30) & 3]) >> 19)) 49 struct opcode_hash { 49 struct opcode_hash 50 { 50 51 struct opcode_hash *next; 51 52 const struct sparc_opcode *opcode; … … 189 190 for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next) 190 191 { 191 CONSTstruct sparc_opcode *opcode = op->opcode;192 const struct sparc_opcode *opcode = op->opcode; 192 193 if ((opcode->match & insn) == opcode->match 193 194 && (opcode->lose & insn) == 0) … … 258 259 259 260 /* On SPARClite variants such as DANlite (sparc86x), instructions 260 are always big-endian even when the machine is in little-endian mode. */261 are always big-endian even when the machine is in little-endian mode. */ 261 262 if (info->endian == BFD_ENDIAN_BIG || info->mach == bfd_mach_sparc_sparclite) 262 263 getword = bfd_getb32; … … 266 267 insn = getword (buffer); 267 268 268 info->insn_info_valid = 1; /* We do return this info */269 info->insn_type = dis_nonbranch; /* Assume non branch insn */270 info->branch_delay_insns = 0; /* Assume no delay */271 info->target = 0; /* Assume no target known */269 info->insn_info_valid = 1; /* We do return this info. */ 270 info->insn_type = dis_nonbranch; /* Assume non branch insn. */ 271 info->branch_delay_insns = 0; /* Assume no delay. */ 272 info->target = 0; /* Assume no target known. */ 272 273 273 274 for (op = opcode_hash_table[HASH_INSN (insn)]; op; op = op->next) 274 275 { 275 CONSTstruct sparc_opcode *opcode = op->opcode;276 const struct sparc_opcode *opcode = op->opcode; 276 277 277 278 /* If the insn isn't supported by the current architecture, skip it. */ … … 313 314 314 315 { 315 register CONSTchar *s;316 register const char *s; 316 317 317 318 if (opcode->args[0] != ',') 318 319 (*info->fprintf_func) (stream, " "); 320 319 321 for (s = opcode->args; *s != '\0'; ++s) 320 322 { … … 323 325 (*info->fprintf_func) (stream, ","); 324 326 ++s; 325 switch (*s) { 326 case 'a': 327 (*info->fprintf_func) (stream, "a"); 328 is_annulled = 1; 329 ++s; 330 continue; 331 case 'N': 332 (*info->fprintf_func) (stream, "pn"); 333 ++s; 334 continue; 335 336 case 'T': 337 (*info->fprintf_func) (stream, "pt"); 338 ++s; 339 continue; 340 341 default: 342 break; 343 } /* switch on arg */ 344 } /* while there are comma started args */ 327 switch (*s) 328 { 329 case 'a': 330 (*info->fprintf_func) (stream, "a"); 331 is_annulled = 1; 332 ++s; 333 continue; 334 case 'N': 335 (*info->fprintf_func) (stream, "pn"); 336 ++s; 337 continue; 338 339 case 'T': 340 (*info->fprintf_func) (stream, "pt"); 341 ++s; 342 continue; 343 344 default: 345 break; 346 } 347 } 345 348 346 349 (*info->fprintf_func) (stream, " "); … … 420 423 case 'h': 421 424 (*info->fprintf_func) (stream, "%%hi(%#x)", 422 ( 0xFFFFFFFF425 ((unsigned) 0xFFFFFFFF 423 426 & ((int) X_IMM22 (insn) << 10))); 424 427 break; … … 683 686 int errcode; 684 687 685 errcode = 686 (*info->read_memory_func) 688 if (memaddr >= 4) 689 errcode = 690 (*info->read_memory_func) 687 691 (memaddr - 4, buffer, sizeof (buffer), info); 692 else 693 errcode = 1; 694 688 695 prev_insn = getword (buffer); 689 696 … … 692 699 /* If it is a delayed branch, we need to look at the 693 700 instruction before the delayed branch. This handles 694 sequences such as 701 sequences such as: 695 702 696 703 sethi %o1, %hi(_foo), %o1 697 704 call _printf 698 or %o1, %lo(_foo), %o1 699 */ 705 or %o1, %lo(_foo), %o1 */ 700 706 701 707 if (is_delayed_branch (prev_insn)) 702 708 { 703 errcode = (*info->read_memory_func) 704 (memaddr - 8, buffer, sizeof (buffer), info); 709 if (memaddr >= 8) 710 errcode = (*info->read_memory_func) 711 (memaddr - 8, buffer, sizeof (buffer), info); 712 else 713 errcode = 1; 714 705 715 prev_insn = getword (buffer); 706 716 } … … 717 727 (*info->fprintf_func) (stream, "\t! "); 718 728 info->target = 719 (0xFFFFFFFF & (int) X_IMM22 (prev_insn) << 10); 729 ((unsigned) 0xFFFFFFFF 730 & ((int) X_IMM22 (prev_insn) << 10)); 720 731 if (imm_added_to_rs1) 721 732 info->target += X_SIMM (insn, 13); … … 746 757 } 747 758 748 info->insn_type = dis_noninsn; /* Mark as non-valid instruction */759 info->insn_type = dis_noninsn; /* Mark as non-valid instruction. */ 749 760 (*info->fprintf_func) (stream, _("unknown")); 750 761 return sizeof (buffer); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.