summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2001-02-06 02:00:44 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2001-02-06 02:00:44 +0000
commitdcb27f6560d8b1fb10f5a32d97b1a5fea10ac859 (patch)
tree452a4a758e00e360af5bda88a206b9c548adceaa /gdb
parent91d0a5f1c975da2568e855f67b01bdcbf122912c (diff)
downloadgdb-dcb27f6560d8b1fb10f5a32d97b1a5fea10ac859.tar.gz
2001-02-05 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* sh-tdep.c: Update copyright. (sh_extract_return_value): Rewrite. (sh3e_sh4_extract_return_value): New function. (sh_gdbarch_init): Initialize gdbarch_extract-return_value to new version of the function for sh3e and sh4 CPUs.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/sh-tdep.c74
2 files changed, 78 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2c46354430e..de46f83a922 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2001-02-05 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
+
+ * sh-tdep.c: Update copyright.
+ (sh_extract_return_value): Rewrite.
+ (sh3e_sh4_extract_return_value): New function.
+ (sh_gdbarch_init): Initialize gdbarch_extract-return_value to new
+ version of the function for sh3e and sh4 CPUs.
+
2001-02-05 Michael Chastain <chastain@redhat.com>
* hppah-nat.c (child_xfer_memory): Add parameter 'struct mem_attrib *'
@@ -575,8 +583,8 @@ Fri Jan 12 18:29:46 2001 Andrew Cagney <cagney@b1.cygnus.com>
2001-01-02 Michael Snyder <msnyder@cleaver.cygnus.com>
- * sh-tdep.c (sh_extract_return_value): Allow for small return type.
- (sh_sh4_extract_return_value): Call sh_extract_return_value for
+ * sh-tdep.c (sh_default_store_return_value): Allow for small return type.
+ (sh3e_sh4_store_return_value): Call sh_default_store_return_value for
non-float types.
* sparc-tdep.c (sparc_frame_chain): Fix typo in comment.
Update copyright notice.
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 74783bf2a60..a6320305714 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for Hitachi Super-H, for GDB.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2000 Free Software
- Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -59,6 +59,7 @@ static gdbarch_saved_pc_after_call_ftype sh_saved_pc_after_call;
/* Function call related functions. */
static gdbarch_extract_return_value_ftype sh_extract_return_value;
+static gdbarch_extract_return_value_ftype sh3e_sh4_extract_return_value;
static gdbarch_extract_struct_value_address_ftype sh_extract_struct_value_address;
static gdbarch_use_struct_convention_ftype sh_use_struct_convention;
static gdbarch_store_struct_return_ftype sh_store_struct_return;
@@ -1042,11 +1043,70 @@ static void
sh_extract_return_value (struct type *type, char *regbuf, char *valbuf)
{
int len = TYPE_LENGTH (type);
-
+ int return_register = R0_REGNUM;
+ int offset;
+
if (len <= 4)
- memcpy (valbuf, ((char *) regbuf) + 4 - len, len);
+ {
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ offset = REGISTER_BYTE (return_register) + 4 - len;
+ else
+ offset = REGISTER_BYTE (return_register);
+ memcpy (valbuf, regbuf + offset, len);
+ }
else if (len <= 8)
- memcpy (valbuf, ((char *) regbuf) + 8 - len, len);
+ {
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ offset = REGISTER_BYTE (return_register) + 8 - len;
+ else
+ offset = REGISTER_BYTE (return_register);
+ memcpy (valbuf, regbuf + offset, len);
+ }
+ else
+ error ("bad size for return value");
+}
+
+static void
+sh3e_sh4_extract_return_value (struct type *type, char *regbuf, char *valbuf)
+{
+ int return_register;
+ int offset;
+ int len = TYPE_LENGTH (type);
+
+ if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ return_register = FP0_REGNUM;
+ else
+ return_register = R0_REGNUM;
+
+ if (len == 8 && TYPE_CODE (type) == TYPE_CODE_FLT)
+ {
+ DOUBLEST val;
+ if (TARGET_BYTE_ORDER == LITTLE_ENDIAN)
+ floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
+ (char *) regbuf + REGISTER_BYTE (return_register),
+ &val);
+ else
+ floatformat_to_doublest (&floatformat_ieee_double_big,
+ (char *) regbuf + REGISTER_BYTE (return_register),
+ &val);
+ store_floating (valbuf, len, val);
+ }
+ else if (len <= 4)
+ {
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ offset = REGISTER_BYTE (return_register) + 4 - len;
+ else
+ offset = REGISTER_BYTE (return_register);
+ memcpy (valbuf, regbuf + offset, len);
+ }
+ else if (len <= 8)
+ {
+ if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+ offset = REGISTER_BYTE (return_register) + 8 - len;
+ else
+ offset = REGISTER_BYTE (return_register);
+ memcpy (valbuf, regbuf + offset, len);
+ }
else
error ("bad size for return value");
}
@@ -1917,6 +1977,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_store_pseudo_register (gdbarch, sh_store_pseudo_register);
set_gdbarch_do_registers_info (gdbarch, sh_do_registers_info);
set_gdbarch_breakpoint_from_pc (gdbarch, sh_breakpoint_from_pc);
+ set_gdbarch_extract_return_value (gdbarch, sh_extract_return_value);
print_sh_insn = gdb_print_insn_sh;
switch (info.bfd_arch_info->mach)
@@ -1982,6 +2043,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
sh_show_regs = sh3e_show_regs;
sh_store_return_value = sh3e_sh4_store_return_value;
sh_register_virtual_type = sh_sh3e_register_virtual_type;
+ set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
set_gdbarch_register_raw_size (gdbarch, sh_default_register_raw_size);
set_gdbarch_register_virtual_size (gdbarch, sh_default_register_raw_size);
@@ -2024,6 +2086,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
sh_show_regs = sh4_show_regs;
sh_store_return_value = sh3e_sh4_store_return_value;
sh_register_virtual_type = sh_sh4_register_virtual_type;
+ set_gdbarch_extract_return_value (gdbarch, sh3e_sh4_extract_return_value);
set_gdbarch_frame_init_saved_regs (gdbarch, sh_fp_frame_init_saved_regs);
set_gdbarch_fp0_regnum (gdbarch, 25);
set_gdbarch_register_raw_size (gdbarch, sh_sh4_register_raw_size);
@@ -2092,7 +2155,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_coerce_float_to_double (gdbarch,
sh_coerce_float_to_double);
- set_gdbarch_extract_return_value (gdbarch, sh_extract_return_value);
set_gdbarch_push_arguments (gdbarch, sh_push_arguments);
set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
set_gdbarch_push_return_address (gdbarch, sh_push_return_address);