From f6e56ab396717b198eb7a8eded5d0d2d24483c5e Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 12 Oct 2007 15:30:05 +0000 Subject: * cris-tdep.c (cris_push_dummy_call): Support arguments passed by reference. Fix endianness bugs. (cris_reg_struct_has_address): Remove. (cris_gdbarch_init): Remove set_gdbarch_deprecated_reg_struct_has_addr and set_gdbarch_deprecated_use_struct_convention calls. * gdbarch.sh (deprecated_reg_struct_has_addr): Remove. * gdbarch.c, gdbarch.h: Regenerate. * infcall.c (call_function_by_hand): Remove handling of deprecated_reg_struct_has_addr. doc/ChangeLog: * gdbint.texi (Target Conditionals): Remove documentation of and references to DEPRECATED_REG_STRUCT_HAS_ADDR. --- gdb/cris-tdep.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'gdb/cris-tdep.c') diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 7d8bdb2..a2999a5 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -938,8 +938,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Data passed by value. Fits in available register(s). */ for (i = 0; i < reg_demand; i++) { - regcache_cooked_write_unsigned (regcache, argreg, - *(unsigned long *) val); + regcache_cooked_write (regcache, argreg, val); argreg++; val += 4; } @@ -952,8 +951,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { if (argreg <= ARG4_REGNUM) { - regcache_cooked_write_unsigned (regcache, argreg, - *(unsigned long *) val); + regcache_cooked_write (regcache, argreg, val); argreg++; val += 4; } @@ -968,8 +966,22 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else if (len > (2 * 4)) { - /* FIXME */ - internal_error (__FILE__, __LINE__, _("We don't do this")); + /* Data passed by reference. Push copy of data onto stack + and pass pointer to this copy as argument. */ + sp = (sp - len) & ~3; + write_memory (sp, val, len); + + if (argreg <= ARG4_REGNUM) + { + regcache_cooked_write_unsigned (regcache, argreg, sp); + argreg++; + } + else + { + gdb_byte buf[4]; + store_unsigned_integer (buf, 4, sp); + si = push_stack_item (si, buf, 4); + } } else { @@ -1931,18 +1943,6 @@ cris_return_value (struct gdbarch *gdbarch, struct type *type, return RETURN_VALUE_REGISTER_CONVENTION; } -/* Returns 1 if the given type will be passed by pointer rather than - directly. */ - -/* In the CRIS ABI, arguments shorter than or equal to 64 bits are passed - by value. */ - -static int -cris_reg_struct_has_addr (int gcc_p, struct type *type) -{ - return (TYPE_LENGTH (type) > 8); -} - /* Calculates a value that measures how good inst_args constraints an instruction. It stems from cris_constraint, found in cris-dis.c. */ @@ -4120,9 +4120,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } set_gdbarch_return_value (gdbarch, cris_return_value); - set_gdbarch_deprecated_reg_struct_has_addr (gdbarch, - cris_reg_struct_has_addr); - set_gdbarch_deprecated_use_struct_convention (gdbarch, always_use_struct_convention); set_gdbarch_sp_regnum (gdbarch, 14); -- cgit v1.1