2007-05-31 Markus Deuling <deuling@de.ibm.com>
[deliverable/binutils-gdb.git] / gdb / arch-utils.c
index 386425014d00b4521f360a07ab3b7ff12e72e66d..e2674571e960d39884eaae52e7ae203d77192a65 100644 (file)
@@ -83,7 +83,7 @@ int
 legacy_register_sim_regno (int regnum)
 {
   /* Only makes sense to supply raw registers.  */
-  gdb_assert (regnum >= 0 && regnum < NUM_REGS);
+  gdb_assert (regnum >= 0 && regnum < gdbarch_num_regs (current_gdbarch));
   /* NOTE: cagney/2002-05-13: The old code did it this way and it is
      suspected that some GDB/SIM combinations may rely on this
      behavour.  The default should be one2one_register_sim_regno
@@ -119,16 +119,6 @@ generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
   return 0;
 }
 
-void
-generic_remote_translate_xfer_address (struct gdbarch *gdbarch,
-                                      struct regcache *regcache,
-                                      CORE_ADDR gdb_addr, int gdb_len,
-                                      CORE_ADDR * rem_addr, int *rem_len)
-{
-  *rem_addr = gdb_addr;
-  *rem_len = gdb_len;
-}
-
 /* Helper functions for INNER_THAN */
 
 int
@@ -143,42 +133,6 @@ core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs)
   return (lhs > rhs);
 }
 
-
-/* Helper functions for TARGET_{FLOAT,DOUBLE}_FORMAT */
-
-const struct floatformat *
-default_float_format (struct gdbarch *gdbarch)
-{
-  int byte_order = gdbarch_byte_order (gdbarch);
-  switch (byte_order)
-    {
-    case BFD_ENDIAN_BIG:
-      return &floatformat_ieee_single_big;
-    case BFD_ENDIAN_LITTLE:
-      return &floatformat_ieee_single_little;
-    default:
-      internal_error (__FILE__, __LINE__,
-                     _("default_float_format: bad byte order"));
-    }
-}
-
-
-const struct floatformat *
-default_double_format (struct gdbarch *gdbarch)
-{
-  int byte_order = gdbarch_byte_order (gdbarch);
-  switch (byte_order)
-    {
-    case BFD_ENDIAN_BIG:
-      return &floatformat_ieee_double_big;
-    case BFD_ENDIAN_LITTLE:
-      return &floatformat_ieee_double_little;
-    default:
-      internal_error (__FILE__, __LINE__,
-                     _("default_double_format: bad byte order"));
-    }
-}
-
 /* Misc helper functions for targets. */
 
 CORE_ADDR
@@ -232,9 +186,10 @@ legacy_virtual_frame_pointer (CORE_ADDR pc,
      register and an offset can determine this.  I think it should
      instead generate a byte code expression as that would work better
      with things like Dwarf2's CFI.  */
-  if (DEPRECATED_FP_REGNUM >= 0 && DEPRECATED_FP_REGNUM < NUM_REGS)
+  if (DEPRECATED_FP_REGNUM >= 0
+      && DEPRECATED_FP_REGNUM < gdbarch_num_regs (current_gdbarch))
     *frame_regnum = DEPRECATED_FP_REGNUM;
-  else if (SP_REGNUM >= 0 && SP_REGNUM < NUM_REGS)
+  else if (SP_REGNUM >= 0 && SP_REGNUM < gdbarch_num_regs (current_gdbarch))
     *frame_regnum = SP_REGNUM;
   else
     /* Should this be an internal error?  I guess so, it is reflecting
@@ -243,43 +198,7 @@ legacy_virtual_frame_pointer (CORE_ADDR pc,
   *frame_offset = 0;
 }
 
-/* Assume the world is sane, every register's virtual and real size
-   is identical.  */
-
-int
-generic_register_size (int regnum)
-{
-  gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
-  return TYPE_LENGTH (gdbarch_register_type (current_gdbarch, regnum));
-}
-
-/* Assume all registers are adjacent.  */
-
-int
-generic_register_byte (int regnum)
-{
-  int byte;
-  int i;
-  gdb_assert (regnum >= 0 && regnum < NUM_REGS + NUM_PSEUDO_REGS);
-  byte = 0;
-  for (i = 0; i < regnum; i++)
-    {
-      byte += generic_register_size (i);
-    }
-  return byte;
-}
-
 \f
-int
-legacy_pc_in_sigtramp (CORE_ADDR pc, char *name)
-{
-#if defined (DEPRECATED_IN_SIGTRAMP)
-  return DEPRECATED_IN_SIGTRAMP (pc, name);
-#else
-  return name && strcmp ("_sigtramp", name) == 0;
-#endif
-}
-
 int
 generic_convert_register_p (int regnum, struct type *type)
 {
@@ -299,6 +218,13 @@ generic_instruction_nullified (struct gdbarch *gdbarch,
   return 0;
 }
 
+int
+default_remote_register_number (struct gdbarch *gdbarch,
+                               int regno)
+{
+  return regno;
+}
+
 \f
 /* Functions to manipulate the endianness of the target.  */
 
@@ -316,6 +242,15 @@ static const char *endian_enum[] =
 };
 static const char *set_endian_string;
 
+enum bfd_endian
+selected_byte_order (void)
+{
+  if (target_byte_order_user != BFD_ENDIAN_UNKNOWN)
+    return gdbarch_byte_order (current_gdbarch);
+  else
+    return BFD_ENDIAN_UNKNOWN;
+}
+
 /* Called by ``show endian''.  */
 
 static void
@@ -323,14 +258,14 @@ show_endian (struct ui_file *file, int from_tty, struct cmd_list_element *c,
             const char *value)
 {
   if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
-    if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+    if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
       fprintf_unfiltered (file, _("The target endianness is set automatically "
                                  "(currently big endian)\n"));
     else
       fprintf_unfiltered (file, _("The target endianness is set automatically "
                           "(currently little endian)\n"));
   else
-    if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
+    if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG)
       fprintf_unfiltered (file,
                          _("The target is assumed to be big endian\n"));
     else
This page took 0.027672 seconds and 4 git commands to generate.