aboutsummaryrefslogtreecommitdiff
path: root/gdb/sh-tdep.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-10-14 15:35:43 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-10-14 15:35:43 +0000
commit2e9524084379a0bbb04f36479fa3405e0a2805e8 (patch)
tree6b4032043819a505f7cca64fa7703f9da50427cd /gdb/sh-tdep.c
parent7e86466e042a93e03168e155a3fda965c4b5cc0f (diff)
downloadfsf-binutils-gdb-2e9524084379a0bbb04f36479fa3405e0a2805e8.zip
fsf-binutils-gdb-2e9524084379a0bbb04f36479fa3405e0a2805e8.tar.gz
fsf-binutils-gdb-2e9524084379a0bbb04f36479fa3405e0a2805e8.tar.bz2
* sh-tdep.c: Fix two copy/paste hangovers in comments.
(sh_push_dummy_call_fpu): Accomodate double passing in little endian mode. (sh3e_sh4_extract_return_value): Ditto.
Diffstat (limited to 'gdb/sh-tdep.c')
-rw-r--r--gdb/sh-tdep.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index c99b8ac..f7b1c87 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -543,9 +543,7 @@ sh_skip_prologue (CORE_ADDR start_pc)
return pc;
}
-/* Should call_function allocate stack space for a struct return?
-
- The ABI says:
+/* The ABI says:
Aggregate types not bigger than 8 bytes that have the same size and
alignment as one of the integer scalar types are returned in the
@@ -790,7 +788,7 @@ sh_next_flt_argreg (int len)
/* Helper function which figures out, if a type is treated like a float type.
- Second, the FPU ABIs have a special way how to treat types as float types.
+ The FPU ABIs have a special way how to treat types as float types.
Structures with exactly one member, which is of type float or double, are
treated exactly as the base types float or double:
@@ -909,6 +907,22 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
/* Argument goes in a float argument register. */
reg_size = register_size (gdbarch, flt_argreg);
regval = extract_unsigned_integer (val, reg_size);
+ /* In little endian mode, float types taking two registers
+ (doubles on sh4, long doubles on sh2e, sh3e and sh4) must
+ be stored swapped in the argument registers. The below
+ code first writes the first 32 bits in the next but one
+ register, increments the val and len values accordingly
+ and then proceeds as normal by writing the second 32 bits
+ into the next register. */
+ if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE
+ && TYPE_LENGTH (type) == 2 * reg_size)
+ {
+ regcache_cooked_write_unsigned (regcache, flt_argreg + 1,
+ regval);
+ val += reg_size;
+ len -= reg_size;
+ regval = extract_unsigned_integer (val, reg_size);
+ }
regcache_cooked_write_unsigned (regcache, flt_argreg++, regval);
}
else if (!treat_as_flt && argreg <= ARGLAST_REGNUM)
@@ -1041,7 +1055,10 @@ sh3e_sh4_extract_return_value (struct type *type, struct regcache *regcache,
int len = TYPE_LENGTH (type);
int i, regnum = FP0_REGNUM;
for (i = 0; i < len; i += 4)
- regcache_raw_read (regcache, regnum++, (char *) valbuf + i);
+ if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE)
+ regcache_raw_read (regcache, regnum++, (char *) valbuf + len - 4 - i);
+ else
+ regcache_raw_read (regcache, regnum++, (char *) valbuf + i);
}
else
sh_default_extract_return_value (type, regcache, valbuf);