aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-tdep.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>1997-06-30 22:32:20 +0000
committerMichael Snyder <msnyder@vmware.com>1997-06-30 22:32:20 +0000
commit158bda58c566192d917115baeacd4327963ca35d (patch)
tree96cf281824a8dd64d800ce223f2c10b77cfac5af /gdb/mips-tdep.c
parent71e099952d48305c72100e51f70fdf8ffed08418 (diff)
downloadgdb-158bda58c566192d917115baeacd4327963ca35d.zip
gdb-158bda58c566192d917115baeacd4327963ca35d.tar.gz
gdb-158bda58c566192d917115baeacd4327963ca35d.tar.bz2
Mon Jun 30 15:30:38 1997 Michael Snyder (msnyder@cleaver.cygnus.com)
* mips-tdep.c (mips_push_arguments): tweak alignment of small structs passed in registers for little-endian non-EABI mode.
Diffstat (limited to 'gdb/mips-tdep.c')
-rw-r--r--gdb/mips-tdep.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index dfca27a..e08be0f 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1349,15 +1349,23 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr)
{
CORE_ADDR regval = extract_address (val, partial_len);
- /* It's a simple argument being passed in a general
- register.
- If the argument length is smaller than the register size,
- we have to adjust the argument on big endian targets.
+ /* A simple argument being passed in a general register.
+ If the length is smaller than the register size, we
+ have to adjust the alignment on big endian targets.
+
+ For structs, it appears that we have to
+ do the same even in little endian mode.
+
But don't do this adjustment on EABI targets. */
- if (TARGET_BYTE_ORDER == BIG_ENDIAN
- && partial_len < MIPS_REGSIZE
- && !MIPS_EABI)
- regval <<= ((MIPS_REGSIZE - partial_len) * TARGET_CHAR_BIT);
+
+ if (!MIPS_EABI &&
+ TYPE_LENGTH (arg_type) < MIPS_REGSIZE &&
+ (TARGET_BYTE_ORDER == BIG_ENDIAN ||
+ typecode == TYPE_CODE_STRUCT ||
+ typecode == TYPE_CODE_UNION))
+ regval <<= ((MIPS_REGSIZE - partial_len) *
+ TARGET_CHAR_BIT);
+
write_register (argreg, regval);
argreg++;
@@ -1384,7 +1392,6 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr)
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);