Fri Jun 27 21:05:45 1997 Michael Snyder (msnyder@cleaver.cygnus.com)
authorMichael Snyder <msnyder@vmware.com>
Sat, 28 Jun 1997 04:07:56 +0000 (04:07 +0000)
committerMichael Snyder <msnyder@vmware.com>
Sat, 28 Jun 1997 04:07:56 +0000 (04:07 +0000)
* mips-tdep.c (mips_push_arguments): handle alignment of
integer and struct args on stack for mips64 big-endian.

gdb/ChangeLog
gdb/mips-tdep.c

index 05300769f3b5975314c3fd475d24703fe4e243ec..de316985aa7be3341e7b7b769390ae32c2ad8c03 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 27 21:05:45 1997  Michael Snyder  (msnyder@cleaver.cygnus.com)
+
+       * mips-tdep.c (mips_push_arguments): handle alignment of
+       integer and struct args on stack for mips64 big-endian.
+
 Fri Jun 27 19:19:12 1997  Michael Snyder  (msnyder@cleaver.cygnus.com)
 
        * config/mips/tm-mips.h (USE_STRUCT_CONVENTION): MIPS_EABI returns
index 285d37949b6e6581022ff26f587bc95f1a392317..dfca27ac58eabd6157b9ecd961ebd12becb5f911 100644 (file)
@@ -1276,6 +1276,7 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr)
       if (typecode == TYPE_CODE_STRUCT && MIPS_EABI && len > MIPS_REGSIZE)
        {
          store_address (valbuf, MIPS_REGSIZE, VALUE_ADDRESS (arg));
+         typecode = TYPE_CODE_PTR;
          len = MIPS_REGSIZE;
          val = valbuf;
        }
@@ -1369,8 +1370,23 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr)
              else
                {
                  /* Write this portion of the argument to the stack.  */
+                 int longword_offset;
+
                  partial_len = len;
-                 write_memory (sp + stack_offset, val, partial_len);
+                 longword_offset = 0;
+                 if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+                   if (MIPS_REGSIZE == 8 &&
+                       (typecode == TYPE_CODE_INT ||
+                        typecode == TYPE_CODE_PTR ||
+                        typecode == TYPE_CODE_FLT) && len <= 4)
+                     longword_offset = 4;
+                   else if ((typecode == TYPE_CODE_STRUCT ||
+                             typecode == TYPE_CODE_UNION) &&
+                            len < MIPS_REGSIZE)
+                     longword_offset = MIPS_REGSIZE - len;
+
+                 write_memory (sp + stack_offset + longword_offset, 
+                               val, partial_len);
                  stack_offset += ROUND_UP (partial_len, MIPS_REGSIZE);
                }