/* Print Motorola 68k instructions for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "symtab.h"
-#include "opcode/m68k.h"
#include "gdbcore.h"
#include "ieee-float.h"
+/* Opcode/m68k.h is a massive table. As a kludge, break it up into
+ two pieces. This makes nonportable C -- FIXME -- it assumes that
+ two data items declared near each other will be contiguous in
+ memory. This kludge can be removed, FIXME, when GCC is fixed to not
+ be a hog about initializers. */
+
+#ifdef __GNUC__
+#define BREAK_UP_BIG_DECL }; \
+ struct m68k_opcode m68k_opcodes_2[] = {
+#define AND_OTHER_PART sizeof (m68k_opcodes_2)
+#endif
+
+#include "opcode/m68k.h"
+
+
/* Local function prototypes */
static int
/* 68k instructions are never longer than this many bytes. */
#define MAXLEN 22
-/* Number of elements in the opcode table. */
-#define NOPCODES (sizeof m68k_opcodes / sizeof m68k_opcodes[0])
-
const char * const fpcr_names[] = {
"", "fpiar", "fpsr", "fpiar/fpsr", "fpcr",
"fpiar/fpcr", "fpsr/fpcr", "fpiar/fpsr/fpcr"};
bestmask = 0;
best = -1;
- for (i = 0; i < NOPCODES; i++)
+ for (i = 0; i < numopcodes; i++)
{
register unsigned int opcode = m68k_opcodes[i].opcode;
register unsigned int match = m68k_opcodes[i].match;
switch (*d)
{
+ case 'c': /* cache identifier */
+ {
+ static char *cacheFieldName[] = { "NOP", "dc", "ic", "bc" };
+ val = fetch_arg (buffer, place, 2);
+ fprintf_filtered (stream, cacheFieldName[val]);
+ break;
+ }
+
+ case 'a': /* address register indirect only. Cf. case '+'. */
+ {
+ fprintf_filtered (stream,
+ "%s@",
+ reg_names [fetch_arg (buffer, place, 3) + 8]);
+ break;
+ }
+
+ case '_': /* 32-bit absolute address for move16. */
+ {
+ val = NEXTLONG (p);
+ fprintf_filtered (stream, "@#");
+ print_address (val, stream);
+ break;
+ }
+
case 'C':
fprintf_filtered (stream, "ccr");
break;
{
static struct { char *name; int value; } names[]
= {{"sfc", 0x000}, {"dfc", 0x001}, {"cacr", 0x002},
+ {"tc", 0x003}, {"itt0",0x004}, {"itt1", 0x005},
+ {"dtt0",0x006}, {"dtt1",0x007},
{"usp", 0x800}, {"vbr", 0x801}, {"caar", 0x802},
- {"msp", 0x803}, {"isp", 0x804}};
+ {"msp", 0x803}, {"isp", 0x804}, {"mmusr",0x805},
+ {"urp", 0x806}, {"srp", 0x807}};
val = fetch_arg (buffer, place, 12);
for (regno = sizeof names / sizeof names[0] - 1; regno >= 0; regno--)
fprintf_filtered (stream, "%s", reg_names[fetch_arg (buffer, place, 4)]);
break;
+ case 'r':
+ fprintf_filtered (stream, "%s@", reg_names[fetch_arg (buffer, place, 4)]);
+ break;
+
case 'F':
fprintf_filtered (stream, "fp%d", fetch_arg (buffer, place, 3));
break;
case '?':
case '/':
case '&':
+ case '`':
if (place == 'd')
{
#ifdef HAVE_68881
case 'x':
- ieee_extended_to_double (&ext_format_68881, p, &flval);
+ ieee_extended_to_double (&ext_format_68881,
+ (char *)p, &flval);
p += 12;
break;
#endif
val >>= 10;
break;
+ case 'e':
+ val = (buffer[1] >> 6);
+ break;
+
default:
abort ();
}
switch (bits)
{
+ case 2:
+ return val & 3;
case 3:
return val & 7;
case 4: