2002-09-18 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / sh-tdep.c
index 8c0c811d15ca0cbbab888c2ac2e048c488e6eb6a..7ac5b9ef57f3bc8924fc2a920cede5b5469cf234 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "defs.h"
 #include "frame.h"
-#include "obstack.h"
 #include "symtab.h"
 #include "symfile.h"
 #include "gdbtypes.h"
 #include "regcache.h"
 #include "doublest.h"
 
-#include "elf-bfd.h"
+#include "sh-tdep.h"
 
+#include "elf-bfd.h"
 #include "solib-svr4.h"
 
-#include "elf-bfd.h"
 /* sh64 flags */
 #include "elf/sh.h"
 /* registers numbers shared with the simulator */
 #include "gdb/sim-sh.h"
 
-#undef XMALLOC
-#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
-
 void (*sh_show_regs) (void);
 CORE_ADDR (*skip_prologue_hard_way) (CORE_ADDR);
 void (*do_pseudo_register) (int);
@@ -71,7 +67,7 @@ struct frame_extra_info
   int f_offset;
 };
 
-static char *
+static const char *
 sh_generic_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -93,7 +89,7 @@ sh_generic_register_name (int reg_nr)
   return register_names[reg_nr];
 }
 
-static char *
+static const char *
 sh_sh_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -115,7 +111,7 @@ sh_sh_register_name (int reg_nr)
   return register_names[reg_nr];
 }
 
-static char *
+static const char *
 sh_sh3_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -137,7 +133,7 @@ sh_sh3_register_name (int reg_nr)
   return register_names[reg_nr];
 }
 
-static char *
+static const char *
 sh_sh3e_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -159,7 +155,7 @@ sh_sh3e_register_name (int reg_nr)
   return register_names[reg_nr];
 }
 
-static char *
+static const char *
 sh_sh_dsp_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -181,7 +177,7 @@ sh_sh_dsp_register_name (int reg_nr)
   return register_names[reg_nr];
 }
 
-static char *
+static const char *
 sh_sh3_dsp_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -204,7 +200,7 @@ sh_sh3_dsp_register_name (int reg_nr)
   return register_names[reg_nr];
 }
 
-static char *
+static const char *
 sh_sh4_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -239,7 +235,7 @@ sh_sh4_register_name (int reg_nr)
   return register_names[reg_nr];
 }
 
-static char *
+static const char *
 sh_sh64_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -911,29 +907,8 @@ sh_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 static int
 gdb_print_insn_sh (bfd_vma memaddr, disassemble_info *info)
 {
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-    return print_insn_sh (memaddr, info);
-  else
-    return print_insn_shl (memaddr, info);
-}
-
-/* Disassemble an instruction.  */
-static int
-gdb_print_insn_sh64 (bfd_vma memaddr, disassemble_info *info)
-{
-  if (pc_is_isa32 (memaddr))
-    {
-      /* Round down the instruction address to the appropriate boundary
-        before disassembling it. */
-      return print_insn_sh64x_media (UNMAKE_ISA32_ADDR (memaddr), info);
-    }
-  else
-    {
-      if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
-       return print_insn_sh (memaddr, info);
-      else
-       return print_insn_shl (memaddr, info);
-    }
+  info->endian = TARGET_BYTE_ORDER;
+  return print_insn_sh (memaddr, info);
 }
 
 /* Given a GDB frame, determine the address of the calling function's frame.
@@ -1011,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);
@@ -1033,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);
@@ -1070,7 +1045,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi)
   int opc;
   int insn;
   int r3_val = 0;
-  char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+  char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame);
   
   if (fi->saved_regs == NULL)
     frame_saved_regs_zalloc (fi);
@@ -1395,7 +1370,7 @@ sign_extend (int value, int bits)
 static void
 sh64_nofp_frame_init_saved_regs (struct frame_info *fi)
 {
-  int *where = (int *) alloca ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof(int));
+  int *where = (int *) alloca ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof (int));
   int rn;
   int have_fp = 0;
   int fp_regnum;
@@ -1409,7 +1384,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi)
   int insn_size;
   int gdb_register_number;
   int register_number;
-  char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+  char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
   
   if (fi->saved_regs == NULL)
@@ -1602,7 +1577,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi)
 static void
 sh_fp_frame_init_saved_regs (struct frame_info *fi)
 {
-  int where[NUM_REGS + NUM_PSEUDO_REGS];
+  int *where = (int *) alloca ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof (int));
   int rn;
   int have_fp = 0;
   int depth;
@@ -1610,7 +1585,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi)
   int opc;
   int insn;
   int r3_val = 0;
-  char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame);
+  char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame);
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
   
   if (fi->saved_regs == NULL)
@@ -1747,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;
@@ -1779,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;
@@ -1838,8 +1813,8 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
            *lval = not_lval;
          if (raw_buffer)
            memcpy (raw_buffer,
-                   generic_find_dummy_frame (frame->pc, frame->frame) +
-                   REGISTER_BYTE (regnum),
+                   (deprecated_generic_find_dummy_frame (frame->pc, frame->frame)
+                    + REGISTER_BYTE (regnum)),
                    REGISTER_RAW_SIZE (regnum));
          return;
        }
@@ -2275,11 +2250,12 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
                      }
 #endif
                    /* Note: must use write_register_gen here instead
-                      of regcache_write, because regcache_write works
-                      only for real registers, not pseudo.
-                      write_register_gen will call the gdbarch
-                      function to do register writes, and that will
-                      properly know how to deal with pseudoregs. */
+                      of regcache_raw_write, because
+                      regcache_raw_write works only for real
+                      registers, not pseudo.  write_register_gen will
+                      call the gdbarch function to do register
+                      writes, and that will properly know how to deal
+                      with pseudoregs. */
                    write_register_gen (regnum, val);
                    fp_args[double_arg_index] = 1;
                    fp_args[double_arg_index + 1] = 1;
@@ -3310,18 +3286,6 @@ sh_default_register_virtual_type (int reg_nr)
    The other pseudo registers (the FVs) also don't pose a problem
    because they are stored as 4 individual FP elements. */
 
-int
-sh_sh4_register_convertible (int nr)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
-
-  if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
-    return (tdep->DR0_REGNUM <= nr
-           && nr <= tdep->DR_LAST_REGNUM);
-  else 
-    return 0;
-}
-
 static void
 sh_sh4_register_convert_to_virtual (int regnum, struct type *type,
                                   char *from, char *to)
@@ -3367,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); 
 
@@ -3383,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); 
 
@@ -3407,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)
@@ -3421,9 +3386,9 @@ 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_read (base_regnum + portion, 
-                      temp_buffer
-                      + REGISTER_RAW_SIZE (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. */
       sh_sh4_register_convert_to_virtual (reg_nr,
                                          REGISTER_VIRTUAL_TYPE (reg_nr),
@@ -3436,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_read (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_read (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)
@@ -3470,9 +3426,9 @@ 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_read (base_regnum + portion, 
-                                temp_buffer
-                                + REGISTER_RAW_SIZE (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. */
       sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr),
@@ -3489,8 +3445,9 @@ 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_read (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));
     }
 
   else if (reg_nr >= tdep->FV0_REGNUM 
@@ -3502,8 +3459,9 @@ 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_read (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));
     }
 
   /* sh compact pseudo registers. 1-to-1 with a shmedia register */
@@ -3513,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_read (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????*/
@@ -3527,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_read (base_regnum, buffer);
+      regcache_raw_read (regcache, base_regnum, buffer);
     }
 
   else if (reg_nr >= tdep->DR0_C_REGNUM 
@@ -3538,9 +3496,9 @@ 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_read (base_regnum + portion, 
-                                temp_buffer
-                                + REGISTER_RAW_SIZE (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. */
       sh_sh64_register_convert_to_virtual (reg_nr, REGISTER_VIRTUAL_TYPE (reg_nr),
@@ -3556,8 +3514,9 @@ 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_read (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));
     }
 
   else if (reg_nr == tdep->FPSCR_C_REGNUM)
@@ -3588,11 +3547,11 @@ sh64_pseudo_register_read (int reg_nr, char *buffer)
        */
       /* *INDENT-ON* */
       /* Get FPSCR into a local buffer */
-      regcache_read (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_read (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. */
@@ -3610,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_read (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_read (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)
@@ -3644,8 +3592,9 @@ 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_write (base_regnum + portion, 
-                       temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+       regcache_raw_write (regcache, base_regnum + portion, 
+                           (temp_buffer
+                            + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
   else if (reg_nr >= tdep->FV0_REGNUM
           && reg_nr <= tdep->FV_LAST_REGNUM)
@@ -3654,29 +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_write (base_regnum + portion,
-                       buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+       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_write (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)
@@ -3689,8 +3629,9 @@ 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_write (base_regnum + portion, 
-                       temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+       regcache_raw_write (regcache, base_regnum + portion, 
+                           (temp_buffer
+                            + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 
   else if (reg_nr >= tdep->FPP0_REGNUM 
@@ -3700,8 +3641,9 @@ 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_write (base_regnum + portion,
-                       buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+       regcache_raw_write (regcache, base_regnum + portion,
+                           ((char *) buffer
+                            + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 
   else if (reg_nr >= tdep->FV0_REGNUM
@@ -3711,8 +3653,9 @@ 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_write (base_regnum + portion,
-                       buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+       regcache_raw_write (regcache, base_regnum + portion,
+                           ((char *) buffer
+                            + REGISTER_RAW_SIZE (base_regnum) * portion));
     }
 
   /* sh compact general pseudo registers. 1-to-1 with a shmedia
@@ -3729,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_read (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_write (base_regnum, temp_buffer);
+      regcache_raw_write (regcache, base_regnum, temp_buffer);
     }
 
   /* sh floating point compact pseudo registers. 1-to-1 with a shmedia
@@ -3741,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_write (base_regnum, buffer);
+      regcache_raw_write (regcache, base_regnum, buffer);
     }
 
   else if (reg_nr >= tdep->DR0_C_REGNUM 
@@ -3754,8 +3697,9 @@ 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_write (base_regnum + portion,
-                         temp_buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+         regcache_raw_write (regcache, base_regnum + portion,
+                             (temp_buffer
+                              + REGISTER_RAW_SIZE (base_regnum) * portion));
        }
     }
 
@@ -3766,8 +3710,9 @@ sh64_pseudo_register_write (int reg_nr, char *buffer)
      
       for (portion = 0; portion < 4; portion++)
        {
-         regcache_write (base_regnum + portion,
-                         buffer + REGISTER_RAW_SIZE (base_regnum) * portion);
+         regcache_raw_write (regcache, base_regnum + portion,
+                             ((char *) buffer
+                              + REGISTER_RAW_SIZE (base_regnum) * portion));
        }
     }
 
@@ -3809,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_read (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_write (fpscr_base_regnum, temp_buffer);
+      regcache_raw_write (regcache, fpscr_base_regnum, temp_buffer);
       
-      regcache_read (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_write (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_write (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_write (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)
@@ -4215,175 +4149,47 @@ sh_linux_svr4_fetch_link_map_offsets (void)
 #endif /* SVR4_SHARED_LIBS */
 
 \f
-/* This table matches the indices assigned to enum sh_osabi.  Keep
-   them in sync.  */
-static const char * const sh_osabi_names[] =
+enum
 {
-  "<unknown>",
-  "GNU/Linux",
-  "NetBSD ELF",
-  NULL
+   DSP_DSR_REGNUM = 24,
+   DSP_A0G_REGNUM,
+   DSP_A0_REGNUM,
+   DSP_A1G_REGNUM,
+   DSP_A1_REGNUM,
+   DSP_M0_REGNUM,
+   DSP_M1_REGNUM,
+   DSP_X0_REGNUM,
+   DSP_X1_REGNUM,
+   DSP_Y0_REGNUM,
+   DSP_Y1_REGNUM,
+   DSP_MOD_REGNUM = 40,
+   DSP_RS_REGNUM = 43,
+   DSP_RE_REGNUM,
+   DSP_R0_BANK_REGNUM = 51,
+   DSP_R7_BANK_REGNUM = DSP_R0_BANK_REGNUM + 7
 };
 
-static void
-process_note_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
-{
-  enum sh_osabi *os_ident_ptr = obj;
-  const char *name;
-  unsigned int sectsize;
-
-  name = bfd_get_section_name (abfd, sect);
-  sectsize = bfd_section_size (abfd, sect);
-
-  if (strcmp (name, ".note.ABI-tag") == 0 && sectsize > 0)
-    {
-      unsigned int name_length, data_length, note_type;
-      char *note;
-
-      /* If the section is larger than this, it's probably not what we are
-        looking for.  */
-      if (sectsize > 128)
-       sectsize = 128;
-
-      note = alloca (sectsize);
-
-      bfd_get_section_contents (abfd, sect, note,
-                               (file_ptr) 0, (bfd_size_type) sectsize);
-
-      name_length = bfd_h_get_32 (abfd, note);
-      data_length = bfd_h_get_32 (abfd, note + 4);
-      note_type   = bfd_h_get_32 (abfd, note + 8);
-
-      if (name_length == 4 && data_length == 16 && note_type == NT_GNU_ABI_TAG
-         && strcmp (note + 12, "GNU") == 0)
-       {
-         int os_number = bfd_h_get_32 (abfd, note + 16);
-
-         /* The case numbers are from abi-tags in glibc.  */
-         switch (os_number)
-           {
-           case GNU_ABI_TAG_LINUX:
-             *os_ident_ptr = SH_OSABI_LINUX;
-             break;
-
-           case GNU_ABI_TAG_HURD:
-             internal_error
-               (__FILE__, __LINE__,
-                "process_note_abi_sections: Hurd objects not supported");
-             break;
-
-           case GNU_ABI_TAG_SOLARIS:
-             internal_error
-               (__FILE__, __LINE__,
-                "process_note_abi_sections: Solaris objects not supported");
-             break;
-
-           default:
-             internal_error
-               (__FILE__, __LINE__,
-                "process_note_abi_sections: unknown OS number %d",
-                os_number);
-           }
-       }
-    }
-  /* NetBSD uses a similar trick.  */
-  else if (strcmp (name, ".note.netbsd.ident") == 0 && sectsize > 0)
-    {
-      unsigned int name_length, desc_length, note_type;
-      char *note;
-
-      /* If the section is larger than this, it's probably not what we are
-        looking for.  */
-      if (sectsize > 128)
-       sectsize = 128;
-
-      note = alloca (sectsize);
-
-      bfd_get_section_contents (abfd, sect, note,
-                               (file_ptr) 0, (bfd_size_type) sectsize);
-
-      name_length = bfd_h_get_32 (abfd, note);
-      desc_length = bfd_h_get_32 (abfd, note + 4);
-      note_type   = bfd_h_get_32 (abfd, note + 8);
-
-      if (name_length == 7 && desc_length == 4 && note_type == NT_NETBSD_IDENT
-         && strcmp (note + 12, "NetBSD") == 0)
-       /* XXX Should we check the version here?
-          Probably not necessary yet.  */
-       *os_ident_ptr = SH_OSABI_NETBSD_ELF;
-    }
-}
-
 static int
-get_elfosabi (bfd *abfd)
+sh_dsp_register_sim_regno (int nr)
 {
-  int elfosabi;
-  enum sh_osabi sh_osabi = SH_OSABI_UNKNOWN;
-
-  elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
-
-  switch (elfosabi)
-    {
-    case ELFOSABI_NONE:
-      /* When elfosabi is 0 (ELFOSABI_NONE), this is supposed to indicate
-        that we're on a SYSV system.  However, some systems use note sections
-        to record OS/ABI info, but leave e_ident[EI_OSABI] zero.  So we
-        have to check the note sections too.  */
-      bfd_map_over_sections (abfd,
-                            process_note_abi_tag_sections,
-                            &sh_osabi);
-      break;
-
-    case ELFOSABI_NETBSD:
-      sh_osabi = SH_OSABI_NETBSD_ELF;
-      break;
-
-    case ELFOSABI_LINUX:
-      sh_osabi = SH_OSABI_LINUX;
-      break;
-    }
-
-  return (sh_osabi);
+  if (legacy_register_sim_regno (nr) < 0)
+    return legacy_register_sim_regno (nr);
+  if (nr >= DSP_DSR_REGNUM && nr < DSP_Y1_REGNUM)
+    return nr - DSP_DSR_REGNUM + SIM_SH_DSR_REGNUM;
+  if (nr == DSP_MOD_REGNUM)
+    return SIM_SH_MOD_REGNUM;
+  if (nr == DSP_RS_REGNUM)
+    return SIM_SH_RS_REGNUM;
+  if (nr == DSP_RE_REGNUM)
+    return SIM_SH_RE_REGNUM;
+  if (nr >= DSP_R0_BANK_REGNUM && nr <= DSP_R7_BANK_REGNUM)
+    return nr - DSP_R0_BANK_REGNUM + SIM_SH_R0_BANK_REGNUM;
+  return nr;
 }
-
-struct sh_osabi_handler
-{
-  struct sh_osabi_handler *next;
-  enum sh_osabi abi;
-  void (*init_osabi)(struct gdbarch_info, struct gdbarch *);
-};
-
-struct sh_osabi_handler *sh_osabi_handler_list = NULL;
-
-void
-sh_gdbarch_register_os_abi (enum sh_osabi abi,
-                            void (*init_osabi)(struct gdbarch_info,
-                                              struct gdbarch *))
-{
-  struct sh_osabi_handler **handler_p;
-
-  for (handler_p = &sh_osabi_handler_list; *handler_p != NULL;
-       handler_p = &(*handler_p)->next)
-    {
-      if ((*handler_p)->abi == abi)
-       {
-         internal_error
-           (__FILE__, __LINE__,
-            "sh_gdbarch_register_os_abi: A handler for this ABI variant "
-            "(%d) has already been registered", (int) abi);
-         /* If user wants to continue, override previous definition.  */
-         (*handler_p)->init_osabi = init_osabi;
-         return;
-       }
-    }
-
-  (*handler_p)
-    = (struct sh_osabi_handler *) xmalloc (sizeof (struct sh_osabi_handler));
-  (*handler_p)->next = NULL;
-  (*handler_p)->abi = abi;
-  (*handler_p)->init_osabi = init_osabi;
-}
-
+\f
 static gdbarch_init_ftype sh_gdbarch_init;
 
 static struct gdbarch *
@@ -4393,25 +4199,16 @@ 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 sh_osabi sh_osabi = SH_OSABI_UNKNOWN;
-  struct sh_osabi_handler *osabi_handler;
+  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
   /* Try to determine the ABI of the object we are loading.  */
 
   if (info.abfd != NULL)
     {
-      switch (bfd_get_flavour (info.abfd))
-       {
-       case bfd_target_elf_flavour:
-         sh_osabi = get_elfosabi (info.abfd);
-         break;
-
-       default:
-         /* Just leave it as "unkown".  */
-         break;
-       }
+      osabi = gdbarch_lookup_osabi (info.abfd);
+      /* If we get "unknown" back, just leave it that way.  */
     }
 
   /* Find a candidate among the list of pre-declared architectures. */
@@ -4421,7 +4218,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     {
       /* Make sure the ABI selection matches.  */
       tdep = gdbarch_tdep (arches->gdbarch);
-      if (tdep && tdep->sh_osabi == sh_osabi)
+      if (tdep && tdep->osabi == osabi)
        return arches->gdbarch;
     }
 
@@ -4430,15 +4227,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   tdep = XMALLOC (struct gdbarch_tdep);
   gdbarch = gdbarch_alloc (&info, tdep);
 
-  tdep->sh_osabi = sh_osabi;
-  if (sh_osabi < SH_OSABI_INVALID)
-    tdep->osabi_name = sh_osabi_names[sh_osabi];
-  else
-    {
-      internal_error (__FILE__, __LINE__, "Invalid setting of sh_osabi %d",
-                     (int) sh_osabi);
-      tdep->osabi_name = "<invalid>";
-    }
+  tdep->osabi = osabi;
 
   /* Initialize the register numbers that are not common to all the
      variants to -1, if necessary thse will be overwritten in the case
@@ -4492,13 +4281,14 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_chain (gdbarch, sh_frame_chain);
   set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
   set_gdbarch_init_extra_frame_info (gdbarch, sh_init_extra_frame_info);
-  set_gdbarch_extract_return_value (gdbarch, sh_extract_return_value);
+  set_gdbarch_deprecated_extract_return_value (gdbarch, sh_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
   set_gdbarch_store_struct_return (gdbarch, sh_store_struct_return);
   set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention);
-  set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
+  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
   set_gdbarch_pop_frame (gdbarch, sh_pop_frame);
   set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
+  set_gdbarch_register_sim_regno (gdbarch, legacy_register_sim_regno);
   skip_prologue_hard_way = sh_skip_prologue_hard_way;
   do_pseudo_register = sh_do_pseudo_register;
 
@@ -4533,6 +4323,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
+      set_gdbarch_register_sim_regno (gdbarch, sh_dsp_register_sim_regno);
       tdep->DSR_REGNUM = 24;
       tdep->A0G_REGNUM = 25;
       tdep->A0_REGNUM = 26;
@@ -4569,7 +4360,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_default_register_byte);
-      set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
+      set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
       set_gdbarch_fp0_regnum (gdbarch, 25);
       tdep->FPUL_REGNUM = 23;
       tdep->FPSCR_REGNUM = 24;
@@ -4609,7 +4400,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_store_return_value = sh3e_sh4_store_return_value;
       sh_register_virtual_type = sh_sh4_register_virtual_type;
       set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
-      set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
+      set_gdbarch_deprecated_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
       set_gdbarch_fp0_regnum (gdbarch, 25);
       set_gdbarch_register_raw_size (gdbarch, sh_sh4_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_sh4_register_raw_size);
@@ -4617,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;
@@ -4699,7 +4490,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       sh_store_return_value = sh64_store_return_value;
       skip_prologue_hard_way = sh64_skip_prologue_hard_way;
       do_pseudo_register = sh64_do_pseudo_register;
-      set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh64);
       set_gdbarch_register_raw_size (gdbarch, sh_sh64_register_raw_size);
       set_gdbarch_register_virtual_size (gdbarch, sh_sh64_register_raw_size);
       set_gdbarch_register_byte (gdbarch, sh_sh64_register_byte);
@@ -4710,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);
@@ -4719,10 +4509,10 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_init_extra_frame_info (gdbarch, sh64_init_extra_frame_info);
       set_gdbarch_frame_chain (gdbarch, sh64_frame_chain);
       set_gdbarch_get_saved_register (gdbarch, sh64_get_saved_register);
-      set_gdbarch_extract_return_value (gdbarch, sh64_extract_return_value);
+      set_gdbarch_deprecated_extract_return_value (gdbarch, sh64_extract_return_value);
       set_gdbarch_push_arguments (gdbarch, sh64_push_arguments);
       /*set_gdbarch_store_struct_return (gdbarch, sh64_store_struct_return);*/
-      set_gdbarch_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
+      set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address);
       set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention);
       set_gdbarch_pop_frame (gdbarch, sh64_pop_frame);
       set_gdbarch_elf_make_msymbol_special (gdbarch,
@@ -4775,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);
@@ -4791,32 +4581,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-  /* Hook in ABI-specific overrides, if they have been registered.  If
-     the ABI is unknown, this is probably an embedded target, so we
-     should not warn about this situation.  */
-  if (sh_osabi != SH_OSABI_UNKNOWN)
-    {
-      for (osabi_handler = sh_osabi_handler_list; osabi_handler != NULL;
-          osabi_handler = osabi_handler->next)
-       if (osabi_handler->abi == sh_osabi)
-         break;
+  /* Hook in ABI-specific overrides, if they have been registered.
 
-      if (osabi_handler)
-        osabi_handler->init_osabi (info, gdbarch);
-      else
-        {
-         /* We assume that if GDB_MULTI_ARCH is less than
-            GDB_MULTI_ARCH_TM that an ABI variant can be supported by 
-            overriding definitions in this file.  */
-         if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) 
-           fprintf_filtered
-             (gdb_stderr,
-              "A handler for the ABI variant \"%s\" is not built into this "
-              "configuration of GDB.  "
-              "Attempting to continue with the default SuperH settings",
-              sh_osabi_names[sh_osabi]);
-        }
-    }
+     FIXME: if the ABI is unknown, this is probably an embedded target,
+     so we should not warn about this situation.  */
+  gdbarch_init_osabi (info, gdbarch, osabi);
 
   return gdbarch;
 }
@@ -4829,12 +4598,8 @@ sh_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
   if (tdep == NULL)
     return;
 
-  if (tdep->osabi_name != NULL)
-    fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n", tdep->osabi_name);
-  else
-    internal_error (__FILE__, __LINE__,
-                   "sh_dump_tdep: illegal setting of tdep->sh_osabi (%d)",
-                   (int) tdep->sh_osabi);
+  fprintf_unfiltered (file, "sh_dump_tdep: OS ABI = %s\n",
+                      gdbarch_osabi_name (tdep->osabi));
 }
 
 void
This page took 0.037292 seconds and 4 git commands to generate.