diff options
author | obrien <obrien@FreeBSD.org> | 2002-01-27 12:00:11 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-01-27 12:00:11 +0000 |
commit | fc89183cdc6be5afa8deb7250fd15a20832ab528 (patch) | |
tree | 5c493199a70976c54e1b9c6a7804a3de85b43e84 /contrib/binutils/opcodes/ppc-dis.c | |
parent | 94820fd8060f6f43089d1a3ddb8a482402e7e494 (diff) | |
download | FreeBSD-src-fc89183cdc6be5afa8deb7250fd15a20832ab528.zip FreeBSD-src-fc89183cdc6be5afa8deb7250fd15a20832ab528.tar.gz |
Enlist the FreeBSD-CURRENT users as testers of what is to become Binutils
version 2.12.0. These bits are taken from the FSF anoncvs repo on
27-January-2002 03:41 PST.
Diffstat (limited to 'contrib/binutils/opcodes/ppc-dis.c')
-rw-r--r-- | contrib/binutils/opcodes/ppc-dis.c | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/contrib/binutils/opcodes/ppc-dis.c b/contrib/binutils/opcodes/ppc-dis.c index c59a920..5d654c0 100644 --- a/contrib/binutils/opcodes/ppc-dis.c +++ b/contrib/binutils/opcodes/ppc-dis.c @@ -32,32 +32,58 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * static int print_insn_powerpc PARAMS ((bfd_vma, struct disassemble_info *, int bigendian, int dialect)); -/* Print a big endian PowerPC instruction. For convenience, also - disassemble instructions supported by the Motorola PowerPC 601 - and the Altivec vector unit. */ +static int powerpc_dialect PARAMS ((struct disassemble_info *)); + +/* Determine which set of machines to disassemble for. PPC403/601 or + Motorola BookE. For convenience, also disassemble instructions + supported by the AltiVec vector unit. */ + +int +powerpc_dialect(info) + struct disassemble_info *info; +{ + int dialect = PPC_OPCODE_PPC | PPC_OPCODE_ALTIVEC; + + if (BFD_DEFAULT_TARGET_SIZE == 64) + dialect |= PPC_OPCODE_64; + + if (info->disassembler_options + && (strcmp (info->disassembler_options, "booke") == 0 + || strcmp (info->disassembler_options, "booke32") == 0 + || strcmp (info->disassembler_options, "booke64") == 0)) + dialect |= PPC_OPCODE_BOOKE | PPC_OPCODE_BOOKE64; + else + dialect |= PPC_OPCODE_403 | PPC_OPCODE_601; + + if (info->disassembler_options) + { + if (strstr (info->disassembler_options, "32") != NULL) + dialect &= ~PPC_OPCODE_64; + else if (strstr (info->disassembler_options, "64") != NULL) + dialect |= PPC_OPCODE_64; + } + + return dialect; +} + +/* Print a big endian PowerPC instruction. */ int print_insn_big_powerpc (memaddr, info) bfd_vma memaddr; struct disassemble_info *info; { - return print_insn_powerpc (memaddr, info, 1, - PPC_OPCODE_PPC | PPC_OPCODE_601 | - PPC_OPCODE_ALTIVEC); + return print_insn_powerpc (memaddr, info, 1, powerpc_dialect(info)); } -/* Print a little endian PowerPC instruction. For convenience, also - disassemble instructions supported by the Motorola PowerPC 601 - and the Altivec vector unit. */ +/* Print a little endian PowerPC instruction. */ int print_insn_little_powerpc (memaddr, info) bfd_vma memaddr; struct disassemble_info *info; { - return print_insn_powerpc (memaddr, info, 0, - PPC_OPCODE_PPC | PPC_OPCODE_601 | - PPC_OPCODE_ALTIVEC); + return print_insn_powerpc (memaddr, info, 0, powerpc_dialect(info)); } /* Print a POWER (RS/6000) instruction. */ @@ -131,7 +157,7 @@ print_insn_powerpc (memaddr, info, bigendian, dialect) { operand = powerpc_operands + *opindex; if (operand->extract) - (*operand->extract) (insn, &invalid); + (*operand->extract) (insn, dialect, &invalid); } if (invalid) continue; @@ -158,7 +184,7 @@ print_insn_powerpc (memaddr, info, bigendian, dialect) /* Extract the value from the instruction. */ if (operand->extract) - value = (*operand->extract) (insn, (int *) NULL); + value = (*operand->extract) (insn, dialect, (int *) NULL); else { value = (insn >> operand->shift) & ((1 << operand->bits) - 1); |