* Makefile.in (i386nbsd-tdep.o): Add $(arch_utils_h),
[deliverable/binutils-gdb.git] / gdb / d10v-tdep.c
index 97562b7bea9b8f3bf550480ce17dabd2472a3b0f..4e0210696098fe33e9528b7fe49f6957afd666b2 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "defs.h"
 #include "frame.h"
-#include "obstack.h"
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "gdbcmd.h"
@@ -187,7 +186,7 @@ enum ts2_regnums
     TS2_A0_REGNUM = 35
   };
 
-static char *
+static const char *
 d10v_ts2_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -213,7 +212,7 @@ enum ts3_regnums
     TS3_A0_REGNUM = 32
   };
 
-static char *
+static const char *
 d10v_ts3_register_name (int reg_nr)
 {
   static char *register_names[] =
@@ -1086,6 +1085,15 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
   int i;
   int regnum = ARG1_REGNUM;
   struct stack_item *si = NULL;
+  long val;
+
+  /* If struct_return is true, then the struct return address will
+     consume one argument-passing register.  No need to actually 
+     write the value to the register -- that's done by 
+     d10v_store_struct_return().  */
+
+  if (struct_return)
+    regnum++;
 
   /* Fill in registers and arg lists */
   for (i = 0; i < nargs; i++)
@@ -1094,39 +1102,38 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
       struct type *type = check_typedef (VALUE_TYPE (arg));
       char *contents = VALUE_CONTENTS (arg);
       int len = TYPE_LENGTH (type);
+      int aligned_regnum = (regnum + 1) & ~1;
+
       /* printf ("push: type=%d len=%d\n", TYPE_CODE (type), len); */
+      if (len <= 2 && regnum <= ARGN_REGNUM)
+       /* fits in a single register, do not align */
+       {
+         val = extract_unsigned_integer (contents, len);
+         write_register (regnum++, val);
+       }
+      else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
+       /* value fits in remaining registers, store keeping left
+          aligned */
        {
-         int aligned_regnum = (regnum + 1) & ~1;
-         if (len <= 2 && regnum <= ARGN_REGNUM)
-           /* fits in a single register, do not align */
+         int b;
+         regnum = aligned_regnum;
+         for (b = 0; b < (len & ~1); b += 2)
            {
-             long val = extract_unsigned_integer (contents, len);
+             val = extract_unsigned_integer (&contents[b], 2);
              write_register (regnum++, val);
            }
-         else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
-           /* value fits in remaining registers, store keeping left
-              aligned */
+         if (b < len)
            {
-             int b;
-             regnum = aligned_regnum;
-             for (b = 0; b < (len & ~1); b += 2)
-               {
-                 long val = extract_unsigned_integer (&contents[b], 2);
-                 write_register (regnum++, val);
-               }
-             if (b < len)
-               {
-                 long val = extract_unsigned_integer (&contents[b], 1);
-                 write_register (regnum++, (val << 8));
-               }
-           }
-         else
-           {
-             /* arg will go onto stack */
-             regnum = ARGN_REGNUM + 1;
-             si = push_stack_item (si, contents, len);
+             val = extract_unsigned_integer (&contents[b], 1);
+             write_register (regnum++, (val << 8));
            }
        }
+      else
+       {
+         /* arg will go onto stack */
+         regnum = ARGN_REGNUM + 1;
+         si = push_stack_item (si, contents, len);
+       }
     }
 
   while (si)
@@ -1596,17 +1603,17 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sizeof_call_dummy_words (gdbarch, sizeof (d10v_call_dummy_words));
   set_gdbarch_call_dummy_p (gdbarch, 1);
   set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
-  set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+  set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register);
   set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
 
-  set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
+  set_gdbarch_deprecated_extract_return_value (gdbarch, d10v_extract_return_value);
   set_gdbarch_push_arguments (gdbarch, d10v_push_arguments);
   set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
   set_gdbarch_push_return_address (gdbarch, d10v_push_return_address);
 
   set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return);
-  set_gdbarch_store_return_value (gdbarch, d10v_store_return_value);
-  set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address);
+  set_gdbarch_deprecated_store_return_value (gdbarch, d10v_store_return_value);
+  set_gdbarch_deprecated_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address);
   set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention);
 
   set_gdbarch_frame_init_saved_regs (gdbarch, d10v_frame_init_saved_regs);
This page took 0.026036 seconds and 4 git commands to generate.