From: Michael Snyder Date: Thu, 6 Jun 2002 18:57:08 +0000 (+0000) Subject: 2002-06-06 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7bd91a28ebed8a2d545c02a7f25b3a6c2daf8cfe;p=binutils-gdb.git 2002-06-06 Michael Snyder * d10v-tdep.c (d10v_push_arguments): Handle struct_return. Delete extra braces and re-indent. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6af369a299c..1285ec1ac5a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,8 @@ 2002-06-06 Michael Snyder - * d10v-tdep.c (d10v_store_return_value): Char return values + * d10v-tdep.c (d10v_push_arguments): Handle struct_return. + Delete extra braces and re-indent. + (d10v_store_return_value): Char return values must be shifted over by one byte in R0. (d10v_extract_return_value): Delete extra braces, re-indent. diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 97562b7bea9..92d1d09ed28 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1086,6 +1086,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 +1103,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)