* readelf.c (main): Reset dump request after each file.
[deliverable/binutils-gdb.git] / gdb / sh-tdep.c
index d840e5ae8635530488ad83c7aec90dd02ba6e62b..dc68b15fad5a44d62f07cf19933ebc0f533c8115 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "defs.h"
 #include "frame.h"
-#include "obstack.h"
 #include "symtab.h"
 #include "symfile.h"
 #include "gdbtypes.h"
@@ -885,7 +884,14 @@ sh_saved_pc_after_call (struct frame_info *frame)
 static int
 sh_use_struct_convention (int gcc_p, struct type *type)
 {
+#if 0
   return (TYPE_LENGTH (type) > 1);
+#else
+  int len = TYPE_LENGTH (type);
+  int nelem = TYPE_NFIELDS (type);
+  return ((len != 1 && len != 2 && len != 4 && len != 8) || nelem != 1) &&
+         (len != 8 || TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) != 4);
+#endif
 }
 
 static int
@@ -912,19 +918,20 @@ gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info)
   return print_insn_sh (memaddr, info);
 }
 
-/* Given a GDB frame, determine the address of the calling function's frame.
-   This will be used to create a new GDB frame struct, and then
-   INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+/* Given a GDB frame, determine the address of the calling function's
+   frame.  This will be used to create a new GDB frame struct, and
+   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
+   called for the new frame.
 
    For us, the frame address is its stack pointer value, so we look up
    the function prologue to determine the caller's sp value, and return it.  */
 static CORE_ADDR
 sh_frame_chain (struct frame_info *frame)
 {
-  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     return frame->frame;       /* dummy frame same as caller's frame */
   if (frame->pc && !inside_entry_file (frame->pc))
-    return read_memory_integer (FRAME_FP (frame) + frame->extra_info->f_offset, 4);
+    return read_memory_integer (get_frame_base (frame) + frame->extra_info->f_offset, 4);
   else
     return 0;
 }
@@ -959,7 +966,7 @@ translate_insn_rn (int rn, int media_mode)
 static CORE_ADDR
 sh64_frame_chain (struct frame_info *frame)
 {
-  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     return frame->frame;       /* dummy frame same as caller's frame */
   if (frame->pc && !inside_entry_file (frame->pc))
     {
@@ -969,7 +976,7 @@ sh64_frame_chain (struct frame_info *frame)
        size = 4;
       else
        size = REGISTER_RAW_SIZE (translate_insn_rn (FP_REGNUM, media_mode));
-      return read_memory_integer (FRAME_FP (frame) + frame->extra_info->f_offset, size);
+      return read_memory_integer (get_frame_base (frame) + frame->extra_info->f_offset, size);
     }
   else
     return 0;
@@ -984,10 +991,10 @@ static CORE_ADDR
 sh_find_callers_reg (struct frame_info *fi, int regnum)
 {
   for (; fi; fi = fi->next)
-    if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+    if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
       /* When the caller requests PR from the dummy frame, we return PC because
          that's where the previous routine appears to have done a call from. */
-      return generic_read_register_dummy (fi->pc, fi->frame, regnum);
+      return deprecated_read_register_dummy (fi->pc, fi->frame, regnum);
     else
       {
        FRAME_INIT_SAVED_REGS (fi);
@@ -1006,10 +1013,10 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum)
   int media_mode = 0;
 
   for (; fi; fi = fi->next)
-    if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+    if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
       /* When the caller requests PR from the dummy frame, we return PC because
          that's where the previous routine appears to have done a call from. */
-      return generic_read_register_dummy (fi->pc, fi->frame, pr_regnum);
+      return deprecated_read_register_dummy (fi->pc, fi->frame, pr_regnum);
     else
       {
        FRAME_INIT_SAVED_REGS (fi);
@@ -1719,15 +1726,15 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi)
   if (fi->next)
     fi->pc = FRAME_SAVED_PC (fi->next);
 
-  if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
     {
       /* We need to setup fi->frame here because run_stack_dummy gets it wrong
          by assuming it's always FP.  */
-      fi->frame = generic_read_register_dummy (fi->pc, fi->frame,
-                                              SP_REGNUM);
-      fi->extra_info->return_pc = generic_read_register_dummy (fi->pc,
-                                                              fi->frame,
-                                                              PC_REGNUM);
+      fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame,
+                                                 SP_REGNUM);
+      fi->extra_info->return_pc = deprecated_read_register_dummy (fi->pc,
+                                                                 fi->frame,
+                                                                 PC_REGNUM);
       fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4);
       fi->extra_info->leaf_function = 0;
       return;
@@ -1751,14 +1758,14 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi)
   if (fi->next)
     fi->pc = FRAME_SAVED_PC (fi->next);
 
-  if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
     {
       /* We need to setup fi->frame here because run_stack_dummy gets it wrong
          by assuming it's always FP.  */
-      fi->frame = generic_read_register_dummy (fi->pc, fi->frame,
-                                              SP_REGNUM);
+      fi->frame = deprecated_read_register_dummy (fi->pc, fi->frame,
+                                                 SP_REGNUM);
       fi->extra_info->return_pc = 
-       generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
+       deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
       fi->extra_info->f_offset = -(CALL_DUMMY_LENGTH + 4);
       fi->extra_info->leaf_function = 0;
       return;
@@ -1808,7 +1815,7 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
 
   while (frame && ((frame = frame->next) != NULL))
     {
-      if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+      if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
        {
          if (lval)             /* found it in a CALL_DUMMY frame */
            *lval = not_lval;
@@ -1868,7 +1875,7 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
   if (addrp)
     *addrp = REGISTER_BYTE (live_regnum);
   if (raw_buffer)
-    read_register_gen (live_regnum, raw_buffer);
+    deprecated_read_register_gen (live_regnum, raw_buffer);
 }
 
 /* Extract from an array REGBUF containing the (raw) register state
@@ -1902,11 +1909,11 @@ sh_pop_frame (void)
   register CORE_ADDR fp;
   register int regnum;
 
-  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     generic_pop_dummy_frame ();
   else
     {
-      fp = FRAME_FP (frame);
+      fp = get_frame_base (frame);
       FRAME_INIT_SAVED_REGS (frame);
 
       /* Copy regs from where they were saved in the frame */
@@ -1932,11 +1939,11 @@ sh64_pop_frame (void)
 
   int media_mode = pc_is_isa32 (frame->pc);
 
-  if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
     generic_pop_dummy_frame ();
   else
     {
-      fp = FRAME_FP (frame);
+      fp = get_frame_base (frame);
       FRAME_INIT_SAVED_REGS (frame);
 
       /* Copy regs from where they were saved in the frame */
@@ -2046,8 +2053,11 @@ sh_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
       if (len < 4)
        {
          /* value gets right-justified in the register or stack word */
-         memcpy (valbuf + (4 - len),
-                 (char *) VALUE_CONTENTS (args[argnum]), len);
+         if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+           memcpy (valbuf + (4 - len),
+                   (char *) VALUE_CONTENTS (args[argnum]), len);
+         else
+           memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len);
          val = valbuf;
        }
       else
@@ -2214,7 +2224,8 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
              if (float_arg_index <= tdep->FLOAT_ARGLAST_REGNUM)
                {
                  /* Goes in FR0...FR11 */
-                 write_register_gen (FP0_REGNUM + float_arg_index, val);
+                 deprecated_write_register_gen (FP0_REGNUM + float_arg_index,
+                                                val);
                  fp_args[float_arg_index] = 1;
                  /* Skip the corresponding general argument register. */
                  int_argreg ++;
@@ -2257,7 +2268,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
                       call the gdbarch function to do register
                       writes, and that will properly know how to deal
                       with pseudoregs. */
-                   write_register_gen (regnum, val);
+                   deprecated_write_register_gen (regnum, val);
                    fp_args[double_arg_index] = 1;
                    fp_args[double_arg_index + 1] = 1;
                    /* Skip the corresponding general argument register. */
@@ -2458,22 +2469,25 @@ sh_default_store_return_value (struct type *type, char *valbuf)
     {
       /* Add leading zeros to the value. */
       memset (buf, 0, REGISTER_RAW_SIZE (R0_REGNUM));
-      memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
-             valbuf, TYPE_LENGTH (type));
-      write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf, 
-                           REGISTER_RAW_SIZE (R0_REGNUM));
+      if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+       memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
+               valbuf, TYPE_LENGTH (type));
+      else
+       memcpy (buf, valbuf, TYPE_LENGTH (type));
+      deprecated_write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf, 
+                                      REGISTER_RAW_SIZE (R0_REGNUM));
     }
   else
-    write_register_bytes (REGISTER_BYTE (R0_REGNUM), valbuf, 
-                         TYPE_LENGTH (type));
+    deprecated_write_register_bytes (REGISTER_BYTE (R0_REGNUM), valbuf, 
+                                    TYPE_LENGTH (type));
 }
 
 static void
 sh3e_sh4_store_return_value (struct type *type, char *valbuf)
 {
   if (TYPE_CODE (type) == TYPE_CODE_FLT) 
-    write_register_bytes (REGISTER_BYTE (FP0_REGNUM), 
-                         valbuf, TYPE_LENGTH (type));
+    deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), 
+                                    valbuf, TYPE_LENGTH (type));
   else
     sh_default_store_return_value (type, valbuf);
 }
@@ -2489,7 +2503,7 @@ sh64_store_return_value (struct type *type, char *valbuf)
       if (len == 4)
        {
          /* Return value stored in FP0_REGNUM */
-         write_register_gen (FP0_REGNUM, valbuf);
+         deprecated_write_register_gen (FP0_REGNUM, valbuf);
        }
       if (len == 8)
        {
@@ -2512,10 +2526,10 @@ sh64_store_return_value (struct type *type, char *valbuf)
            offset = REGISTER_RAW_SIZE (return_register) - len;
 
          memcpy (buf + offset, valbuf, len);
-         write_register_gen (return_register, buf);
+         deprecated_write_register_gen (return_register, buf);
        }
       else
-       write_register_gen (return_register, valbuf);
+       deprecated_write_register_gen (return_register, valbuf);
     }
 }
 
@@ -2924,7 +2938,7 @@ sh64_show_compact_regs (void)
 static void
 sh64_show_regs (void)
 {
-  if (pc_is_isa32 (selected_frame->pc))
+  if (pc_is_isa32 (deprecated_selected_frame->pc))
     sh64_show_media_regs ();
   else
     sh64_show_compact_regs ();
@@ -3332,7 +3346,7 @@ sh_sh64_register_convert_to_virtual (int regnum, struct type *type,
 
 static void
 sh_sh4_register_convert_to_raw (struct type *type, int regnum,
-                               char *from, char *to)
+                               const void *from, void *to)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
 
@@ -3348,7 +3362,7 @@ sh_sh4_register_convert_to_raw (struct type *type, int regnum,
 
 void
 sh_sh64_register_convert_to_raw (struct type *type, int regnum,
-                              char *from, char *to)
+                                const void *from, void *to)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
 
@@ -3372,11 +3386,12 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum,
 }
 
 void
-sh_pseudo_register_read (int reg_nr, char *buffer)
+sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+                        int reg_nr, void *buffer)
 {
   int base_regnum, portion;
   char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 
 
   if (reg_nr >= tdep->DR0_REGNUM 
       && reg_nr <= tdep->DR_LAST_REGNUM)
@@ -3386,7 +3401,7 @@ sh_pseudo_register_read (int reg_nr, char *buffer)
       /* Build the value in the provided buffer. */ 
       /* Read the real regs for which this one is an alias.  */
       for (portion = 0; portion < 2; portion++)
-       regcache_raw_read (current_regcache, base_regnum + portion, 
+       regcache_raw_read (regcache, base_regnum + portion, 
                           (temp_buffer
                            + REGISTER_RAW_SIZE (base_regnum) * portion));
       /* We must pay attention to the endiannes. */
@@ -3401,30 +3416,21 @@ sh_pseudo_register_read (int reg_nr, char *buffer)
 
       /* Read the real regs for which this one is an alias.  */
       for (portion = 0; portion < 4; portion++)
-       regcache_raw_read (current_regcache, base_regnum + portion, 
-                          buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+       regcache_raw_read (regcache, base_regnum + portion, 
+                          ((char *) buffer
+                           + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 }
 
 static void
-sh4_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer)
-{
-  if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM)
-    /* It is a regular register. */
-    regcache_raw_read (current_regcache, reg_nr, buffer);
-  else
-    /* It is a pseudo register and we need to construct its value */
-    sh_pseudo_register_read (reg_nr, buffer);
-}
-
-static void
-sh64_pseudo_register_read (int reg_nr, char *buffer)
+sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+                          int reg_nr, void *buffer)
 {
   int base_regnum;
   int portion;
   int offset = 0;
   char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 
 
   if (reg_nr >= tdep->DR0_REGNUM 
       && reg_nr <= tdep->DR_LAST_REGNUM)
@@ -3435,7 +3441,7 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
       /* DR regs are double precision registers obtained by
         concatenating 2 single precision floating point registers. */
       for (portion = 0; portion < 2; portion++)
-       regcache_raw_read (current_regcache, base_regnum + portion, 
+       regcache_raw_read (regcache, base_regnum + portion, 
                           (temp_buffer
                            + REGISTER_RAW_SIZE (base_regnum) * portion));
 
@@ -3454,8 +3460,8 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
       /* FPP regs are pairs of single precision registers obtained by
         concatenating 2 single precision floating point registers. */
       for (portion = 0; portion < 2; portion++)
-       regcache_raw_read (current_regcache, base_regnum + portion, 
-                          (buffer
+       regcache_raw_read (regcache, base_regnum + portion, 
+                          ((char *) buffer
                            + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 
@@ -3468,8 +3474,8 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
       /* FV regs are vectors of single precision registers obtained by
         concatenating 4 single precision floating point registers. */
       for (portion = 0; portion < 4; portion++)
-       regcache_raw_read (current_regcache, base_regnum + portion, 
-                          (buffer
+       regcache_raw_read (regcache, base_regnum + portion, 
+                          ((char *) buffer
                            + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 
@@ -3480,7 +3486,7 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
       base_regnum = sh64_compact_reg_base_num (reg_nr);
 
       /* Build the value in the provided buffer. */ 
-      regcache_raw_read (current_regcache, base_regnum, temp_buffer);
+      regcache_raw_read (regcache, base_regnum, temp_buffer);
       if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
        offset = 4;
       memcpy (buffer, temp_buffer + offset, 4); /* get LOWER 32 bits only????*/
@@ -3494,7 +3500,7 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
       /* Build the value in the provided buffer. */ 
       /* Floating point registers map 1-1 to the media fp regs,
         they have the same size and endienness. */
-      regcache_raw_read (current_regcache, base_regnum, buffer);
+      regcache_raw_read (regcache, base_regnum, buffer);
     }
 
   else if (reg_nr >= tdep->DR0_C_REGNUM 
@@ -3505,7 +3511,7 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
       /* DR_C regs are double precision registers obtained by
         concatenating 2 single precision floating point registers. */
       for (portion = 0; portion < 2; portion++)
-       regcache_raw_read (current_regcache, base_regnum + portion, 
+       regcache_raw_read (regcache, base_regnum + portion, 
                           (temp_buffer
                            + REGISTER_RAW_SIZE (base_regnum) * portion));
 
@@ -3523,8 +3529,8 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
       /* FV_C regs are vectors of single precision registers obtained by
         concatenating 4 single precision floating point registers. */
       for (portion = 0; portion < 4; portion++)
-       regcache_raw_read (current_regcache, base_regnum + portion, 
-                          (buffer
+       regcache_raw_read (regcache, base_regnum + portion, 
+                          ((char *) buffer
                            + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 
@@ -3556,11 +3562,11 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
        */
       /* *INDENT-ON* */
       /* Get FPSCR into a local buffer */
-      regcache_raw_read (current_regcache, fpscr_base_regnum, temp_buffer);
+      regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer);
       /* Get value as an int. */
       fpscr_value = extract_unsigned_integer (temp_buffer, 4);
       /* Get SR into a local buffer */
-      regcache_raw_read (current_regcache, sr_base_regnum, temp_buffer);
+      regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
       /* Get value as an int. */
       sr_value = extract_unsigned_integer (temp_buffer, 4);
       /* Build the new value. */
@@ -3578,28 +3584,17 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
 
       /* FPUL_C register is floating point register 32,
         same size, same endianness. */
-      regcache_raw_read (current_regcache, base_regnum, buffer);
+      regcache_raw_read (regcache, base_regnum, buffer);
     }
 }
 
-static void
-sh64_register_read (struct gdbarch *gdbarch, int reg_nr, char *buffer)
-{
-
-  if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM)
-    /* It is a regular register. */
-    regcache_raw_read (current_regcache, reg_nr, buffer);
-  else
-    /* It is a pseudo register and we need to construct its value */
-    sh64_pseudo_register_read (reg_nr, buffer);
-}
-
 void
-sh_pseudo_register_write (int reg_nr, char *buffer)
+sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+                         int reg_nr, const void *buffer)
 {
   int base_regnum, portion;
   char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 
 
   if (reg_nr >= tdep->DR0_REGNUM
       && reg_nr <= tdep->DR_LAST_REGNUM)
@@ -3612,7 +3607,7 @@ sh_pseudo_register_write (int reg_nr, char *buffer)
 
       /* Write the real regs for which this one is an alias.  */
       for (portion = 0; portion < 2; portion++)
-       regcache_raw_write (current_regcache, base_regnum + portion, 
+       regcache_raw_write (regcache, base_regnum + portion, 
                            (temp_buffer
                             + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
@@ -3623,30 +3618,20 @@ sh_pseudo_register_write (int reg_nr, char *buffer)
 
       /* Write the real regs for which this one is an alias.  */
       for (portion = 0; portion < 4; portion++)
-       regcache_raw_write (current_regcache, base_regnum + portion,
-                           (buffer
+       regcache_raw_write (regcache, base_regnum + portion,
+                           ((char *) buffer
                             + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 }
 
-static void
-sh4_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer)
-{
-  if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM)
-    /* It is a regular register. */
-    regcache_raw_write (current_regcache, reg_nr, buffer);
-  else
-    /* It is a pseudo register and we need to construct its value */
-    sh_pseudo_register_write (reg_nr, buffer);
-}
-
 void
-sh64_pseudo_register_write (int reg_nr, char *buffer)
+sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+                           int reg_nr, const void *buffer)
 {
   int base_regnum, portion;
   int offset;
   char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   if (reg_nr >= tdep->DR0_REGNUM
       && reg_nr <= tdep->DR_LAST_REGNUM)
@@ -3659,7 +3644,7 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
 
       /* Write the real regs for which this one is an alias.  */
       for (portion = 0; portion < 2; portion++)
-       regcache_raw_write (current_regcache, base_regnum + portion, 
+       regcache_raw_write (regcache, base_regnum + portion, 
                            (temp_buffer
                             + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
@@ -3671,8 +3656,8 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
 
       /* Write the real regs for which this one is an alias.  */
       for (portion = 0; portion < 2; portion++)
-       regcache_raw_write (current_regcache, base_regnum + portion,
-                           (buffer
+       regcache_raw_write (regcache, base_regnum + portion,
+                           ((char *) buffer
                             + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 
@@ -3683,8 +3668,8 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
 
       /* Write the real regs for which this one is an alias.  */
       for (portion = 0; portion < 4; portion++)
-       regcache_raw_write (current_regcache, base_regnum + portion,
-                           (buffer
+       regcache_raw_write (regcache, base_regnum + portion,
+                           ((char *) buffer
                             + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 
@@ -3702,10 +3687,10 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
       /* Let's read the value of the base register into a temporary
         buffer, so that overwriting the last four bytes with the new
         value of the pseudo will leave the upper 4 bytes unchanged. */
-      regcache_raw_read (current_regcache, base_regnum, temp_buffer);
+      regcache_raw_read (regcache, base_regnum, temp_buffer);
       /* Write as an 8 byte quantity */
       memcpy (temp_buffer + offset, buffer, 4);
-      regcache_raw_write (current_regcache, base_regnum, temp_buffer);
+      regcache_raw_write (regcache, base_regnum, temp_buffer);
     }
 
   /* sh floating point compact pseudo registers. 1-to-1 with a shmedia
@@ -3714,7 +3699,7 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
               && reg_nr <= tdep->FP_LAST_C_REGNUM)
     {
       base_regnum = sh64_compact_reg_base_num (reg_nr);
-      regcache_raw_write (current_regcache, base_regnum, buffer);
+      regcache_raw_write (regcache, base_regnum, buffer);
     }
 
   else if (reg_nr >= tdep->DR0_C_REGNUM 
@@ -3727,7 +3712,7 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
          sh_sh64_register_convert_to_raw (REGISTER_VIRTUAL_TYPE (reg_nr), reg_nr,
                                           buffer, temp_buffer);
 
-         regcache_raw_write (current_regcache, base_regnum + portion,
+         regcache_raw_write (regcache, base_regnum + portion,
                              (temp_buffer
                               + REGISTER_RAW_SIZE (base_regnum) * portion));
        }
@@ -3740,8 +3725,8 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
      
       for (portion = 0; portion < 4; portion++)
        {
-         regcache_raw_write (current_regcache, base_regnum + portion,
-                             (buffer
+         regcache_raw_write (regcache, base_regnum + portion,
+                             ((char *) buffer
                               + REGISTER_RAW_SIZE (base_regnum) * portion));
        }
     }
@@ -3784,39 +3769,28 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
       fpscr_value = fpscr_c_value & fpscr_mask;
       sr_value = (fpscr_value & sr_mask) >> 6;
       
-      regcache_raw_read (current_regcache, fpscr_base_regnum, temp_buffer);
+      regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer);
       old_fpscr_value = extract_unsigned_integer (temp_buffer, 4);
       old_fpscr_value &= 0xfffc0002;
       fpscr_value |= old_fpscr_value;
       store_unsigned_integer (temp_buffer, 4, fpscr_value);
-      regcache_raw_write (current_regcache, fpscr_base_regnum, temp_buffer);
+      regcache_raw_write (regcache, fpscr_base_regnum, temp_buffer);
       
-      regcache_raw_read (current_regcache, sr_base_regnum, temp_buffer);
+      regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
       old_sr_value = extract_unsigned_integer (temp_buffer, 4);
       old_sr_value &= 0xffff8fff;
       sr_value |= old_sr_value;
       store_unsigned_integer (temp_buffer, 4, sr_value);
-      regcache_raw_write (current_regcache, sr_base_regnum, temp_buffer);
+      regcache_raw_write (regcache, sr_base_regnum, temp_buffer);
     }
 
   else if (reg_nr == tdep->FPUL_C_REGNUM)
     {
       base_regnum = sh64_compact_reg_base_num (reg_nr);
-      regcache_raw_write (current_regcache, base_regnum, buffer);
+      regcache_raw_write (regcache, base_regnum, buffer);
     }
 }
 
-static void
-sh64_register_write (struct gdbarch *gdbarch, int reg_nr, char *buffer)
-{
-  if (reg_nr >= 0 && reg_nr < gdbarch_tdep (current_gdbarch)->DR0_REGNUM)
-    /* It is a regular register. */
-    regcache_raw_write (current_regcache, reg_nr, buffer);
-  else
-    /* It is a pseudo register and we need to construct its value */
-    sh64_pseudo_register_write (reg_nr, buffer);
-}
-
 /* Floating point vector of 4 float registers. */
 static void
 do_fv_register_info (int fv_regnum)
@@ -3946,7 +3920,7 @@ sh_do_fp_register (int regnum)
   raw_buffer = (char *) alloca (REGISTER_RAW_SIZE (FP0_REGNUM));
 
   /* Get the data in raw format.  */
-  if (!frame_register_read (selected_frame, regnum, raw_buffer))
+  if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
     error ("can't read register %d (%s)", regnum, REGISTER_NAME (regnum));
 
   /* Get the register as a number */ 
@@ -4028,7 +4002,7 @@ sh_do_register (int regnum)
   print_spaces_filtered (15 - strlen (REGISTER_NAME (regnum)), gdb_stdout);
 
   /* Get the data in raw format.  */
-  if (!frame_register_read (selected_frame, regnum, raw_buffer))
+  if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
     printf_filtered ("*value not available*\n");
       
   val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0, 0,
@@ -4139,7 +4113,7 @@ sh_compact_do_registers_info (int regnum, int fpregs)
 void
 sh64_do_registers_info (int regnum, int fpregs)
 {
-  if (pc_is_isa32 (selected_frame->pc))
+  if (pc_is_isa32 (deprecated_selected_frame->pc))
    sh_do_registers_info (regnum, fpregs);
   else
    sh_compact_do_registers_info (regnum, fpregs); 
@@ -4240,7 +4214,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
   gdbarch_register_name_ftype *sh_register_name;
-  gdbarch_store_return_value_ftype *sh_store_return_value;
+  gdbarch_deprecated_store_return_value_ftype *sh_store_return_value;
   gdbarch_register_virtual_type_ftype *sh_register_virtual_type;
   enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
@@ -4268,6 +4242,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   tdep = XMALLOC (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
 
+  /* NOTE: cagney/2002-12-06: This can be deleted when this arch is
+     ready to unwind the PC first (see frame.c:get_prev_frame()).  */
+  set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
+
   tdep->osabi = osabi;
 
   /* Initialize the register numbers that are not common to all the
@@ -4317,10 +4295,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pc_regnum (gdbarch, 16);
   set_gdbarch_register_size (gdbarch, 4);
   set_gdbarch_register_bytes (gdbarch, SH_DEFAULT_NUM_REGS * 4);
-  set_gdbarch_do_registers_info (gdbarch, sh_do_registers_info);
+  set_gdbarch_deprecated_do_registers_info (gdbarch, sh_do_registers_info);
   set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
   set_gdbarch_frame_chain (gdbarch, sh_frame_chain);
-  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+  set_gdbarch_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
   set_gdbarch_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
   set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
@@ -4449,8 +4427,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_num_pseudo_regs (gdbarch, 12);
       set_gdbarch_max_register_raw_size (gdbarch, 4 * 4);
       set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
-      set_gdbarch_register_read (gdbarch, sh4_register_read);
-      set_gdbarch_register_write (gdbarch, sh4_register_write);
+      set_gdbarch_pseudo_register_read (gdbarch, sh_pseudo_register_read);
+      set_gdbarch_pseudo_register_write (gdbarch, sh_pseudo_register_write);
       tdep->FPUL_REGNUM = 23;
       tdep->FPSCR_REGNUM = 24;
       tdep->FP_LAST_REGNUM = 40;
@@ -4541,10 +4519,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       /* Or should that go in the virtual_size? */
       /*set_gdbarch_max_register_virtual_size (gdbarch, 8);*/
       set_gdbarch_max_register_virtual_size (gdbarch, 4 * 4);
-      set_gdbarch_register_read (gdbarch, sh64_register_read);
-      set_gdbarch_register_write (gdbarch, sh64_register_write);
+      set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read);
+      set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write);
 
-      set_gdbarch_do_registers_info (gdbarch, sh64_do_registers_info);
+      set_gdbarch_deprecated_do_registers_info (gdbarch, sh64_do_registers_info);
       set_gdbarch_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
       set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc);
       set_gdbarch_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
@@ -4585,16 +4563,13 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
   set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
   set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
-  set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);/*??should be 8?*/
+  set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
 
-  set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
   set_gdbarch_call_dummy_length (gdbarch, 0);
-  set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
   set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
   set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); /*???*/
   set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
   set_gdbarch_call_dummy_start_offset (gdbarch, 0);
-  set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy);
   set_gdbarch_call_dummy_words (gdbarch, sh_call_dummy_words);
   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (sh_call_dummy_words));
   set_gdbarch_call_dummy_p (gdbarch, 1);
@@ -4606,7 +4581,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, sh_push_return_address);
 
-  set_gdbarch_store_return_value (gdbarch, sh_store_return_value);
+  set_gdbarch_deprecated_store_return_value (gdbarch, sh_store_return_value);
   set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
@@ -4616,8 +4591,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
   set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid);
   set_gdbarch_frame_saved_pc (gdbarch, sh_frame_saved_pc);
-  set_gdbarch_frame_args_address (gdbarch, default_frame_address);
-  set_gdbarch_frame_locals_address (gdbarch, default_frame_address);
   set_gdbarch_saved_pc_after_call (gdbarch, sh_saved_pc_after_call);
   set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
This page took 0.034859 seconds and 4 git commands to generate.