* stabsread.c (rs6000_builtin_type): Make logical types be
[external/binutils.git] / gdb / h8300-tdep.c
index ef54188..740799e 100644 (file)
@@ -48,13 +48,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #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 
 h8300_skip_prologue (start_pc)
      CORE_ADDR start_pc;
-
 {
   short int w;
 
@@ -92,7 +92,6 @@ h8300_skip_prologue (start_pc)
     }
 
   return start_pc;
-
 }
 
 int
@@ -102,7 +101,10 @@ print_insn (memaddr, stream)
 {
   disassemble_info info;
   GDB_INIT_DISASSEMBLE_INFO(info, stream);
-  return print_insn_h8300 (memaddr, &info);
+  if (HMODE)
+    return print_insn_h8300h (memaddr, &info);
+  else
+    return print_insn_h8300 (memaddr, &info);
 }
 
 /* Given a GDB frame, determine the address of the calling function's frame.
@@ -116,7 +118,6 @@ FRAME_ADDR
 FRAME_CHAIN (thisframe)
      FRAME thisframe;
 {
-
   frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0);
   return thisframe->fsr->regs[SP_REGNUM];
 }
@@ -178,12 +179,13 @@ CORE_ADDR
 NEXT_PROLOGUE_INSN (addr, lim, pword1)
      CORE_ADDR addr;
      CORE_ADDR lim;
-     short *pword1;
+     INSN_WORD *pword1;
 {
+  char buf[2];
   if (addr < lim + 8)
     {
-      read_memory (addr, pword1, sizeof (*pword1));
-      SWAP_TARGET_AND_HOST (pword1, sizeof (short));
+      read_memory (addr, buf, 2);
+      *pword1 = extract_signed_integer (buf, 2);
 
       return addr + 2;
     }
@@ -211,14 +213,13 @@ examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
   int r;
   int i;
   int have_fp = 0;
-
   register int src;
   register struct pic_prologue_code *pcode;
   INSN_WORD insn_word;
   int size, offset;
-  unsigned int reg_save_depth = 2; /* Number of things pushed onto
-                                     stack, starts at 2, 'cause the
-                                     PC is already there */
+  /* 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 auto_depth = 0; /* Number of bytes of autos */
 
@@ -233,7 +234,7 @@ examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
     {
       after_prolog_fp = read_register (SP_REGNUM);
     }
-  if (ip == 0 || ip & ~0xffff)
+  if (ip == 0 || ip & (HMODE ? ~0xffff : ~0xffff))
     return 0;
 
   next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word);
@@ -279,7 +280,6 @@ examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
 
          next_ip = NEXT_PROLOGUE_INSN (next_ip, limit, &insn_word);
          auto_depth += insn_word;
-
        }
     }
   /* Work out which regs are stored where */
@@ -319,7 +319,6 @@ init_extra_frame_info (fromleaf, fi)
   fi->args_pointer = 0;                /* Unknown */
   fi->locals_pointer = 0;      /* Unknown */
   fi->from_pc = 0;
-
 }
 
 /* Return the saved PC from this frame.
@@ -330,7 +329,6 @@ init_extra_frame_info (fromleaf, fi)
 CORE_ADDR
 frame_saved_pc (frame)
      FRAME frame;
-
 {
   return frame->from_pc;
 }
@@ -389,9 +387,7 @@ h8300_pop_frame ()
       flush_cached_frames ();
       set_current_frame (create_new_frame (read_register (FP_REGNUM),
                                           read_pc ()));
-
     }
-
 }
 
 void