Skip to content

Commit

Permalink
[POWERPC] Import updated version of ppc disassembly code for xmon
Browse files Browse the repository at this point in the history
This includes:
 * version 1.24 of ppc-dis.c
 * version 1.88 of ppc-opc.c
 * version 1.23 of ppc.h

I can't vouch for the accuracy etc. of these changes, but it brings
us into line with binutils - and from a cursory test appears to work
fine.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Dec 4, 2006
1 parent 0b8e2e1 commit 897f112
Show file tree
Hide file tree
Showing 3 changed files with 618 additions and 219 deletions.
20 changes: 16 additions & 4 deletions arch/powerpc/xmon/ppc-dis.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* ppc-dis.c -- Disassemble PowerPC instructions
Copyright 1994 Free Software Foundation, Inc.
Copyright 1994, 1995, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support
This file is part of GDB, GAS, and the GNU binutils.
Expand All @@ -16,8 +17,9 @@ the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this file; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */

#include <asm/cputable.h>
#include "nonstdio.h"
#include "ansidecl.h"
#include "ppc.h"
Expand All @@ -36,6 +38,15 @@ print_insn_powerpc (unsigned long insn, unsigned long memaddr)
dialect = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_COMMON
| PPC_OPCODE_64 | PPC_OPCODE_POWER4 | PPC_OPCODE_ALTIVEC;

if (cpu_has_feature(CPU_FTRS_POWER5))
dialect |= PPC_OPCODE_POWER5;

if (cpu_has_feature(CPU_FTRS_CELL))
dialect |= PPC_OPCODE_CELL | PPC_OPCODE_ALTIVEC;

if (cpu_has_feature(CPU_FTRS_POWER6))
dialect |= PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_ALTIVEC;

/* Get the major opcode of the instruction. */
op = PPC_OP (insn);

Expand Down Expand Up @@ -120,7 +131,8 @@ print_insn_powerpc (unsigned long insn, unsigned long memaddr)
}

/* Print the operand as directed by the flags. */
if ((operand->flags & PPC_OPERAND_GPR) != 0)
if ((operand->flags & PPC_OPERAND_GPR) != 0
|| ((operand->flags & PPC_OPERAND_GPR_0) != 0 && value != 0))
printf("r%ld", value);
else if ((operand->flags & PPC_OPERAND_FPR) != 0)
printf("f%ld", value);
Expand All @@ -136,7 +148,7 @@ print_insn_powerpc (unsigned long insn, unsigned long memaddr)
else
{
if (operand->bits == 3)
printf("cr%d", value);
printf("cr%ld", value);
else
{
static const char *cbnames[4] = { "lt", "gt", "eq", "so" };
Expand Down
Loading

0 comments on commit 897f112

Please sign in to comment.