2002-09-17 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / sh-tdep.c
index 5beea2990a0d697ac8e17f9c5b610e03fcc3bf73..7ac5b9ef57f3bc8924fc2a920cede5b5469cf234 100644 (file)
@@ -986,7 +986,7 @@ sh_find_callers_reg (struct frame_info *fi, int regnum)
     if (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);
@@ -1008,7 +1008,7 @@ sh64_get_saved_pr (struct frame_info *fi, int pr_regnum)
     if (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);
@@ -1722,11 +1722,11 @@ sh_init_extra_frame_info (int fromleaf, struct frame_info *fi)
     {
       /* 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;
@@ -1754,10 +1754,10 @@ sh64_init_extra_frame_info (int fromleaf, struct frame_info *fi)
     {
       /* 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;
@@ -3331,7 +3331,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); 
 
@@ -3347,7 +3347,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); 
 
@@ -3371,11 +3371,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)
@@ -3385,7 +3386,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. */
@@ -3400,30 +3401,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)
@@ -3434,7 +3426,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));
 
@@ -3453,8 +3445,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));
     }
 
@@ -3467,8 +3459,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));
     }
 
@@ -3479,7 +3471,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????*/
@@ -3493,7 +3485,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 
@@ -3504,7 +3496,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));
 
@@ -3522,8 +3514,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));
     }
 
@@ -3555,11 +3547,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. */
@@ -3577,28 +3569,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)
@@ -3611,7 +3592,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));
     }
@@ -3622,30 +3603,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)
@@ -3658,7 +3629,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));
     }
@@ -3670,8 +3641,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));
     }
 
@@ -3682,8 +3653,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));
     }
 
@@ -3701,10 +3672,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
@@ -3713,7 +3684,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 
@@ -3726,7 +3697,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));
        }
@@ -3739,8 +3710,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));
        }
     }
@@ -3783,39 +3754,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)
@@ -4239,7 +4199,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;
 
@@ -4448,8 +4408,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;
@@ -4540,8 +4500,8 @@ 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_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
@@ -4605,7 +4565,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);
This page took 0.032447 seconds and 4 git commands to generate.