Changeset 609 for branches/GNU/src/binutils/opcodes/ppc-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/ppc-dis.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* ppc-dis.c -- Disassemble PowerPC instructions 2 Copyright 1994, 1995, 2000 Free Software Foundation, Inc.2 Copyright 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc. 3 3 Written by Ian Lance Taylor, Cygnus Support 4 4 … … 33 33 int bigendian, int dialect)); 34 34 35 /* Print a big endian PowerPC instruction. For convenience, also 36 disassemble instructions supported by the Motorola PowerPC 601 37 and the Altivec vector unit. */ 35 static int powerpc_dialect PARAMS ((struct disassemble_info *)); 36 37 /* Determine which set of machines to disassemble for. PPC403/601 or 38 BookE. For convenience, also disassemble instructions supported 39 by the AltiVec vector unit. */ 40 41 int 42 powerpc_dialect(info) 43 struct disassemble_info *info; 44 { 45 int dialect = PPC_OPCODE_PPC | PPC_OPCODE_ALTIVEC; 46 47 if (BFD_DEFAULT_TARGET_SIZE == 64) 48 dialect |= PPC_OPCODE_64; 49 50 if (info->disassembler_options 51 && (strcmp (info->disassembler_options, "booke") == 0 52 || strcmp (info->disassembler_options, "booke32") == 0 53 || strcmp (info->disassembler_options, "booke64") == 0)) 54 dialect |= PPC_OPCODE_BOOKE | PPC_OPCODE_BOOKE64; 55 else 56 if ((info->mach == bfd_mach_ppc_e500) 57 || (info->disassembler_options 58 && ( strcmp (info->disassembler_options, "e500") == 0 59 || strcmp (info->disassembler_options, "e500x2") == 0))) 60 { 61 dialect |= PPC_OPCODE_BOOKE 62 | PPC_OPCODE_SPE | PPC_OPCODE_ISEL 63 | PPC_OPCODE_EFS | PPC_OPCODE_BRLOCK 64 | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK 65 | PPC_OPCODE_RFMCI; 66 /* efs* and AltiVec conflict. */ 67 dialect &= ~PPC_OPCODE_ALTIVEC; 68 } 69 else 70 if (info->disassembler_options 71 && (strcmp (info->disassembler_options, "efs") == 0)) 72 { 73 dialect |= PPC_OPCODE_EFS; 74 /* efs* and AltiVec conflict. */ 75 dialect &= ~PPC_OPCODE_ALTIVEC; 76 } 77 else 78 dialect |= (PPC_OPCODE_403 | PPC_OPCODE_601 | PPC_OPCODE_CLASSIC 79 | PPC_OPCODE_COMMON); 80 81 if (info->disassembler_options 82 && strcmp (info->disassembler_options, "power4") == 0) 83 dialect |= PPC_OPCODE_POWER4; 84 85 if (info->disassembler_options) 86 { 87 if (strstr (info->disassembler_options, "32") != NULL) 88 dialect &= ~PPC_OPCODE_64; 89 else if (strstr (info->disassembler_options, "64") != NULL) 90 dialect |= PPC_OPCODE_64; 91 } 92 93 return dialect; 94 } 95 96 /* Print a big endian PowerPC instruction. */ 38 97 39 98 int … … 42 101 struct disassemble_info *info; 43 102 { 44 return print_insn_powerpc (memaddr, info, 1, 45 PPC_OPCODE_PPC | PPC_OPCODE_601 | 46 PPC_OPCODE_ALTIVEC); 47 } 48 49 /* Print a little endian PowerPC instruction. For convenience, also 50 disassemble instructions supported by the Motorola PowerPC 601 51 and the Altivec vector unit. */ 103 return print_insn_powerpc (memaddr, info, 1, powerpc_dialect(info)); 104 } 105 106 /* Print a little endian PowerPC instruction. */ 52 107 53 108 int … … 56 111 struct disassemble_info *info; 57 112 { 58 return print_insn_powerpc (memaddr, info, 0, 59 PPC_OPCODE_PPC | PPC_OPCODE_601 | 60 PPC_OPCODE_ALTIVEC); 113 return print_insn_powerpc (memaddr, info, 0, powerpc_dialect(info)); 61 114 } 62 115 … … 124 177 continue; 125 178 179 if ((dialect & PPC_OPCODE_EFS) && (opcode->flags & PPC_OPCODE_ALTIVEC)) 180 continue; 181 126 182 /* Make two passes over the operands. First see if any of them 127 183 have extraction functions, and, if they do, make sure the … … 132 188 operand = powerpc_operands + *opindex; 133 189 if (operand->extract) 134 (*operand->extract) (insn, &invalid);190 (*operand->extract) (insn, dialect, &invalid); 135 191 } 136 192 if (invalid) … … 159 215 /* Extract the value from the instruction. */ 160 216 if (operand->extract) 161 value = (*operand->extract) (insn, (int *) NULL);217 value = (*operand->extract) (insn, dialect, (int *) NULL); 162 218 else 163 219 { … … 207 263 cr = value >> 2; 208 264 if (cr != 0) 209 (*info->fprintf_func) (info->stream, "4*cr%d ", cr);265 (*info->fprintf_func) (info->stream, "4*cr%d+", cr); 210 266 cc = value & 3; 211 if (cc != 0) 212 { 213 if (cr != 0) 214 (*info->fprintf_func) (info->stream, "+"); 215 (*info->fprintf_func) (info->stream, "%s", cbnames[cc]); 216 } 267 (*info->fprintf_func) (info->stream, "%s", cbnames[cc]); 217 268 } 218 269 } … … 242 293 return 4; 243 294 } 295 296 void 297 print_ppc_disassembler_options (FILE * stream) 298 { 299 fprintf (stream, "\n\ 300 The following PPC specific disassembler options are supported for use with\n\ 301 the -M switch:\n"); 302 303 fprintf (stream, " booke|booke32|booke64 Disassemble the BookE instructions\n"); 304 fprintf (stream, " e500|e500x2 Disassemble the e500 instructions\n"); 305 fprintf (stream, " efs Disassemble the EFS instructions\n"); 306 fprintf (stream, " power4 Disassemble the Power4 instructions\n"); 307 fprintf (stream, " 32 Do not disassemble 64-bit instructions\n"); 308 fprintf (stream, " 64 Allow disassembly of 64-bit instructions\n"); 309 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.