* sh-tdep.c (sh_use_struct_convention): Use definition according to ABI.

(sh_push_arguments): Store in register with correct endianess.
	(sh_default_store_return_value): Ditto.
	(sh_gdbarch_init): Set sizeof long double to 8.
This commit is contained in:
Corinna Vinschen 2002-09-28 16:11:29 +00:00
parent b89fe0ee4b
commit 7079c36ccc
2 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2002-09-28 Corinna Vinschen <vinschen@redhat.com>
* sh-tdep.c (sh_use_struct_convention): Use definition according to ABI.
(sh_push_arguments): Store in register with correct endianess.
(sh_default_store_return_value): Ditto.
(sh_gdbarch_init): Set sizeof long double to 8.
2002-09-27 Mark Kettenis <kettenis@gnu.org>
* defs.h: Move inclusion of "ansidecl.h" before "gdb_locale.h".

View File

@ -884,7 +884,14 @@ sh_saved_pc_after_call (struct frame_info *frame)
static int
sh_use_struct_convention (int gcc_p, struct type *type)
{
#if 0
return (TYPE_LENGTH (type) > 1);
#else
int len = TYPE_LENGTH (type);
int nelem = TYPE_NFIELDS (type);
return ((len != 1 && len != 2 && len != 4 && len != 8) || nelem != 1) &&
(len != 8 || TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) != 4);
#endif
}
static int
@ -2045,8 +2052,11 @@ sh_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
if (len < 4)
{
/* value gets right-justified in the register or stack word */
memcpy (valbuf + (4 - len),
(char *) VALUE_CONTENTS (args[argnum]), len);
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
memcpy (valbuf + (4 - len),
(char *) VALUE_CONTENTS (args[argnum]), len);
else
memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len);
val = valbuf;
}
else
@ -2457,8 +2467,11 @@ sh_default_store_return_value (struct type *type, char *valbuf)
{
/* Add leading zeros to the value. */
memset (buf, 0, REGISTER_RAW_SIZE (R0_REGNUM));
memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
valbuf, TYPE_LENGTH (type));
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type),
valbuf, TYPE_LENGTH (type));
else
memcpy (buf, valbuf, TYPE_LENGTH (type));
write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf,
REGISTER_RAW_SIZE (R0_REGNUM));
}
@ -4544,7 +4557,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);/*??should be 8?*/
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
set_gdbarch_call_dummy_length (gdbarch, 0);