diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-09-28 16:11:29 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-09-28 16:11:29 +0000 |
commit | 7079c36ccc7d18d5958f2ec2b73f9589cefa19ef (patch) | |
tree | ef795fa30d21a957cc07d9d5bb087a4e6f54e5e5 /gdb/sh-tdep.c | |
parent | b89fe0ee4b061b9150fd2ae60800a589ffd163f3 (diff) | |
download | gdb-7079c36ccc7d18d5958f2ec2b73f9589cefa19ef.zip gdb-7079c36ccc7d18d5958f2ec2b73f9589cefa19ef.tar.gz gdb-7079c36ccc7d18d5958f2ec2b73f9589cefa19ef.tar.bz2 |
* 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.
Diffstat (limited to 'gdb/sh-tdep.c')
-rw-r--r-- | gdb/sh-tdep.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 7ac5b9e..c5e5bf4 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -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); |