Reviewed and approved by Alan Modra <amodra@bigpond.net.au>
[deliverable/binutils-gdb.git] / gdb / sh64-tdep.c
index 8c6df0130609e7748bffa11514a6ecf85be9e3fd..f0fba0dc63d707d4937f2a909630bbaacc9c2d59 100644 (file)
@@ -1,6 +1,7 @@
 /* Target-dependent code for Renesas Super-H, for GDB.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002, 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -27,7 +28,7 @@
 #include "defs.h"
 #include "frame.h"
 #include "symtab.h"
-#include "symfile.h"
+#include "objfiles.h"
 #include "gdbtypes.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
@@ -119,7 +120,7 @@ struct frame_extra_info
 };
 
 static const char *
-sh_sh64_register_name (int reg_nr)
+sh64_register_name (int reg_nr)
 {
   static char *register_names[] =
   {
@@ -248,7 +249,7 @@ pc_is_isa32 (bfd_vma memaddr)
 }
 
 static const unsigned char *
-sh_sh64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
+sh64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   /* The BRK instruction for shmedia is 
      01101111 11110101 11111111 11110000
@@ -830,12 +831,6 @@ is_media_pseudo (int rn)
   return (rn >= DR0_REGNUM && rn <= FV_LAST_REGNUM);
 }
 
-static int
-sh64_get_gdb_regnum (int gcc_regnum, CORE_ADDR pc)
-{
-  return translate_insn_rn (gcc_regnum, pc_is_isa32 (pc));
-}
-
 static int
 sh64_media_reg_base_num (int reg_nr)
 {
@@ -1321,7 +1316,8 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
                  else
                    size = register_size (current_gdbarch, live_regnum);
                  if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
-                   read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer, size);
+                   read_memory (deprecated_get_frame_saved_regs (frame)[regnum], 
+                                raw_buffer, size);
                  else
                    read_memory (deprecated_get_frame_saved_regs (frame)[regnum],
                                 raw_buffer
@@ -1346,11 +1342,14 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
 }
 
 static CORE_ADDR
-sh64_extract_struct_value_address (char *regbuf)
+sh64_extract_struct_value_address (struct regcache *regcache)
 {
-  return (extract_unsigned_integer ((regbuf + DEPRECATED_REGISTER_BYTE (STRUCT_RETURN_REGNUM)), 
-                                   register_size (current_gdbarch, 
-                                                  STRUCT_RETURN_REGNUM)));
+  /* FIXME: cagney/2004-01-17: Does the ABI guarantee that the return
+     address regster is preserved across function calls?  Probably
+     not, making this function wrong.  */
+  ULONGEST val;
+  regcache_raw_read_unsigned (regcache, STRUCT_RETURN_REGNUM, &val);
+  return val;
 }
 
 static CORE_ADDR
@@ -1917,7 +1916,7 @@ REGISTER_BYTE returns the register byte for the base register.
 */
 /* *INDENT-ON* */
 static int
-sh_sh64_register_byte (int reg_nr)
+sh64_register_byte (int reg_nr)
 {
   int base_regnum = -1;
 
@@ -2002,7 +2001,7 @@ sh_sh64_register_byte (int reg_nr)
 }
 
 static struct type *
-sh_sh64_build_float_register_type (int high)
+sh64_build_float_register_type (int high)
 {
   struct type *temp;
 
@@ -2027,12 +2026,12 @@ sh64_register_type (struct gdbarch *gdbarch, int reg_nr)
     return builtin_type_double;
   else if  (reg_nr >= FPP0_REGNUM 
            && reg_nr <= FPP_LAST_REGNUM)
-    return sh_sh64_build_float_register_type (1);
+    return sh64_build_float_register_type (1);
   else if ((reg_nr >= FV0_REGNUM
            && reg_nr <= FV_LAST_REGNUM)
           ||(reg_nr >= FV0_C_REGNUM 
              && reg_nr <= FV_LAST_C_REGNUM))
-    return sh_sh64_build_float_register_type (3);
+    return sh64_build_float_register_type (3);
   else if (reg_nr == FPSCR_REGNUM)
     return builtin_type_int;
   else if (reg_nr >= R0_C_REGNUM
@@ -2043,7 +2042,7 @@ sh64_register_type (struct gdbarch *gdbarch, int reg_nr)
 }
 
 static void
-sh_sh64_register_convert_to_virtual (int regnum, struct type *type,
+sh64_register_convert_to_virtual (int regnum, struct type *type,
                                     char *from, char *to)
 {
   if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE)
@@ -2061,14 +2060,14 @@ sh_sh64_register_convert_to_virtual (int regnum, struct type *type,
       DOUBLEST val;
       floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, 
                               from, &val);
-      store_typed_floating(to, type, val);
+      store_typed_floating (to, type, val);
     }
   else
-    error("sh64_register_convert_to_virtual called with non DR register number");
+    error ("sh64_register_convert_to_virtual called with non DR register number");
 }
 
 static void
-sh_sh64_register_convert_to_raw (struct type *type, int regnum,
+sh64_register_convert_to_raw (struct type *type, int regnum,
                                 const void *from, void *to)
 {
   if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE)
@@ -2088,7 +2087,7 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum,
                                 &val, to);
     }
   else
-    error("sh64_register_convert_to_raw called with non DR register number");
+    error ("sh64_register_convert_to_raw called with non DR register number");
 }
 
 static void
@@ -2114,10 +2113,10 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
                            + register_size (gdbarch, base_regnum) * portion));
 
       /* We must pay attention to the endianness.  */
-      sh_sh64_register_convert_to_virtual (reg_nr, 
-                                          gdbarch_register_type (gdbarch, 
-                                                                 reg_nr),
-                                          temp_buffer, buffer);
+      sh64_register_convert_to_virtual (reg_nr, 
+                                       gdbarch_register_type (gdbarch, 
+                                                              reg_nr),
+                                       temp_buffer, buffer);
 
     }
 
@@ -2186,10 +2185,10 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
                            + register_size (gdbarch, base_regnum) * portion));
 
       /* We must pay attention to the endianness.  */
-      sh_sh64_register_convert_to_virtual (reg_nr, 
-                                          gdbarch_register_type (gdbarch, 
-                                                                 reg_nr),
-                                          temp_buffer, buffer);
+      sh64_register_convert_to_virtual (reg_nr, 
+                                       gdbarch_register_type (gdbarch, 
+                                                              reg_nr),
+                                       temp_buffer, buffer);
     }
 
   else if (reg_nr >= FV0_C_REGNUM 
@@ -2273,10 +2272,9 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
     {
       base_regnum = dr_reg_base_num (reg_nr);
       /* We must pay attention to the endianness.  */
-      sh_sh64_register_convert_to_raw (gdbarch_register_type (gdbarch, 
-                                                             reg_nr), reg_nr,
-                                      buffer, temp_buffer);
-         
+      sh64_register_convert_to_raw (gdbarch_register_type (gdbarch, reg_nr),
+                                   reg_nr,
+                                   buffer, temp_buffer);
 
       /* Write the real regs for which this one is an alias.  */
       for (portion = 0; portion < 2; portion++)
@@ -2348,10 +2346,10 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
       for (portion = 0; portion < 2; portion++)
        {
          /* We must pay attention to the endianness.  */
-         sh_sh64_register_convert_to_raw (gdbarch_register_type (gdbarch,
-                                                                 reg_nr), 
-                                          reg_nr,
-                                          buffer, temp_buffer);
+         sh64_register_convert_to_raw (gdbarch_register_type (gdbarch,
+                                                              reg_nr), 
+                                       reg_nr,
+                                       buffer, temp_buffer);
 
          regcache_raw_write (regcache, base_regnum + portion,
                              (temp_buffer
@@ -2848,11 +2846,8 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
-  set_gdbarch_decr_pc_after_break (gdbarch, 0);
-  set_gdbarch_function_start_offset (gdbarch, 0);
 
-  set_gdbarch_frame_args_skip (gdbarch, 0);
-  set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue);
+  set_gdbarch_deprecated_frameless_function_invocation (gdbarch, legacy_frameless_look_for_prologue);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   set_gdbarch_deprecated_frame_saved_pc (gdbarch, sh_frame_saved_pc);
@@ -2870,16 +2865,16 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
                                         ((SIM_SH64_NR_FP_REGS + 1) * 4)
                                         + (SIM_SH64_NR_REGS - SIM_SH64_NR_FP_REGS -1) * 8);
 
-  set_gdbarch_register_name (gdbarch, sh_sh64_register_name);
+  set_gdbarch_register_name (gdbarch, sh64_register_name);
   set_gdbarch_register_type (gdbarch, sh64_register_type);
   set_gdbarch_deprecated_store_return_value (gdbarch, sh64_store_return_value);
-  set_gdbarch_deprecated_register_byte (gdbarch, sh_sh64_register_byte);
+  set_gdbarch_deprecated_register_byte (gdbarch, sh64_register_byte);
   set_gdbarch_pseudo_register_read (gdbarch, sh64_pseudo_register_read);
   set_gdbarch_pseudo_register_write (gdbarch, sh64_pseudo_register_write);
 
   set_gdbarch_deprecated_do_registers_info (gdbarch, sh64_do_registers_info);
   set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, sh64_nofp_frame_init_saved_regs);
-  set_gdbarch_breakpoint_from_pc (gdbarch, sh_sh64_breakpoint_from_pc);
+  set_gdbarch_breakpoint_from_pc (gdbarch, sh64_breakpoint_from_pc);
   set_gdbarch_deprecated_call_dummy_words (gdbarch, sh64_call_dummy_words);
   set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (sh64_call_dummy_words));
 
This page took 0.031436 seconds and 4 git commands to generate.