aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-08-26 13:16:29 +0000
committerNick Clifton <nickc@redhat.com>2009-08-26 13:16:29 +0000
commitf7922329bf858a53e75d0affc239ce08bea43fb8 (patch)
tree70af0eae12418f8aa1960fa40caf0bafd5f7eae2 /opcodes
parente9e0a58e87c33963dda1800900c0e43b7c0213c0 (diff)
downloadgdb-f7922329bf858a53e75d0affc239ce08bea43fb8.zip
gdb-f7922329bf858a53e75d0affc239ce08bea43fb8.tar.gz
gdb-f7922329bf858a53e75d0affc239ce08bea43fb8.tar.bz2
* m68k-dis.c (print_insn_arg): Add movecr register names for
coldfire v4e families.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/m68k-dis.c69
2 files changed, 52 insertions, 22 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 9b0e2a0..a6ceacd 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-26 Philippe De Muyter <phdm@macqel.be>
+
+ * m68k-dis.c (print_insn_arg): Add movecr register names for
+ coldfire v4e families.
+
2009-08-25 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* Makefile.am (SUBDIRS): Build '.' before 'po'.
diff --git a/opcodes/m68k-dis.c b/opcodes/m68k-dis.c
index 076e646..dd7a3b3 100644
--- a/opcodes/m68k-dis.c
+++ b/opcodes/m68k-dis.c
@@ -1,6 +1,6 @@
/* Print Motorola 68k instructions.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
Free Software Foundation, Inc.
This file is part of the GNU opcodes library.
@@ -699,35 +699,60 @@ print_insn_arg (const char *d,
case 'J':
{
/* FIXME: There's a problem here, different m68k processors call the
- same address different names. This table can't get it right
- because it doesn't know which processor it's disassembling for. */
- static const struct { char *name; int value; } names[]
- = {{"%sfc", 0x000}, {"%dfc", 0x001}, {"%cacr", 0x002},
- {"%tc", 0x003}, {"%itt0",0x004}, {"%itt1", 0x005},
- {"%dtt0",0x006}, {"%dtt1",0x007}, {"%buscr",0x008},
- {"%usp", 0x800}, {"%vbr", 0x801}, {"%caar", 0x802},
- {"%msp", 0x803}, {"%isp", 0x804},
- /* reg c04 is sometimes called flashbar or rambar.
- rec c05 is also sometimes called rambar. */
- {"%rambar0", 0xc04}, {"%rambar1", 0xc05},
-
- /* Should we be calling this psr like we do in case 'Y'? */
- {"%mmusr",0x805},
-
- {"%urp", 0x806}, {"%srp", 0x807}, {"%pcr", 0x808},
-
- /* Fido added these. */
- {"%cac", 0xffe}, {"%mbo", 0xfff}};
+ same address different names. The tables below try to get it right
+ using info->mach, but only for v4e. */
+ struct regname { char * name; int value; };
+ static const struct regname names[] =
+ {
+ {"%sfc", 0x000}, {"%dfc", 0x001}, {"%cacr", 0x002},
+ {"%tc", 0x003}, {"%itt0",0x004}, {"%itt1", 0x005},
+ {"%dtt0",0x006}, {"%dtt1",0x007}, {"%buscr",0x008},
+ {"%usp", 0x800}, {"%vbr", 0x801}, {"%caar", 0x802},
+ {"%msp", 0x803}, {"%isp", 0x804},
+ {"%pc", 0x80f},
+ /* Reg c04 is sometimes called flashbar or rambar.
+ Rec c05 is also sometimes called rambar. */
+ {"%rambar0", 0xc04}, {"%rambar1", 0xc05},
+
+ {"%mbar", 0xc0f},
+
+ /* Should we be calling this psr like we do in case 'Y'? */
+ {"%mmusr",0x805},
+
+ {"%urp", 0x806}, {"%srp", 0x807}, {"%pcr", 0x808},
+
+ /* Fido added these. */
+ {"%cac", 0xffe}, {"%mbo", 0xfff}
+ };
+ /* Alternate names for v4e (MCF5407/5445x/MCF547x/MCF548x), at least. */
+ static const struct regname names_v4e[] =
+ {
+ {"%asid",0x003}, {"%acr0",0x004}, {"%acr1",0x005},
+ {"%acr2",0x006}, {"%acr3",0x007}, {"%mmubar",0x008},
+ };
+ unsigned int arch_mask;
+ arch_mask = bfd_m68k_mach_to_features (info->mach);
FETCH_ARG (12, val);
- for (regno = sizeof names / sizeof names[0] - 1; regno >= 0; regno--)
+ if (arch_mask & (mcfisa_b | mcfisa_c))
+ {
+ for (regno = ARRAY_SIZE (names_v4e); --regno >= 0;)
+ if (names_v4e[regno].value == val)
+ {
+ (*info->fprintf_func) (info->stream, "%s", names_v4e[regno].name);
+ break;
+ }
+ if (regno >= 0)
+ break;
+ }
+ for (regno = ARRAY_SIZE (names) - 1; regno >= 0; regno--)
if (names[regno].value == val)
{
(*info->fprintf_func) (info->stream, "%s", names[regno].name);
break;
}
if (regno < 0)
- (*info->fprintf_func) (info->stream, "%d", val);
+ (*info->fprintf_func) (info->stream, "0x%x", val);
}
break;