* Rename remote-es1800.c to remote-es.c
[deliverable/binutils-gdb.git] / gdb / h8300-tdep.c
index c47c2666fcec8be3df6541a997966fd1f7a974f3..a08a80aa40fad16af3a9dd20cac6e2078109fb63 100644 (file)
@@ -26,6 +26,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "frame.h"
 #include "obstack.h"
 #include "symtab.h"
+#include <dis-asm.h>
+#undef NUM_REGS
+#define NUM_REGS 11
+
 #define UNSIGNED_SHORT(X) ((X) & 0xffff)
 
 /* an easy to debug H8 stack frame looks like:
@@ -54,19 +58,19 @@ h8300_skip_prologue (start_pc)
 {
   short int w;
 
-  w = read_memory_short (start_pc);
+  w = read_memory_unsigned_integer (start_pc, 2);
   /* Skip past all push insns */
   while (IS_PUSH_FP (w))
     {
       start_pc += 2;
-      w = read_memory_short (start_pc);
+      w = read_memory_unsigned_integer (start_pc, 2);
     }
 
   /* Skip past a move to FP */
   if (IS_MOVE_FP (w))
     {
       start_pc += 2;
-      w = read_memory_short (start_pc);
+      w = read_memory_unsigned_integer (start_pc, 2);
     }
 
   /* Skip the stack adjust */
@@ -74,17 +78,17 @@ h8300_skip_prologue (start_pc)
   if (IS_MOVK_R5 (w))
     {
       start_pc += 2;
-      w = read_memory_short (start_pc);
+      w = read_memory_unsigned_integer (start_pc, 2);
     }
   if (IS_SUB_R5SP (w))
     {
       start_pc += 2;
-      w = read_memory_short (start_pc);
+      w = read_memory_unsigned_integer (start_pc, 2);
     }
   while (IS_SUB2_SP (w))
     {
       start_pc += 2;
-      w = read_memory_short (start_pc);
+      w = read_memory_unsigned_integer (start_pc, 2);
     }
 
   return start_pc;
@@ -96,11 +100,9 @@ print_insn (memaddr, stream)
      CORE_ADDR memaddr;
      FILE *stream;
 {
-  /* Nothing is bigger than 8 bytes */
-  char data[8];
-
-  read_memory (memaddr, data, sizeof (data));
-  return print_insn_h8300 (memaddr, data, stream);
+  disassemble_info info;
+  GDB_INIT_DISASSEMBLE_INFO(info, stream);
+  return print_insn_h8300 (memaddr, &info);
 }
 
 /* Given a GDB frame, determine the address of the calling function's frame.
@@ -214,16 +216,16 @@ examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
   register struct pic_prologue_code *pcode;
   INSN_WORD insn_word;
   int size, offset;
-  unsigned int reg_save_depth = 2;     /* Number of things pushed onto
+  unsigned int reg_save_depth = 2; /* Number of things pushed onto
                                      stack, starts at 2, 'cause the
                                      PC is already there */
 
   unsigned int auto_depth = 0; /* Number of bytes of autos */
 
-  char in_frame[NUM_REGS];     /* One for each reg */
+  char in_frame[11];           /* One for each reg */
 
-  memset (in_frame, 1, NUM_REGS);
-  for (r = 0; r < NUM_REGS; r++)
+  memset (in_frame, 1, 11);
+  for (r = 0; r < 8; r++)
     {
       fsr->regs[r] = 0;
     }
@@ -294,14 +296,15 @@ examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
   /* Locals are always reffed based from the fp */
   fi->locals_pointer = after_prolog_fp;
   /* The PC is at a known place */
-  fi->from_pc = read_memory_short (after_prolog_fp + 2);
+  fi->from_pc = read_memory_unsigned_integer (after_prolog_fp + 2, BINWORD);
 
   /* Rememeber any others too */
   in_frame[PC_REGNUM] = 0;
 
   if (have_fp)
     /* We keep the old FP in the SP spot */
-    fsr->regs[SP_REGNUM] = (read_memory_short (fsr->regs[6]));
+    fsr->regs[SP_REGNUM] = (read_memory_unsigned_integer
+                           (fsr->regs[6]), BINWORD);
   else
     fsr->regs[SP_REGNUM] = after_prolog_fp + auto_depth;
 
@@ -377,11 +380,11 @@ h8300_pop_frame ()
   fi = get_frame_info (frame);
   get_frame_saved_regs (fi, &fsr);
 
-  for (regnum = 0; regnum < NUM_REGS; regnum++)
+  for (regnum = 0; regnum < 8; regnum++)
     {
       if (fsr.regs[regnum])
        {
-         write_register (regnum, read_memory_short (fsr.regs[regnum]));
+         write_register (regnum, read_memory_integer(fsr.regs[regnum]), BINWORD);
        }
 
       flush_cached_frames ();
This page took 0.024714 seconds and 4 git commands to generate.