diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2002-04-29 15:10:06 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2002-04-29 15:10:06 +0000 |
commit | ace1378a15191b4c8494aea42af567264b14e27b (patch) | |
tree | 3e9a3d66245bcd8d1fc1c8a36a049498fa18521a /gdb/rs6000-tdep.c | |
parent | 2b9848d845656f4864fe9df4b148a9ff8566f153 (diff) | |
download | gdb-ace1378a15191b4c8494aea42af567264b14e27b.zip gdb-ace1378a15191b4c8494aea42af567264b14e27b.tar.gz gdb-ace1378a15191b4c8494aea42af567264b14e27b.tar.bz2 |
2002-04-29 Elena Zannoni <ezannoni@redhat.com>
* rs6000-tdep.c (rs6000_extract_return_value,
rs6000_store_return_value): Handle returning vectors.
(rs6000_gdbarch_init): Use
ppc_sysv_abi_broken_use_struct_convention for native sysv cases.
* ppc-linux-tdep.c (ppc_sysv_abi_broken_use_struct_convention):
New function.
(ppc_sysv_abi_use_struct_convention): Deal with functions returning
vectors.
(ppc_sysv_abi_push_arguments): Handle vector parameters.
* ppc-tdep.h (ppc_sysv_abi_broken_use_struct_convention): Export.
Diffstat (limited to 'gdb/rs6000-tdep.c')
-rw-r--r-- | gdb/rs6000-tdep.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 97b936d..8ccfb99 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1144,6 +1144,7 @@ static void rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) { int offset = 0; + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); if (TYPE_CODE (valtype) == TYPE_CODE_FLT) { @@ -1165,6 +1166,13 @@ rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) memcpy (valbuf, &ff, sizeof (float)); } } + else if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY + && TYPE_LENGTH (valtype) == 16 + && TYPE_VECTOR (valtype)) + { + memcpy (valbuf, regbuf + REGISTER_BYTE (tdep->ppc_vr0_regnum + 2), + TYPE_LENGTH (valtype)); + } else { /* return value is copied starting from r3. */ @@ -1909,6 +1917,8 @@ rs6000_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) static void rs6000_store_return_value (struct type *type, char *valbuf) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + if (TYPE_CODE (type) == TYPE_CODE_FLT) /* Floating point values are returned starting from FPR1 and up. @@ -1917,6 +1927,13 @@ rs6000_store_return_value (struct type *type, char *valbuf) write_register_bytes (REGISTER_BYTE (FP0_REGNUM + 1), valbuf, TYPE_LENGTH (type)); + else if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + { + if (TYPE_LENGTH (type) == 16 + && TYPE_VECTOR (type)) + write_register_bytes (REGISTER_BYTE (tdep->ppc_vr0_regnum + 2), + valbuf, TYPE_LENGTH (type)); + } else /* Everything else is returned in GPR3 and up. */ write_register_bytes (REGISTER_BYTE (gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + 3), @@ -2706,7 +2723,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) || osabi == ELFOSABI_NETBSD || osabi == ELFOSABI_FREEBSD) set_gdbarch_use_struct_convention (gdbarch, - generic_use_struct_convention); + ppc_sysv_abi_broken_use_struct_convention); else set_gdbarch_use_struct_convention (gdbarch, ppc_sysv_abi_use_struct_convention); |