#include "obstack.h"
#include "symtab.h"
#include <dis-asm.h>
+#include "gdbcmd.h"
+#include "gdbtypes.h"
+
#undef NUM_REGS
#define NUM_REGS 11
#define IS_SUB2_SP(x) (x==0x1b87)
#define IS_MOVK_R5(x) (x==0x7905)
#define IS_SUB_R5SP(x) (x==0x1957)
-CORE_ADDR examine_prologue ();
+
+static CORE_ADDR examine_prologue ();
void frame_find_saved_regs ();
CORE_ADDR
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO(info, stream);
- if (HMODE)
+ if (h8300hmode)
return print_insn_h8300h (memaddr, &info);
else
return print_insn_h8300 (memaddr, &info);
cache_fsr = (struct frame_saved_regs *)
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_saved_regs));
- bzero (cache_fsr, sizeof (struct frame_saved_regs));
+ memset (cache_fsr, '\0', sizeof (struct frame_saved_regs));
fi->fsr = cache_fsr;
int size, offset;
/* Number of things pushed onto stack, starts at 2/4, 'cause the
PC is already there */
- unsigned int reg_save_depth = HMODE ? 4 : 2;
+ unsigned int reg_save_depth = h8300hmode ? 4 : 2;
unsigned int auto_depth = 0; /* Number of bytes of autos */
{
after_prolog_fp = read_register (SP_REGNUM);
}
- if (ip == 0 || ip & (HMODE ? ~0xffff : ~0xffff))
+ if (ip == 0 || ip & (h8300hmode ? ~0xffff : ~0xffff))
return 0;
next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word);
}
}
+
+struct cmd_list_element *setmemorylist;
+
+static void
+h8300_command(args, from_tty)
+{
+ extern int h8300hmode;
+ h8300hmode = 0;
+}
+
+static void
+h8300h_command(args, from_tty)
+{
+ extern int h8300hmode;
+ h8300hmode = 1;
+}
+
+static void
+set_machine (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ printf_unfiltered ("\"set machine\" must be followed by h8300 or h8300h.\n");
+ help_list (setmemorylist, "set memory ", -1, gdb_stdout);
+}
+
+void
+_initialize_h8300m ()
+{
+ add_prefix_cmd ("machine", no_class, set_machine,
+ "set the machine type", &setmemorylist, "set machine ", 0,
+ &setlist);
+
+ add_cmd ("h8300", class_support, h8300_command,
+ "Set machine to be H8/300.", &setmemorylist);
+
+ add_cmd ("h8300h", class_support, h8300h_command,
+ "Set machine to be H8/300H.", &setmemorylist);
+}
+
+
+
void
print_register_hook (regno)
{
if (regno == 8)
{
/* CCR register */
-
int C, Z, N, V;
- unsigned char b[2];
+ unsigned char b[4];
unsigned char l;
-
read_relative_register_raw_bytes (regno, b);
- l = b[1];
- printf ("\t");
- printf ("I-%d - ", (l & 0x80) != 0);
- printf ("H-%d - ", (l & 0x20) != 0);
+ l = b[REGISTER_VIRTUAL_SIZE(8) -1];
+ printf_unfiltered ("\t");
+ printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
+ printf_unfiltered ("H-%d - ", (l & 0x20) != 0);
N = (l & 0x8) != 0;
Z = (l & 0x4) != 0;
V = (l & 0x2) != 0;
C = (l & 0x1) != 0;
- printf ("N-%d ", N);
- printf ("Z-%d ", Z);
- printf ("V-%d ", V);
- printf ("C-%d ", C);
+ printf_unfiltered ("N-%d ", N);
+ printf_unfiltered ("Z-%d ", Z);
+ printf_unfiltered ("V-%d ", V);
+ printf_unfiltered ("C-%d ", C);
if ((C | Z) == 0)
- printf ("u> ");
+ printf_unfiltered ("u> ");
if ((C | Z) == 1)
- printf ("u<= ");
+ printf_unfiltered ("u<= ");
if ((C == 0))
- printf ("u>= ");
+ printf_unfiltered ("u>= ");
if (C == 1)
- printf ("u< ");
+ printf_unfiltered ("u< ");
if (Z == 0)
- printf ("!= ");
+ printf_unfiltered ("!= ");
if (Z == 1)
- printf ("== ");
+ printf_unfiltered ("== ");
if ((N ^ V) == 0)
- printf (">= ");
+ printf_unfiltered (">= ");
if ((N ^ V) == 1)
- printf ("< ");
+ printf_unfiltered ("< ");
if ((Z | (N ^ V)) == 0)
- printf ("> ");
+ printf_unfiltered ("> ");
if ((Z | (N ^ V)) == 1)
- printf ("<= ");
+ printf_unfiltered ("<= ");
}
}
+