2002-05-30 03:21:53 +02:00
|
|
|
/* Target-dependent code for PowerPC systems using the SVR4 ABI
|
|
|
|
for GDB, the GNU debugger.
|
|
|
|
|
2008-01-01 23:53:26 +01:00
|
|
|
Copyright (C) 2000, 2001, 2002, 2003, 2005, 2007, 2008
|
2005-08-16 19:12:35 +02:00
|
|
|
Free Software Foundation, Inc.
|
2002-05-30 03:21:53 +02:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-05-30 03:21:53 +02:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 20:08:50 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2002-05-30 03:21:53 +02:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include "inferior.h"
|
|
|
|
#include "regcache.h"
|
|
|
|
#include "value.h"
|
2002-10-01 21:26:05 +02:00
|
|
|
#include "gdb_string.h"
|
2003-10-10 20:29:13 +02:00
|
|
|
#include "gdb_assert.h"
|
2002-05-30 03:21:53 +02:00
|
|
|
#include "ppc-tdep.h"
|
2003-10-31 17:37:03 +01:00
|
|
|
#include "target.h"
|
2003-11-14 15:34:30 +01:00
|
|
|
#include "objfiles.h"
|
2004-06-07 04:02:55 +02:00
|
|
|
#include "infcall.h"
|
2002-05-30 03:21:53 +02:00
|
|
|
|
|
|
|
/* Pass the arguments in either registers, or in the stack. Using the
|
|
|
|
ppc sysv ABI, the first eight words of the argument list (that might
|
|
|
|
be less than eight parameters if some parameters occupy more than one
|
|
|
|
word) are passed in r3..r10 registers. float and double parameters are
|
|
|
|
passed in fpr's, in addition to that. Rest of the parameters if any
|
|
|
|
are passed in user stack.
|
|
|
|
|
|
|
|
If the function is returning a structure, then the return address is passed
|
|
|
|
in r3, then the first 7 words of the parametes can be passed in registers,
|
|
|
|
starting from r4. */
|
|
|
|
|
|
|
|
CORE_ADDR
|
2004-06-07 04:02:55 +02:00
|
|
|
ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
2003-09-09 20:29:27 +02:00
|
|
|
struct regcache *regcache, CORE_ADDR bp_addr,
|
|
|
|
int nargs, struct value **args, CORE_ADDR sp,
|
|
|
|
int struct_return, CORE_ADDR struct_addr)
|
2002-05-30 03:21:53 +02:00
|
|
|
{
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
2007-05-13 14:27:30 +02:00
|
|
|
ULONGEST saved_sp;
|
2003-09-12 20:55:24 +02:00
|
|
|
int argspace = 0; /* 0 is an initial wrong guess. */
|
|
|
|
int write_pass;
|
2002-05-30 03:21:53 +02:00
|
|
|
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
gdb_assert (tdep->wordsize == 4);
|
|
|
|
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
|
2007-06-18 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (SP_REGNUM): Replace by gdbarch_sp_regnum.
* v850-tdep.c (v850_unwind_sp): Likewise.
* std-regs.c (value_of_builtin_frame_sp_reg): Likewise.
* stack.c (frame_info): Likewise.
* stabsread.c (define_symbol): Likewise.
* sh-tdep.c (sh_push_dummy_call_fpu, sh_push_dummy_call_nofpu)
(sh_dwarf2_frame_init_reg, sh_frame_cache, sh_frame_prev_register)
(sh_unwind_sp): Likewise.
* sh64-tdep.c (sh64_push_dummy_call, sh64_frame_cache)
(sh64_frame_prev_register, sh64_unwind_sp): Likewise.
* rs6000-tdep.c (rs6000_push_dummy_call, rs6000_unwind_dummy_id)
(rs6000_frame_cache): Likewise.
* rs6000-nat.c (store_register): Likewise.
* remote-mips.c (mips_wait): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* m32r-rom.c (m32r_supply_register): Likewise.
* frame.c (frame_sp_unwind): Likewise.
* mips-tdep.c (mips_insn16_frame_cache)
(mips_insn32_frame_cache): Likewise (comment).
* m68klinux-nat.c (supply_gregset): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* ia64-tdep.c (ia64_frame_prev_register): Likewise.
* i386-tdep.c (i386_get_longjmp_target): Likewise.
* dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise.
* cris-tdep.c (cris_regnums, cris_sigcontext_addr)
(cris_sigtramp_frame_unwind_cache, cris_push_dummy_call)
(cris_scan_prologue, crisv32_scan_prologue, cris_unwind_sp)
(cris_register_type, crisv32_register_type)
(cris_dwarf2_frame_init_reg): Likewise.
* arch-utils.c (legacy_virtual_frame_pointer): Likewise.
* amd64-tdep.c (amd64_frame_prev_register): Likewise.
* amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Likewise.
* libunwind-frame.c (libunwind_frame_cache): Likewise.
* gdbarch.sh (PC_REGNUM): Replace by gdbarch_pc_regnum.
* regcache.c (read_pc_pid, generic_target_write_pc): Likewise.
* xtensa-tdep.c (xtensa_register_type, xtensa_supply_gregset)
(xtensa_unwind_pc, xtensa_frame_cache, xtensa_frame_prev_register)
(xtensa_extract_return_value, xtensa_store_return_value): Likewise.
* v850-tdep.c (v850_unwind_pc): Likewise.
* stack.c (frame_info): Likewise.
* sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs)
(sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs)
(sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs)
(sh_dwarf2_frame_init_reg, sh_frame_prev_register, sh_unwind_pc)
(sh_dsp_show_regs): Likewise.
* shnbsd-tdep.c (shnbsd_supply_gregset)
(shnbsd_collect_gregset): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Likewise.
* sh64-tdep.c (sh64_compact_reg_base_num, sh64_show_media_regs)
(sh64_frame_prev_register, sh64_unwind_pc): Likewise.
* rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset)
(6000_register_reggroup_p, rs6000_unwind_pc)
(rs6000_frame_cache): Likewise.
* rs6000-nat.c (regmap, rs6000_fetch_inferior_registers)
(rs6000_store_inferior_registers): Likewise.
* remote-mips.c (mips_wait, mips_load): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcnbsd-nat.c (getregs_supplies, ppcnbsd_supply_pcb): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_ppc_registers)
(store_ppc_registers, fill_gregset): Likewise.
* mips-tdep.c (mips_stub_frame_cache, mips_gdbarch_init): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_supply_reg, mipsnbsd_fill_reg): Likewise.
* mipsnbsd-nat.c (getregs_supplies): Likewise.
* m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise.
* m68klinux-nat.c (supply_gregset): Likewise.
* irix5-nat.c (fill_gregset): Likewise.
* i386-tdep.c (i386_unwind_pc): Likewise.
* i386-linux-nat.c (i386_linux_resume): Likewise.
* frame.c (get_prev_frame_1): Likewise.
* dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise.
* dbug-rom.c (dbug_supply_register): Likewise.
* cris-tdep.c (cris_sigtramp_frame_unwind_cache, cris_scan_prologue)
(crisv32_scan_prologue, cris_unwind_pc, cris_register_size)
(cris_register_type, crisv32_register_type, crisv32_register_name)
(cris_dwarf2_frame_init_reg, find_step_target)
(cris_software_single_step, cris_supply_gregset)
(cris_regnums): Likewise.
* alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise.
* aix-thread.c (special_register_p, supply_sprs64, supply_sprs32)
(fill_sprs64, fill_sprs32, store_regs_user_thread): Likewise.
* mips-linux-tdep.c (mips_linux_write_pc): Likewise.
* gdbarch.sh (PS_REGNUM): Replace by gdbarch_ps_regnum.
* dbug-rom.c (dbug_supply_register): Likewise.
* xtensa-tdep.c (xtensa_supply_gregset, xtensa_frame_cache)
(xtensa_frame_prev_register, xtensa_push_dummy_call): Likewise.
* win32-nat.c (win32_resume): Likewise.
* std-regs.c (value_of_builtin_frame_ps_reg)
(value_of_builtin_frame_pc_reg): Likewise.
* m68k-tdep.c (m68k_register_type): Likewise.
* m68klinux-nat.c (supply_gregset): Likewise.
* gdbarch.sh (FP0_REGNUM): Replace by gdbarch_fp0_regnum.
* sh-tdep.c (sh_extract_return_value_fpu, sh_store_return_value_fpu)
(sh2e_show_regs, sh2a_show_regs, sh3e_show_regs, sh4_show_regs)
(sh_sh2a_register_type, sh_sh3e_register_type, sh_sh4_register_type)
(fv_reg_base_num, dr_reg_base_num): Likewise.
* sh64-tdep.c (sh64_fv_reg_base_num, sh64_dr_reg_base_num)
(sh64_fpp_reg_base_num, sh64_compact_reg_base_num, sh64_push_dummy_call)
(sh64_extract_return_value, sh64_store_return_value)
(sh64_show_media_regs, sh64_show_compact_regs, sh64_register_type)
(sh64_do_fp_register, sh64_media_print_registers_info): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers)
(invalidate_cache): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_supply_fpreg)
(mipsnbsd_fill_fpreg): Likewise.
* mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Likewise.
* mips-linux-tdep.c (mips_supply_fpregset, mips_fill_fpregset)
(mips64_supply_fpregset, mips64_fill_fpregset): Likewise.
* mips-linux-nat.c (mips64_linux_register_addr): Likewise.
* m68k-tdep.c (m68k_register_type, m68k_convert_register_p): Likewise.
* m68klinux-nat.c (getfpregs_supplies, supply_fpregset)
(fill_fpregset): Likewise.
* irix5-nat.c (supply_fpregset, fill_fpregset): Likewise.
* i386-tdep.h (struct_return): Likewise (comment).
* i386-nto-tdep.c (i386nto_register_area): Likewise.
* go32-nat.c (fetch_register, go32_fetch_registers, store_register)
(go32_store_registers): Likewise.
* alpha-tdep.c (alpha_next_pc): Likewise.
* alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise.
* alphabsd-nat.c (alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Likewise.
* core-regset.c (fetch_core_registers): Likewise.
* i386v4-nat.c (supply_fpregset, fill_fpregset): Likewise.
* gdbarch.c, gdbarch.h: Regenerate.
2007-06-18 19:45:26 +02:00
|
|
|
&saved_sp);
|
2007-05-13 14:27:30 +02:00
|
|
|
|
2003-09-12 20:55:24 +02:00
|
|
|
/* Go through the argument list twice.
|
2002-05-30 03:21:53 +02:00
|
|
|
|
2003-09-12 20:55:24 +02:00
|
|
|
Pass 1: Figure out how much new stack space is required for
|
|
|
|
arguments and pushed values. Unlike the PowerOpen ABI, the SysV
|
|
|
|
ABI doesn't reserve any extra space for parameters which are put
|
|
|
|
in registers, but does always push structures and then pass their
|
|
|
|
address.
|
2003-09-09 22:22:37 +02:00
|
|
|
|
2003-09-12 20:55:24 +02:00
|
|
|
Pass 2: Replay the same computation but this time also write the
|
|
|
|
values out to the target. */
|
2002-05-30 03:21:53 +02:00
|
|
|
|
2003-09-12 20:55:24 +02:00
|
|
|
for (write_pass = 0; write_pass < 2; write_pass++)
|
|
|
|
{
|
|
|
|
int argno;
|
|
|
|
/* Next available floating point register for float and double
|
|
|
|
arguments. */
|
|
|
|
int freg = 1;
|
|
|
|
/* Next available general register for non-float, non-vector
|
|
|
|
arguments. */
|
|
|
|
int greg = 3;
|
|
|
|
/* Next available vector register for vector arguments. */
|
|
|
|
int vreg = 2;
|
|
|
|
/* Arguments start above the "LR save word" and "Back chain". */
|
|
|
|
int argoffset = 2 * tdep->wordsize;
|
|
|
|
/* Structures start after the arguments. */
|
|
|
|
int structoffset = argoffset + argspace;
|
|
|
|
|
|
|
|
/* If the function is returning a `struct', then the first word
|
2003-10-07 00:23:47 +02:00
|
|
|
(which will be passed in r3) is used for struct return
|
|
|
|
address. In that case we should advance one word and start
|
|
|
|
from r4 register to copy parameters. */
|
2003-09-12 20:55:24 +02:00
|
|
|
if (struct_return)
|
2002-05-30 03:21:53 +02:00
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
if (write_pass)
|
|
|
|
regcache_cooked_write_signed (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg,
|
|
|
|
struct_addr);
|
|
|
|
greg++;
|
2002-05-30 03:21:53 +02:00
|
|
|
}
|
2003-09-12 20:55:24 +02:00
|
|
|
|
|
|
|
for (argno = 0; argno < nargs; argno++)
|
2002-05-30 03:21:53 +02:00
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
struct value *arg = args[argno];
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-12 22:45:08 +01:00
|
|
|
struct type *type = check_typedef (value_type (arg));
|
2003-09-12 20:55:24 +02:00
|
|
|
int len = TYPE_LENGTH (type);
|
2005-02-06 Andrew Cagney <cagney@gnu.org>
* value.c (value_contents, value_contents_writeable): New
functions.
* value.h (VALUE_CONTENTS): Delete macro.
(value_contents, value_contents_writeable): Declare.
* xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
* stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
* sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
* rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
* ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
* m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
* jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
* hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
* c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
* cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
* arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
* ada-valprint.c, ada-lang.c: Update.
2005-02-07 01:09:56 +01:00
|
|
|
const bfd_byte *val = value_contents (arg);
|
2003-09-12 20:55:24 +02:00
|
|
|
|
2007-10-30 20:35:35 +01:00
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_FLT && len <= 8
|
|
|
|
&& !tdep->soft_float)
|
2002-05-30 03:21:53 +02:00
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
/* Floating point value converted to "double" then
|
2003-10-07 00:23:47 +02:00
|
|
|
passed in an FP register, when the registers run out,
|
|
|
|
8 byte aligned stack is used. */
|
2003-09-12 20:55:24 +02:00
|
|
|
if (freg <= 8)
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
/* Always store the floating point value using
|
2003-10-07 00:23:47 +02:00
|
|
|
the register's floating-point format. */
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
2003-09-12 20:55:24 +02:00
|
|
|
struct type *regtype
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
= register_type (gdbarch, tdep->ppc_fp0_regnum + freg);
|
2003-09-12 20:55:24 +02:00
|
|
|
convert_typed_floating (val, type, regval, regtype);
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg,
|
2003-09-12 20:55:24 +02:00
|
|
|
regval);
|
|
|
|
}
|
|
|
|
freg++;
|
|
|
|
}
|
2002-05-30 03:21:53 +02:00
|
|
|
else
|
|
|
|
{
|
2008-02-02 01:07:57 +01:00
|
|
|
/* The SysV ABI tells us to convert floats to
|
|
|
|
doubles before writing them to an 8 byte aligned
|
|
|
|
stack location. Unfortunately GCC does not do
|
|
|
|
that, and stores floats into 4 byte aligned
|
|
|
|
locations without converting them to doubles.
|
|
|
|
Since there is no know compiler that actually
|
|
|
|
follows the ABI here, we implement the GCC
|
|
|
|
convention. */
|
|
|
|
|
|
|
|
/* Align to 4 bytes or 8 bytes depending on the type of
|
|
|
|
the argument (float or double). */
|
|
|
|
argoffset = align_up (argoffset, len);
|
2003-09-12 20:55:24 +02:00
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + argoffset, val, len);
|
2008-02-02 01:07:57 +01:00
|
|
|
argoffset += len;
|
2002-05-30 03:21:53 +02:00
|
|
|
}
|
|
|
|
}
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
else if (TYPE_CODE (type) == TYPE_CODE_FLT
|
|
|
|
&& len == 16
|
|
|
|
&& !tdep->soft_float
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
&& (gdbarch_long_double_format (gdbarch)
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
== floatformats_ibm_long_double))
|
|
|
|
{
|
|
|
|
/* IBM long double passed in two FP registers if
|
|
|
|
available, otherwise 8-byte aligned stack. */
|
|
|
|
if (freg <= 7)
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg,
|
|
|
|
val);
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg + 1,
|
|
|
|
val + 8);
|
|
|
|
}
|
|
|
|
freg += 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
argoffset = align_up (argoffset, 8);
|
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + argoffset, val, len);
|
|
|
|
argoffset += 16;
|
|
|
|
}
|
|
|
|
}
|
2007-10-30 20:35:35 +01:00
|
|
|
else if (len == 8
|
|
|
|
&& (TYPE_CODE (type) == TYPE_CODE_INT /* long long */
|
2008-06-26 17:38:39 +02:00
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_FLT /* double */
|
|
|
|
|| (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
|
|
|
|
&& tdep->soft_float)))
|
2002-05-30 03:21:53 +02:00
|
|
|
{
|
2008-06-26 17:38:39 +02:00
|
|
|
/* "long long" or soft-float "double" or "_Decimal64"
|
|
|
|
passed in an odd/even register pair with the low
|
|
|
|
addressed word in the odd register and the high
|
|
|
|
addressed word in the even register, or when the
|
|
|
|
registers run out an 8 byte aligned stack
|
|
|
|
location. */
|
2003-09-12 20:55:24 +02:00
|
|
|
if (greg > 9)
|
|
|
|
{
|
|
|
|
/* Just in case GREG was 10. */
|
|
|
|
greg = 11;
|
|
|
|
argoffset = align_up (argoffset, 8);
|
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + argoffset, val, len);
|
|
|
|
argoffset += 8;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Must start on an odd register - r3/r4 etc. */
|
|
|
|
if ((greg & 1) == 0)
|
|
|
|
greg++;
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg + 0,
|
|
|
|
val + 0);
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg + 1,
|
|
|
|
val + 4);
|
|
|
|
}
|
|
|
|
greg += 2;
|
|
|
|
}
|
2002-05-30 03:21:53 +02:00
|
|
|
}
|
2008-06-26 17:38:39 +02:00
|
|
|
else if (len == 16
|
|
|
|
&& ((TYPE_CODE (type) == TYPE_CODE_FLT
|
|
|
|
&& (gdbarch_long_double_format (gdbarch)
|
|
|
|
== floatformats_ibm_long_double))
|
|
|
|
|| (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
|
|
|
|
&& tdep->soft_float)))
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
{
|
2008-06-26 17:38:39 +02:00
|
|
|
/* Soft-float IBM long double or _Decimal128 passed in
|
|
|
|
four consecutive registers, or on the stack. The
|
|
|
|
registers are not necessarily odd/even pairs. */
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
if (greg > 7)
|
|
|
|
{
|
|
|
|
greg = 11;
|
|
|
|
argoffset = align_up (argoffset, 8);
|
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + argoffset, val, len);
|
|
|
|
argoffset += 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg + 0,
|
|
|
|
val + 0);
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg + 1,
|
|
|
|
val + 4);
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg + 2,
|
|
|
|
val + 8);
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg + 3,
|
|
|
|
val + 12);
|
|
|
|
}
|
|
|
|
greg += 4;
|
|
|
|
}
|
|
|
|
}
|
2008-01-30 04:18:39 +01:00
|
|
|
else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && len <= 8
|
|
|
|
&& !tdep->soft_float)
|
|
|
|
{
|
|
|
|
/* 32-bit and 64-bit decimal floats go in f1 .. f8. They can
|
|
|
|
end up in memory. */
|
|
|
|
|
|
|
|
if (freg <= 8)
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
|
|
|
const gdb_byte *p;
|
|
|
|
|
|
|
|
/* 32-bit decimal floats are right aligned in the
|
|
|
|
doubleword. */
|
|
|
|
if (TYPE_LENGTH (type) == 4)
|
|
|
|
{
|
|
|
|
memcpy (regval + 4, val, 4);
|
|
|
|
p = regval;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p = val;
|
|
|
|
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg, p);
|
|
|
|
}
|
|
|
|
|
|
|
|
freg++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
argoffset = align_up (argoffset, len);
|
|
|
|
|
|
|
|
if (write_pass)
|
|
|
|
/* Write value in the stack's parameter save area. */
|
|
|
|
write_memory (sp + argoffset, val, len);
|
|
|
|
|
|
|
|
argoffset += len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && len == 16
|
|
|
|
&& !tdep->soft_float)
|
|
|
|
{
|
|
|
|
/* 128-bit decimal floats go in f2 .. f7, always in even/odd
|
|
|
|
pairs. They can end up in memory, using two doublewords. */
|
|
|
|
|
|
|
|
if (freg <= 6)
|
|
|
|
{
|
|
|
|
/* Make sure freg is even. */
|
|
|
|
freg += freg & 1;
|
|
|
|
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg, val);
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg + 1, val + 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
argoffset = align_up (argoffset, 8);
|
|
|
|
|
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + argoffset, val, 16);
|
|
|
|
|
|
|
|
argoffset += 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If a 128-bit decimal float goes to the stack because only f7
|
|
|
|
and f8 are free (thus there's no even/odd register pair
|
|
|
|
available), these registers should be marked as occupied.
|
|
|
|
Hence we increase freg even when writing to memory. */
|
|
|
|
freg += 2;
|
|
|
|
}
|
2003-09-12 20:55:24 +02:00
|
|
|
else if (len == 16
|
|
|
|
&& TYPE_CODE (type) == TYPE_CODE_ARRAY
|
2007-10-30 20:35:35 +01:00
|
|
|
&& TYPE_VECTOR (type)
|
|
|
|
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
|
2002-05-30 03:21:53 +02:00
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
/* Vector parameter passed in an Altivec register, or
|
2003-10-07 00:23:47 +02:00
|
|
|
when that runs out, 16 byte aligned stack location. */
|
2002-05-30 03:21:53 +02:00
|
|
|
if (vreg <= 13)
|
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
if (write_pass)
|
2007-06-16 00:34:13 +02:00
|
|
|
regcache_cooked_write (regcache,
|
2003-10-07 00:23:47 +02:00
|
|
|
tdep->ppc_vr0_regnum + vreg, val);
|
2002-05-30 03:21:53 +02:00
|
|
|
vreg++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
argoffset = align_up (argoffset, 16);
|
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + argoffset, val, 16);
|
2002-05-30 03:21:53 +02:00
|
|
|
argoffset += 16;
|
|
|
|
}
|
|
|
|
}
|
2003-10-07 00:23:47 +02:00
|
|
|
else if (len == 8
|
2003-03-17 19:27:07 +01:00
|
|
|
&& TYPE_CODE (type) == TYPE_CODE_ARRAY
|
2007-10-30 20:35:35 +01:00
|
|
|
&& TYPE_VECTOR (type)
|
|
|
|
&& tdep->vector_abi == POWERPC_VEC_SPE)
|
2003-10-07 00:23:47 +02:00
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
/* Vector parameter passed in an e500 register, or when
|
2003-10-07 00:23:47 +02:00
|
|
|
that runs out, 8 byte aligned stack location. Note
|
|
|
|
that since e500 vector and general purpose registers
|
|
|
|
both map onto the same underlying register set, a
|
|
|
|
"greg" and not a "vreg" is consumed here. A cooked
|
|
|
|
write stores the value in the correct locations
|
|
|
|
within the raw register cache. */
|
|
|
|
if (greg <= 10)
|
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
if (write_pass)
|
2007-06-16 00:34:13 +02:00
|
|
|
regcache_cooked_write (regcache,
|
2003-10-07 00:23:47 +02:00
|
|
|
tdep->ppc_ev0_regnum + greg, val);
|
|
|
|
greg++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-09-12 20:55:24 +02:00
|
|
|
argoffset = align_up (argoffset, 8);
|
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + argoffset, val, 8);
|
2003-10-07 00:23:47 +02:00
|
|
|
argoffset += 8;
|
|
|
|
}
|
|
|
|
}
|
2003-09-12 20:55:24 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Reduce the parameter down to something that fits in a
|
2003-10-07 00:23:47 +02:00
|
|
|
"word". */
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte word[MAX_REGISTER_SIZE];
|
2003-09-12 20:55:24 +02:00
|
|
|
memset (word, 0, MAX_REGISTER_SIZE);
|
|
|
|
if (len > tdep->wordsize
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_STRUCT
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_UNION)
|
|
|
|
{
|
2007-10-30 20:35:35 +01:00
|
|
|
/* Structs and large values are put in an
|
|
|
|
aligned stack slot ... */
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_ARRAY
|
|
|
|
&& TYPE_VECTOR (type)
|
|
|
|
&& len >= 16)
|
|
|
|
structoffset = align_up (structoffset, 16);
|
|
|
|
else
|
|
|
|
structoffset = align_up (structoffset, 8);
|
|
|
|
|
2003-09-12 20:55:24 +02:00
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + structoffset, val, len);
|
|
|
|
/* ... and then a "word" pointing to that address is
|
2003-10-07 00:23:47 +02:00
|
|
|
passed as the parameter. */
|
2003-09-12 20:55:24 +02:00
|
|
|
store_unsigned_integer (word, tdep->wordsize,
|
|
|
|
sp + structoffset);
|
|
|
|
structoffset += len;
|
|
|
|
}
|
|
|
|
else if (TYPE_CODE (type) == TYPE_CODE_INT)
|
|
|
|
/* Sign or zero extend the "int" into a "word". */
|
|
|
|
store_unsigned_integer (word, tdep->wordsize,
|
|
|
|
unpack_long (type, val));
|
|
|
|
else
|
|
|
|
/* Always goes in the low address. */
|
|
|
|
memcpy (word, val, len);
|
|
|
|
/* Store that "word" in a register, or on the stack.
|
2003-10-07 00:23:47 +02:00
|
|
|
The words have "4" byte alignment. */
|
2003-09-12 20:55:24 +02:00
|
|
|
if (greg <= 10)
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
regcache_cooked_write (regcache,
|
2003-10-07 00:23:47 +02:00
|
|
|
tdep->ppc_gp0_regnum + greg, word);
|
2003-09-12 20:55:24 +02:00
|
|
|
greg++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
argoffset = align_up (argoffset, tdep->wordsize);
|
|
|
|
if (write_pass)
|
|
|
|
write_memory (sp + argoffset, word, tdep->wordsize);
|
|
|
|
argoffset += tdep->wordsize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the actual stack space requirements. */
|
|
|
|
if (!write_pass)
|
|
|
|
{
|
|
|
|
/* Remember the amount of space needed by the arguments. */
|
|
|
|
argspace = argoffset;
|
|
|
|
/* Allocate space for both the arguments and the structures. */
|
|
|
|
sp -= (argoffset + structoffset);
|
|
|
|
/* Ensure that the stack is still 16 byte aligned. */
|
|
|
|
sp = align_down (sp, 16);
|
|
|
|
}
|
2005-08-16 19:12:35 +02:00
|
|
|
|
|
|
|
/* The psABI says that "A caller of a function that takes a
|
|
|
|
variable argument list shall set condition register bit 6 to
|
|
|
|
1 if it passes one or more arguments in the floating-point
|
|
|
|
registers. It is strongly recommended that the caller set the
|
|
|
|
bit to 0 otherwise..." Doing this for normal functions too
|
|
|
|
shouldn't hurt. */
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
ULONGEST cr;
|
|
|
|
|
|
|
|
regcache_cooked_read_unsigned (regcache, tdep->ppc_cr_regnum, &cr);
|
|
|
|
if (freg > 1)
|
|
|
|
cr |= 0x02000000;
|
|
|
|
else
|
|
|
|
cr &= ~0x02000000;
|
|
|
|
regcache_cooked_write_unsigned (regcache, tdep->ppc_cr_regnum, cr);
|
|
|
|
}
|
2002-05-30 03:21:53 +02:00
|
|
|
}
|
|
|
|
|
2003-09-12 20:55:24 +02:00
|
|
|
/* Update %sp. */
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
|
2003-09-12 20:55:24 +02:00
|
|
|
|
|
|
|
/* Write the backchain (it occupies WORDSIZED bytes). */
|
|
|
|
write_memory_signed_integer (sp, tdep->wordsize, saved_sp);
|
|
|
|
|
2003-09-10 00:41:47 +02:00
|
|
|
/* Point the inferior function call's return address at the dummy's
|
|
|
|
breakpoint. */
|
2003-09-12 20:55:24 +02:00
|
|
|
regcache_cooked_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr);
|
2003-09-10 00:41:47 +02:00
|
|
|
|
2002-05-30 03:21:53 +02:00
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
|
2008-01-30 04:18:39 +01:00
|
|
|
/* Handle the return-value conventions for Decimal Floating Point values
|
|
|
|
in both ppc32 and ppc64, which are the same. */
|
|
|
|
static int
|
|
|
|
get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype,
|
|
|
|
struct regcache *regcache, gdb_byte *readbuf,
|
|
|
|
const gdb_byte *writebuf)
|
|
|
|
{
|
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
|
|
|
|
|
|
|
gdb_assert (TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT);
|
|
|
|
|
|
|
|
/* 32-bit and 64-bit decimal floats in f1. */
|
|
|
|
if (TYPE_LENGTH (valtype) <= 8)
|
|
|
|
{
|
|
|
|
if (writebuf != NULL)
|
|
|
|
{
|
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
|
|
|
const gdb_byte *p;
|
|
|
|
|
|
|
|
/* 32-bit decimal float is right aligned in the doubleword. */
|
|
|
|
if (TYPE_LENGTH (valtype) == 4)
|
|
|
|
{
|
|
|
|
memcpy (regval + 4, writebuf, 4);
|
|
|
|
p = regval;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p = writebuf;
|
|
|
|
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, p);
|
|
|
|
}
|
|
|
|
if (readbuf != NULL)
|
|
|
|
{
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, readbuf);
|
|
|
|
|
|
|
|
/* Left align 32-bit decimal float. */
|
|
|
|
if (TYPE_LENGTH (valtype) == 4)
|
|
|
|
memcpy (readbuf, readbuf + 4, 4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* 128-bit decimal floats in f2,f3. */
|
|
|
|
else if (TYPE_LENGTH (valtype) == 16)
|
|
|
|
{
|
|
|
|
if (writebuf != NULL || readbuf != NULL)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
if (writebuf != NULL)
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 2 + i,
|
|
|
|
writebuf + i * 8);
|
|
|
|
if (readbuf != NULL)
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 2 + i,
|
|
|
|
readbuf + i * 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
/* Can't happen. */
|
|
|
|
internal_error (__FILE__, __LINE__, "Unknown decimal float size.");
|
|
|
|
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
|
2003-10-10 23:32:47 +02:00
|
|
|
/* Handle the return-value conventions specified by the SysV 32-bit
|
|
|
|
PowerPC ABI (including all the supplements):
|
|
|
|
|
|
|
|
no floating-point: floating-point values returned using 32-bit
|
|
|
|
general-purpose registers.
|
|
|
|
|
|
|
|
Altivec: 128-bit vectors returned using vector registers.
|
|
|
|
|
|
|
|
e500: 64-bit vectors returned using the full full 64 bit EV
|
|
|
|
register, floating-point values returned using 32-bit
|
|
|
|
general-purpose registers.
|
|
|
|
|
|
|
|
GCC (broken): Small struct values right (instead of left) aligned
|
|
|
|
when returned in general-purpose registers. */
|
|
|
|
|
|
|
|
static enum return_value_convention
|
2003-11-07 21:44:51 +01:00
|
|
|
do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
|
2007-10-30 20:35:35 +01:00
|
|
|
struct regcache *regcache, gdb_byte *readbuf,
|
|
|
|
const gdb_byte *writebuf, int broken_gcc)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2003-11-07 21:44:51 +01:00
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
2003-10-10 23:32:47 +02:00
|
|
|
gdb_assert (tdep->wordsize == 4);
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_FLT
|
|
|
|
&& TYPE_LENGTH (type) <= 8
|
2007-10-30 20:35:35 +01:00
|
|
|
&& !tdep->soft_float)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* Floats and doubles stored in "f1". Convert the value to
|
|
|
|
the required type. */
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
struct type *regtype = register_type (gdbarch,
|
|
|
|
tdep->ppc_fp0_regnum + 1);
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
|
2003-11-10 23:47:31 +01:00
|
|
|
convert_typed_floating (regval, regtype, readbuf, type);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* Floats and doubles stored in "f1". Convert the value to
|
|
|
|
the register's "double" type. */
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
|
2003-11-10 23:47:31 +01:00
|
|
|
convert_typed_floating (writebuf, type, regval, regtype);
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_FLT
|
|
|
|
&& TYPE_LENGTH (type) == 16
|
|
|
|
&& !tdep->soft_float
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
&& (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
{
|
|
|
|
/* IBM long double stored in f1 and f2. */
|
|
|
|
if (readbuf)
|
|
|
|
{
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, readbuf);
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 2,
|
|
|
|
readbuf + 8);
|
|
|
|
}
|
|
|
|
if (writebuf)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, writebuf);
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 2,
|
|
|
|
writebuf + 8);
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
2008-06-26 17:38:39 +02:00
|
|
|
if (TYPE_LENGTH (type) == 16
|
|
|
|
&& ((TYPE_CODE (type) == TYPE_CODE_FLT
|
|
|
|
&& (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
|
|
|
|
|| (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && tdep->soft_float)))
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
{
|
2008-06-26 17:38:39 +02:00
|
|
|
/* Soft-float IBM long double or _Decimal128 stored in r3, r4,
|
|
|
|
r5, r6. */
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
if (readbuf)
|
|
|
|
{
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, readbuf);
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
|
|
|
|
readbuf + 4);
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 5,
|
|
|
|
readbuf + 8);
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 6,
|
|
|
|
readbuf + 12);
|
|
|
|
}
|
|
|
|
if (writebuf)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3, writebuf);
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,
|
|
|
|
writebuf + 4);
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 5,
|
|
|
|
writebuf + 8);
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 6,
|
|
|
|
writebuf + 12);
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
2003-10-10 23:32:47 +02:00
|
|
|
if ((TYPE_CODE (type) == TYPE_CODE_INT && TYPE_LENGTH (type) == 8)
|
2008-06-26 17:38:39 +02:00
|
|
|
|| (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)
|
|
|
|
|| (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 8
|
|
|
|
&& tdep->soft_float))
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2008-06-26 17:38:39 +02:00
|
|
|
/* A long long, double or _Decimal64 stored in the 32 bit
|
|
|
|
r3/r4. */
|
2003-10-10 23:32:47 +02:00
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
|
2007-10-30 20:35:35 +01:00
|
|
|
readbuf + 0);
|
2003-10-10 23:32:47 +02:00
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
|
2007-10-30 20:35:35 +01:00
|
|
|
readbuf + 4);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2008-06-26 17:38:39 +02:00
|
|
|
/* A long long, double or _Decimal64 stored in the 32 bit
|
|
|
|
r3/r4. */
|
2003-10-10 23:32:47 +02:00
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
|
2007-10-30 20:35:35 +01:00
|
|
|
writebuf + 0);
|
2003-10-10 23:32:47 +02:00
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,
|
2007-10-30 20:35:35 +01:00
|
|
|
writebuf + 4);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
2008-01-30 04:18:39 +01:00
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && !tdep->soft_float)
|
|
|
|
return get_decimal_float_return_value (gdbarch, type, regcache, readbuf,
|
|
|
|
writebuf);
|
2007-09-06 22:21:16 +02:00
|
|
|
else if ((TYPE_CODE (type) == TYPE_CODE_INT
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_CHAR
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_BOOL
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_PTR
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_REF
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_ENUM)
|
|
|
|
&& TYPE_LENGTH (type) <= tdep->wordsize)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* Some sort of integer stored in r3. Since TYPE isn't
|
|
|
|
bigger than the register, sign extension isn't a problem
|
|
|
|
- just do everything unsigned. */
|
|
|
|
ULONGEST regval;
|
|
|
|
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
®val);
|
2003-11-10 23:47:31 +01:00
|
|
|
store_unsigned_integer (readbuf, TYPE_LENGTH (type), regval);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* Some sort of integer stored in r3. Use unpack_long since
|
|
|
|
that should handle any required sign extension. */
|
|
|
|
regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
|
2003-11-10 23:47:31 +01:00
|
|
|
unpack_long (type, writebuf));
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
if (TYPE_LENGTH (type) == 16
|
|
|
|
&& TYPE_CODE (type) == TYPE_CODE_ARRAY
|
2007-10-30 20:35:35 +01:00
|
|
|
&& TYPE_VECTOR (type)
|
|
|
|
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* Altivec places the return value in "v2". */
|
2003-11-10 23:47:31 +01:00
|
|
|
regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* Altivec places the return value in "v2". */
|
2003-11-10 23:47:31 +01:00
|
|
|
regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2, writebuf);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
2007-10-30 20:35:35 +01:00
|
|
|
if (TYPE_LENGTH (type) == 16
|
|
|
|
&& TYPE_CODE (type) == TYPE_CODE_ARRAY
|
|
|
|
&& TYPE_VECTOR (type)
|
|
|
|
&& tdep->vector_abi == POWERPC_VEC_GENERIC)
|
|
|
|
{
|
|
|
|
/* GCC -maltivec -mabi=no-altivec returns vectors in r3/r4/r5/r6.
|
|
|
|
GCC without AltiVec returns them in memory, but it warns about
|
|
|
|
ABI risks in that case; we don't try to support it. */
|
|
|
|
if (readbuf)
|
|
|
|
{
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
readbuf + 0);
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
|
|
|
|
readbuf + 4);
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 5,
|
|
|
|
readbuf + 8);
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 6,
|
|
|
|
readbuf + 12);
|
|
|
|
}
|
|
|
|
if (writebuf)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
writebuf + 0);
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,
|
|
|
|
writebuf + 4);
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 5,
|
|
|
|
writebuf + 8);
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 6,
|
|
|
|
writebuf + 12);
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
2003-10-10 23:32:47 +02:00
|
|
|
if (TYPE_LENGTH (type) == 8
|
|
|
|
&& TYPE_CODE (type) == TYPE_CODE_ARRAY
|
2007-10-30 20:35:35 +01:00
|
|
|
&& TYPE_VECTOR (type)
|
|
|
|
&& tdep->vector_abi == POWERPC_VEC_SPE)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* The e500 ABI places return values for the 64-bit DSP types
|
|
|
|
(__ev64_opaque__) in r3. However, in GDB-speak, ev3
|
|
|
|
corresponds to the entire r3 value for e500, whereas GDB's r3
|
|
|
|
only corresponds to the least significant 32-bits. So place
|
|
|
|
the 64-bit DSP type's value in ev3. */
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf)
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_ev0_regnum + 3, readbuf);
|
|
|
|
if (writebuf)
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_ev0_regnum + 3, writebuf);
|
2003-10-10 23:32:47 +02:00
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
if (broken_gcc && TYPE_LENGTH (type) <= 8)
|
|
|
|
{
|
2005-08-17 09:44:13 +02:00
|
|
|
/* GCC screwed up for structures or unions whose size is less
|
|
|
|
than or equal to 8 bytes.. Instead of left-aligning, it
|
|
|
|
right-aligns the data into the buffer formed by r3, r4. */
|
|
|
|
gdb_byte regvals[MAX_REGISTER_SIZE * 2];
|
|
|
|
int len = TYPE_LENGTH (type);
|
|
|
|
int offset = (2 * tdep->wordsize - len) % tdep->wordsize;
|
|
|
|
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2005-08-17 09:44:13 +02:00
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
regvals + 0 * tdep->wordsize);
|
|
|
|
if (len > tdep->wordsize)
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
|
|
|
|
regvals + 1 * tdep->wordsize);
|
|
|
|
memcpy (readbuf, regvals + offset, len);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2005-08-17 09:44:13 +02:00
|
|
|
memset (regvals, 0, sizeof regvals);
|
|
|
|
memcpy (regvals + offset, writebuf, len);
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
regvals + 0 * tdep->wordsize);
|
|
|
|
if (len > tdep->wordsize)
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,
|
|
|
|
regvals + 1 * tdep->wordsize);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
2005-08-17 09:44:13 +02:00
|
|
|
|
2003-10-10 23:32:47 +02:00
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
if (TYPE_LENGTH (type) <= 8)
|
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* This matches SVr4 PPC, it does not match GCC. */
|
|
|
|
/* The value is right-padded to 8 bytes and then loaded, as
|
|
|
|
two "words", into r3/r4. */
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte regvals[MAX_REGISTER_SIZE * 2];
|
2003-10-10 23:32:47 +02:00
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
regvals + 0 * tdep->wordsize);
|
|
|
|
if (TYPE_LENGTH (type) > tdep->wordsize)
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
|
|
|
|
regvals + 1 * tdep->wordsize);
|
2003-11-10 23:47:31 +01:00
|
|
|
memcpy (readbuf, regvals, TYPE_LENGTH (type));
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
|
|
|
/* This matches SVr4 PPC, it does not match GCC. */
|
|
|
|
/* The value is padded out to 8 bytes and then loaded, as
|
|
|
|
two "words" into r3/r4. */
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte regvals[MAX_REGISTER_SIZE * 2];
|
2003-10-10 23:32:47 +02:00
|
|
|
memset (regvals, 0, sizeof regvals);
|
2003-11-10 23:47:31 +01:00
|
|
|
memcpy (regvals, writebuf, TYPE_LENGTH (type));
|
2003-10-10 23:32:47 +02:00
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
regvals + 0 * tdep->wordsize);
|
|
|
|
if (TYPE_LENGTH (type) > tdep->wordsize)
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,
|
|
|
|
regvals + 1 * tdep->wordsize);
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_STRUCT_CONVENTION;
|
|
|
|
}
|
|
|
|
|
2003-11-07 21:44:51 +01:00
|
|
|
enum return_value_convention
|
2008-04-22 13:03:42 +02:00
|
|
|
ppc_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
|
|
|
|
struct type *valtype, struct regcache *regcache,
|
|
|
|
gdb_byte *readbuf, const gdb_byte *writebuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
return do_ppc_sysv_return_value (gdbarch, valtype, regcache, readbuf,
|
|
|
|
writebuf, 0);
|
2003-10-10 23:32:47 +02:00
|
|
|
}
|
|
|
|
|
2003-11-07 21:44:51 +01:00
|
|
|
enum return_value_convention
|
2003-11-10 23:47:31 +01:00
|
|
|
ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
|
2008-04-22 13:03:42 +02:00
|
|
|
struct type *func_type,
|
2003-11-10 23:47:31 +01:00
|
|
|
struct type *valtype,
|
|
|
|
struct regcache *regcache,
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte *readbuf, const gdb_byte *writebuf)
|
2003-10-10 23:32:47 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
return do_ppc_sysv_return_value (gdbarch, valtype, regcache, readbuf,
|
|
|
|
writebuf, 1);
|
2003-10-07 00:23:47 +02:00
|
|
|
}
|
2003-10-03 23:11:39 +02:00
|
|
|
|
2005-02-09 17:51:43 +01:00
|
|
|
/* The helper function for 64-bit SYSV push_dummy_call. Converts the
|
|
|
|
function's code address back into the function's descriptor
|
|
|
|
address.
|
|
|
|
|
|
|
|
Find a value for the TOC register. Every symbol should have both
|
|
|
|
".FN" and "FN" in the minimal symbol table. "FN" points at the
|
|
|
|
FN's descriptor, while ".FN" points at the entry point (which
|
|
|
|
matches FUNC_ADDR). Need to reverse from FUNC_ADDR back to the
|
|
|
|
FN's descriptor address (while at the same time being careful to
|
|
|
|
find "FN" in the same object file as ".FN"). */
|
|
|
|
|
|
|
|
static int
|
|
|
|
convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr)
|
|
|
|
{
|
|
|
|
struct obj_section *dot_fn_section;
|
|
|
|
struct minimal_symbol *dot_fn;
|
|
|
|
struct minimal_symbol *fn;
|
|
|
|
CORE_ADDR toc;
|
|
|
|
/* Find the minimal symbol that corresponds to CODE_ADDR (should
|
|
|
|
have a name of the form ".FN"). */
|
|
|
|
dot_fn = lookup_minimal_symbol_by_pc (code_addr);
|
|
|
|
if (dot_fn == NULL || SYMBOL_LINKAGE_NAME (dot_fn)[0] != '.')
|
|
|
|
return 0;
|
|
|
|
/* Get the section that contains CODE_ADDR. Need this for the
|
|
|
|
"objfile" that it contains. */
|
|
|
|
dot_fn_section = find_pc_section (code_addr);
|
|
|
|
if (dot_fn_section == NULL || dot_fn_section->objfile == NULL)
|
|
|
|
return 0;
|
|
|
|
/* Now find the corresponding "FN" (dropping ".") minimal symbol's
|
|
|
|
address. Only look for the minimal symbol in ".FN"'s object file
|
|
|
|
- avoids problems when two object files (i.e., shared libraries)
|
|
|
|
contain a minimal symbol with the same name. */
|
|
|
|
fn = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (dot_fn) + 1, NULL,
|
|
|
|
dot_fn_section->objfile);
|
|
|
|
if (fn == NULL)
|
|
|
|
return 0;
|
|
|
|
/* Found a descriptor. */
|
|
|
|
(*desc_addr) = SYMBOL_VALUE_ADDRESS (fn);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2003-10-10 20:29:13 +02:00
|
|
|
/* Pass the arguments in either registers, or in the stack. Using the
|
|
|
|
ppc 64 bit SysV ABI.
|
|
|
|
|
|
|
|
This implements a dumbed down version of the ABI. It always writes
|
|
|
|
values to memory, GPR and FPR, even when not necessary. Doing this
|
|
|
|
greatly simplifies the logic. */
|
|
|
|
|
|
|
|
CORE_ADDR
|
2004-06-07 04:02:55 +02:00
|
|
|
ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
2003-10-10 20:29:13 +02:00
|
|
|
struct regcache *regcache, CORE_ADDR bp_addr,
|
|
|
|
int nargs, struct value **args, CORE_ADDR sp,
|
|
|
|
int struct_return, CORE_ADDR struct_addr)
|
|
|
|
{
|
2004-06-07 04:02:55 +02:00
|
|
|
CORE_ADDR func_addr = find_function_addr (function, NULL);
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
2007-05-13 14:27:30 +02:00
|
|
|
ULONGEST back_chain;
|
2003-10-10 20:29:13 +02:00
|
|
|
/* See for-loop comment below. */
|
|
|
|
int write_pass;
|
|
|
|
/* Size of the Altivec's vector parameter region, the final value is
|
|
|
|
computed in the for-loop below. */
|
|
|
|
LONGEST vparam_size = 0;
|
|
|
|
/* Size of the general parameter region, the final value is computed
|
|
|
|
in the for-loop below. */
|
|
|
|
LONGEST gparam_size = 0;
|
|
|
|
/* Kevin writes ... I don't mind seeing tdep->wordsize used in the
|
|
|
|
calls to align_up(), align_down(), etc. because this makes it
|
|
|
|
easier to reuse this code (in a copy/paste sense) in the future,
|
|
|
|
but it is a 64-bit ABI and asserting that the wordsize is 8 bytes
|
|
|
|
at some point makes it easier to verify that this function is
|
|
|
|
correct without having to do a non-local analysis to figure out
|
|
|
|
the possible values of tdep->wordsize. */
|
|
|
|
gdb_assert (tdep->wordsize == 8);
|
|
|
|
|
2007-10-30 20:35:35 +01:00
|
|
|
/* This function exists to support a calling convention that
|
|
|
|
requires floating-point registers. It shouldn't be used on
|
|
|
|
processors that lack them. */
|
|
|
|
gdb_assert (ppc_floating_point_unit_p (gdbarch));
|
|
|
|
|
2007-05-13 14:27:30 +02:00
|
|
|
/* By this stage in the proceedings, SP has been decremented by "red
|
|
|
|
zone size" + "struct return size". Fetch the stack-pointer from
|
|
|
|
before this and use that as the BACK_CHAIN. */
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
|
2007-06-18 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (SP_REGNUM): Replace by gdbarch_sp_regnum.
* v850-tdep.c (v850_unwind_sp): Likewise.
* std-regs.c (value_of_builtin_frame_sp_reg): Likewise.
* stack.c (frame_info): Likewise.
* stabsread.c (define_symbol): Likewise.
* sh-tdep.c (sh_push_dummy_call_fpu, sh_push_dummy_call_nofpu)
(sh_dwarf2_frame_init_reg, sh_frame_cache, sh_frame_prev_register)
(sh_unwind_sp): Likewise.
* sh64-tdep.c (sh64_push_dummy_call, sh64_frame_cache)
(sh64_frame_prev_register, sh64_unwind_sp): Likewise.
* rs6000-tdep.c (rs6000_push_dummy_call, rs6000_unwind_dummy_id)
(rs6000_frame_cache): Likewise.
* rs6000-nat.c (store_register): Likewise.
* remote-mips.c (mips_wait): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* m32r-rom.c (m32r_supply_register): Likewise.
* frame.c (frame_sp_unwind): Likewise.
* mips-tdep.c (mips_insn16_frame_cache)
(mips_insn32_frame_cache): Likewise (comment).
* m68klinux-nat.c (supply_gregset): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* ia64-tdep.c (ia64_frame_prev_register): Likewise.
* i386-tdep.c (i386_get_longjmp_target): Likewise.
* dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise.
* cris-tdep.c (cris_regnums, cris_sigcontext_addr)
(cris_sigtramp_frame_unwind_cache, cris_push_dummy_call)
(cris_scan_prologue, crisv32_scan_prologue, cris_unwind_sp)
(cris_register_type, crisv32_register_type)
(cris_dwarf2_frame_init_reg): Likewise.
* arch-utils.c (legacy_virtual_frame_pointer): Likewise.
* amd64-tdep.c (amd64_frame_prev_register): Likewise.
* amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Likewise.
* libunwind-frame.c (libunwind_frame_cache): Likewise.
* gdbarch.sh (PC_REGNUM): Replace by gdbarch_pc_regnum.
* regcache.c (read_pc_pid, generic_target_write_pc): Likewise.
* xtensa-tdep.c (xtensa_register_type, xtensa_supply_gregset)
(xtensa_unwind_pc, xtensa_frame_cache, xtensa_frame_prev_register)
(xtensa_extract_return_value, xtensa_store_return_value): Likewise.
* v850-tdep.c (v850_unwind_pc): Likewise.
* stack.c (frame_info): Likewise.
* sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs)
(sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs)
(sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs)
(sh_dwarf2_frame_init_reg, sh_frame_prev_register, sh_unwind_pc)
(sh_dsp_show_regs): Likewise.
* shnbsd-tdep.c (shnbsd_supply_gregset)
(shnbsd_collect_gregset): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Likewise.
* sh64-tdep.c (sh64_compact_reg_base_num, sh64_show_media_regs)
(sh64_frame_prev_register, sh64_unwind_pc): Likewise.
* rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset)
(6000_register_reggroup_p, rs6000_unwind_pc)
(rs6000_frame_cache): Likewise.
* rs6000-nat.c (regmap, rs6000_fetch_inferior_registers)
(rs6000_store_inferior_registers): Likewise.
* remote-mips.c (mips_wait, mips_load): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcnbsd-nat.c (getregs_supplies, ppcnbsd_supply_pcb): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_ppc_registers)
(store_ppc_registers, fill_gregset): Likewise.
* mips-tdep.c (mips_stub_frame_cache, mips_gdbarch_init): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_supply_reg, mipsnbsd_fill_reg): Likewise.
* mipsnbsd-nat.c (getregs_supplies): Likewise.
* m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise.
* m68klinux-nat.c (supply_gregset): Likewise.
* irix5-nat.c (fill_gregset): Likewise.
* i386-tdep.c (i386_unwind_pc): Likewise.
* i386-linux-nat.c (i386_linux_resume): Likewise.
* frame.c (get_prev_frame_1): Likewise.
* dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise.
* dbug-rom.c (dbug_supply_register): Likewise.
* cris-tdep.c (cris_sigtramp_frame_unwind_cache, cris_scan_prologue)
(crisv32_scan_prologue, cris_unwind_pc, cris_register_size)
(cris_register_type, crisv32_register_type, crisv32_register_name)
(cris_dwarf2_frame_init_reg, find_step_target)
(cris_software_single_step, cris_supply_gregset)
(cris_regnums): Likewise.
* alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise.
* aix-thread.c (special_register_p, supply_sprs64, supply_sprs32)
(fill_sprs64, fill_sprs32, store_regs_user_thread): Likewise.
* mips-linux-tdep.c (mips_linux_write_pc): Likewise.
* gdbarch.sh (PS_REGNUM): Replace by gdbarch_ps_regnum.
* dbug-rom.c (dbug_supply_register): Likewise.
* xtensa-tdep.c (xtensa_supply_gregset, xtensa_frame_cache)
(xtensa_frame_prev_register, xtensa_push_dummy_call): Likewise.
* win32-nat.c (win32_resume): Likewise.
* std-regs.c (value_of_builtin_frame_ps_reg)
(value_of_builtin_frame_pc_reg): Likewise.
* m68k-tdep.c (m68k_register_type): Likewise.
* m68klinux-nat.c (supply_gregset): Likewise.
* gdbarch.sh (FP0_REGNUM): Replace by gdbarch_fp0_regnum.
* sh-tdep.c (sh_extract_return_value_fpu, sh_store_return_value_fpu)
(sh2e_show_regs, sh2a_show_regs, sh3e_show_regs, sh4_show_regs)
(sh_sh2a_register_type, sh_sh3e_register_type, sh_sh4_register_type)
(fv_reg_base_num, dr_reg_base_num): Likewise.
* sh64-tdep.c (sh64_fv_reg_base_num, sh64_dr_reg_base_num)
(sh64_fpp_reg_base_num, sh64_compact_reg_base_num, sh64_push_dummy_call)
(sh64_extract_return_value, sh64_store_return_value)
(sh64_show_media_regs, sh64_show_compact_regs, sh64_register_type)
(sh64_do_fp_register, sh64_media_print_registers_info): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers)
(invalidate_cache): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_supply_fpreg)
(mipsnbsd_fill_fpreg): Likewise.
* mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Likewise.
* mips-linux-tdep.c (mips_supply_fpregset, mips_fill_fpregset)
(mips64_supply_fpregset, mips64_fill_fpregset): Likewise.
* mips-linux-nat.c (mips64_linux_register_addr): Likewise.
* m68k-tdep.c (m68k_register_type, m68k_convert_register_p): Likewise.
* m68klinux-nat.c (getfpregs_supplies, supply_fpregset)
(fill_fpregset): Likewise.
* irix5-nat.c (supply_fpregset, fill_fpregset): Likewise.
* i386-tdep.h (struct_return): Likewise (comment).
* i386-nto-tdep.c (i386nto_register_area): Likewise.
* go32-nat.c (fetch_register, go32_fetch_registers, store_register)
(go32_store_registers): Likewise.
* alpha-tdep.c (alpha_next_pc): Likewise.
* alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise.
* alphabsd-nat.c (alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Likewise.
* core-regset.c (fetch_core_registers): Likewise.
* i386v4-nat.c (supply_fpregset, fill_fpregset): Likewise.
* gdbarch.c, gdbarch.h: Regenerate.
2007-06-18 19:45:26 +02:00
|
|
|
&back_chain);
|
2007-05-13 14:27:30 +02:00
|
|
|
|
2003-10-10 20:29:13 +02:00
|
|
|
/* Go through the argument list twice.
|
|
|
|
|
|
|
|
Pass 1: Compute the function call's stack space and register
|
|
|
|
requirements.
|
|
|
|
|
|
|
|
Pass 2: Replay the same computation but this time also write the
|
|
|
|
values out to the target. */
|
|
|
|
|
|
|
|
for (write_pass = 0; write_pass < 2; write_pass++)
|
|
|
|
{
|
|
|
|
int argno;
|
|
|
|
/* Next available floating point register for float and double
|
|
|
|
arguments. */
|
|
|
|
int freg = 1;
|
|
|
|
/* Next available general register for non-vector (but possibly
|
|
|
|
float) arguments. */
|
|
|
|
int greg = 3;
|
|
|
|
/* Next available vector register for vector arguments. */
|
|
|
|
int vreg = 2;
|
|
|
|
/* The address, at which the next general purpose parameter
|
|
|
|
(integer, struct, float, ...) should be saved. */
|
|
|
|
CORE_ADDR gparam;
|
|
|
|
/* Address, at which the next Altivec vector parameter should be
|
|
|
|
saved. */
|
|
|
|
CORE_ADDR vparam;
|
|
|
|
|
|
|
|
if (!write_pass)
|
|
|
|
{
|
|
|
|
/* During the first pass, GPARAM and VPARAM are more like
|
|
|
|
offsets (start address zero) than addresses. That way
|
2008-05-04 01:24:17 +02:00
|
|
|
they accumulate the total stack space each region
|
2003-10-10 20:29:13 +02:00
|
|
|
requires. */
|
|
|
|
gparam = 0;
|
|
|
|
vparam = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Decrement the stack pointer making space for the Altivec
|
|
|
|
and general on-stack parameters. Set vparam and gparam
|
|
|
|
to their corresponding regions. */
|
|
|
|
vparam = align_down (sp - vparam_size, 16);
|
|
|
|
gparam = align_down (vparam - gparam_size, 16);
|
|
|
|
/* Add in space for the TOC, link editor double word,
|
|
|
|
compiler double word, LR save area, CR save area. */
|
|
|
|
sp = align_down (gparam - 48, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the function is returning a `struct', then there is an
|
|
|
|
extra hidden parameter (which will be passed in r3)
|
|
|
|
containing the address of that struct.. In that case we
|
|
|
|
should advance one word and start from r4 register to copy
|
|
|
|
parameters. This also consumes one on-stack parameter slot. */
|
|
|
|
if (struct_return)
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
regcache_cooked_write_signed (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg,
|
|
|
|
struct_addr);
|
|
|
|
greg++;
|
|
|
|
gparam = align_up (gparam + tdep->wordsize, tdep->wordsize);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (argno = 0; argno < nargs; argno++)
|
|
|
|
{
|
|
|
|
struct value *arg = args[argno];
|
2004-11-12 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_TYPE, VALUE_NEXT, VALUE_OFFSET, VALUE_BITSIZE)
(VALUE_BITPOS): Delete.
(value_type, value_offset, value_bitsize, value_bitpos): Declare.
* value.c (value_type, value_offset, value_bitpos)
(value_bitsize): New functions. Update references.
* arm-tdep.c, gnu-v3-abi.c, hpacc-abi.c, gnu-v2-abi.c: Update.
* f-valprint.c, cp-valprint.c, c-valprint.c: Update.
* ada-valprint.c, typeprint.c, scm-valprint.c, scm-exp.c: Update.
* p-valprint.c, jv-valprint.c, jv-lang.c, varobj.c: Update.
* objc-lang.c, ada-lang.c, std-regs.c, stack.c: Update.
* infcall.c, linespec.c, printcmd.c, valarith.c: Update.
* valops.c, eval.c, findvar.c, breakpoint.c: Update.
* tracepoint.c, ax-gdb.c, mi/mi-main.c, cli/cli-dump.c:
* rs6000-tdep.c, ppc-sysv-tdep.c: Update.
2004-11-12 22:45:08 +01:00
|
|
|
struct type *type = check_typedef (value_type (arg));
|
2005-02-06 Andrew Cagney <cagney@gnu.org>
* value.c (value_contents, value_contents_writeable): New
functions.
* value.h (VALUE_CONTENTS): Delete macro.
(value_contents, value_contents_writeable): Declare.
* xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
* stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
* sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
* rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
* ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
* m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
* jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
* hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
* c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
* cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
* arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
* ada-valprint.c, ada-lang.c: Update.
2005-02-07 01:09:56 +01:00
|
|
|
const bfd_byte *val = value_contents (arg);
|
2008-02-01 16:04:18 +01:00
|
|
|
|
2003-10-10 20:29:13 +02:00
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) <= 8)
|
|
|
|
{
|
|
|
|
/* Floats and Doubles go in f1 .. f13. They also
|
|
|
|
consume a left aligned GREG,, and can end up in
|
|
|
|
memory. */
|
|
|
|
if (write_pass)
|
|
|
|
{
|
2008-02-01 16:04:18 +01:00
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
|
|
|
const gdb_byte *p;
|
|
|
|
|
|
|
|
/* Version 1.7 of the 64-bit PowerPC ELF ABI says:
|
|
|
|
|
|
|
|
"Single precision floating point values are mapped to
|
|
|
|
the first word in a single doubleword."
|
|
|
|
|
|
|
|
And version 1.9 says:
|
|
|
|
|
|
|
|
"Single precision floating point values are mapped to
|
|
|
|
the second word in a single doubleword."
|
|
|
|
|
|
|
|
GDB then writes single precision floating point values
|
|
|
|
at both words in a doubleword, to support both ABIs. */
|
|
|
|
if (TYPE_LENGTH (type) == 4)
|
|
|
|
{
|
|
|
|
memcpy (regval, val, 4);
|
|
|
|
memcpy (regval + 4, val, 4);
|
|
|
|
p = regval;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p = val;
|
|
|
|
|
|
|
|
/* Write value in the stack's parameter save area. */
|
|
|
|
write_memory (gparam, p, 8);
|
|
|
|
|
2007-10-30 20:35:35 +01:00
|
|
|
if (freg <= 13)
|
2003-10-10 20:29:13 +02:00
|
|
|
{
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
struct type *regtype
|
|
|
|
= register_type (gdbarch, tdep->ppc_fp0_regnum);
|
2008-02-01 16:04:18 +01:00
|
|
|
|
2003-10-10 20:29:13 +02:00
|
|
|
convert_typed_floating (val, type, regval, regtype);
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg,
|
2003-10-10 20:29:13 +02:00
|
|
|
regval);
|
|
|
|
}
|
|
|
|
if (greg <= 10)
|
2008-02-01 16:04:18 +01:00
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg,
|
|
|
|
regval);
|
2003-10-10 20:29:13 +02:00
|
|
|
}
|
2008-02-01 16:04:18 +01:00
|
|
|
|
2003-10-10 20:29:13 +02:00
|
|
|
freg++;
|
|
|
|
greg++;
|
2008-02-01 16:04:18 +01:00
|
|
|
/* Always consume parameter stack space. */
|
|
|
|
gparam = align_up (gparam + 8, tdep->wordsize);
|
2003-10-10 20:29:13 +02:00
|
|
|
}
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
else if (TYPE_CODE (type) == TYPE_CODE_FLT
|
|
|
|
&& TYPE_LENGTH (type) == 16
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
&& (gdbarch_long_double_format (gdbarch)
|
include:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.h (struct floatformat): Add split_half field.
(floatformat_ibm_long_double): New.
libiberty:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* floatformat.c (mant_bits_set): New.
(floatformat_to_double): Use it. Note no special handling of
split formats.
(floatformat_from_double): Note no special handing of split
formats.
(floatformat_ibm_long_double_is_valid,
floatformat_ibm_long_double): New.
(floatformat_ieee_single_big, floatformat_ieee_single_little,
floatformat_ieee_double_big, floatformat_ieee_double_little,
floatformat_ieee_double_littlebyte_bigword, floatformat_vax_f,
floatformat_vax_d, floatformat_vax_g, floatformat_i387_ext,
floatformat_m68881_ext, floatformat_i960_ext,
floatformat_m88110_ext, floatformat_m88110_harris_ext,
floatformat_arm_ext_big, floatformat_arm_ext_littlebyte_bigword,
floatformat_ia64_spill_big, floatformat_ia64_spill_little,
floatformat_ia64_quad_big, floatformat_ia64_quad_little): Update
for addition of split_half field.
gdb:
2007-11-07 Joseph Myers <joseph@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* gdbtypes.c (floatformats_ibm_long_double): New.
* gdbtypes.h (floatformats_ibm_long_double): Declare.
* ia64-tdep.c (floatformat_ia64_ext): Update for addition of
split_half field.
* mips-tdep.c (n32n64_floatformat_always_valid,
floatformat_n32n64_long_double_big, floatformats_n32n64_long):
Remove.
(mips_gdbarch_init): Use floatformats_ibm_long_double instead of
floatformats_n32n64_long.
* ppc-linux-tdep.c (ppc_linux_init_abi): Use 128-bit IBM long
double.
* doublest.c (convert_floatformat_to_doublest,
convert_doublest_to_floatformat): Handle split floating-point
formats.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle IBM long
double arguments.
(ppc64_sysv_abi_push_dummy_call): Likewise.
(do_ppc_sysv_return_value): Handle IBM long double return.
2007-11-08 01:08:48 +01:00
|
|
|
== floatformats_ibm_long_double))
|
|
|
|
{
|
|
|
|
/* IBM long double stored in two doublewords of the
|
|
|
|
parameter save area and corresponding registers. */
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
if (!tdep->soft_float && freg <= 13)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg,
|
|
|
|
val);
|
|
|
|
if (freg <= 12)
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg + 1,
|
|
|
|
val + 8);
|
|
|
|
}
|
|
|
|
if (greg <= 10)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg,
|
|
|
|
val);
|
|
|
|
if (greg <= 9)
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + greg + 1,
|
|
|
|
val + 8);
|
|
|
|
}
|
|
|
|
write_memory (gparam, val, TYPE_LENGTH (type));
|
|
|
|
}
|
|
|
|
freg += 2;
|
|
|
|
greg += 2;
|
|
|
|
gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize);
|
|
|
|
}
|
2008-01-30 04:18:39 +01:00
|
|
|
else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
|
|
|
|
&& TYPE_LENGTH (type) <= 8)
|
|
|
|
{
|
|
|
|
/* 32-bit and 64-bit decimal floats go in f1 .. f13. They can
|
|
|
|
end up in memory. */
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
|
|
|
const gdb_byte *p;
|
|
|
|
|
|
|
|
/* 32-bit decimal floats are right aligned in the
|
|
|
|
doubleword. */
|
|
|
|
if (TYPE_LENGTH (type) == 4)
|
|
|
|
{
|
|
|
|
memcpy (regval + 4, val, 4);
|
|
|
|
p = regval;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p = val;
|
|
|
|
|
|
|
|
/* Write value in the stack's parameter save area. */
|
|
|
|
write_memory (gparam, p, 8);
|
|
|
|
|
|
|
|
if (freg <= 13)
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg, p);
|
|
|
|
}
|
|
|
|
|
|
|
|
freg++;
|
|
|
|
greg++;
|
|
|
|
/* Always consume parameter stack space. */
|
|
|
|
gparam = align_up (gparam + 8, tdep->wordsize);
|
|
|
|
}
|
|
|
|
else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT &&
|
|
|
|
TYPE_LENGTH (type) == 16)
|
|
|
|
{
|
|
|
|
/* 128-bit decimal floats go in f2 .. f12, always in even/odd
|
|
|
|
pairs. They can end up in memory, using two doublewords. */
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
if (freg <= 12)
|
|
|
|
{
|
|
|
|
/* Make sure freg is even. */
|
|
|
|
freg += freg & 1;
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg, val);
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + freg + 1, val + 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
write_memory (gparam, val, TYPE_LENGTH (type));
|
|
|
|
}
|
|
|
|
|
|
|
|
freg += 2;
|
|
|
|
greg += 2;
|
|
|
|
gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize);
|
|
|
|
}
|
2003-10-10 20:29:13 +02:00
|
|
|
else if (TYPE_LENGTH (type) == 16 && TYPE_VECTOR (type)
|
|
|
|
&& TYPE_CODE (type) == TYPE_CODE_ARRAY
|
|
|
|
&& tdep->ppc_vr0_regnum >= 0)
|
|
|
|
{
|
|
|
|
/* In the Altivec ABI, vectors go in the vector
|
|
|
|
registers v2 .. v13, or when that runs out, a vector
|
|
|
|
annex which goes above all the normal parameters.
|
|
|
|
NOTE: cagney/2003-09-21: This is a guess based on the
|
|
|
|
PowerOpen Altivec ABI. */
|
|
|
|
if (vreg <= 13)
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_vr0_regnum + vreg, val);
|
|
|
|
vreg++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
write_memory (vparam, val, TYPE_LENGTH (type));
|
|
|
|
vparam = align_up (vparam + TYPE_LENGTH (type), 16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((TYPE_CODE (type) == TYPE_CODE_INT
|
2005-02-09 17:51:43 +01:00
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_ENUM
|
2008-05-03 01:24:44 +02:00
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_BOOL
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_CHAR
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_PTR
|
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_REF)
|
2003-10-10 20:29:13 +02:00
|
|
|
&& TYPE_LENGTH (type) <= 8)
|
|
|
|
{
|
2005-02-09 17:51:43 +01:00
|
|
|
/* Scalars and Pointers get sign[un]extended and go in
|
|
|
|
gpr3 .. gpr10. They can also end up in memory. */
|
2003-10-10 20:29:13 +02:00
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
/* Sign extend the value, then store it unsigned. */
|
|
|
|
ULONGEST word = unpack_long (type, val);
|
2005-02-09 17:51:43 +01:00
|
|
|
/* Convert any function code addresses into
|
|
|
|
descriptors. */
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR
|
2008-05-03 01:24:44 +02:00
|
|
|
|| TYPE_CODE (type) == TYPE_CODE_REF)
|
2005-02-09 17:51:43 +01:00
|
|
|
{
|
2008-05-03 01:24:44 +02:00
|
|
|
struct type *target_type;
|
|
|
|
target_type = check_typedef (TYPE_TARGET_TYPE (type));
|
|
|
|
|
|
|
|
if (TYPE_CODE (target_type) == TYPE_CODE_FUNC
|
|
|
|
|| TYPE_CODE (target_type) == TYPE_CODE_METHOD)
|
|
|
|
{
|
|
|
|
CORE_ADDR desc = word;
|
|
|
|
convert_code_addr_to_desc_addr (word, &desc);
|
|
|
|
word = desc;
|
|
|
|
}
|
2005-02-09 17:51:43 +01:00
|
|
|
}
|
2003-10-10 20:29:13 +02:00
|
|
|
if (greg <= 10)
|
|
|
|
regcache_cooked_write_unsigned (regcache,
|
|
|
|
tdep->ppc_gp0_regnum +
|
|
|
|
greg, word);
|
|
|
|
write_memory_unsigned_integer (gparam, tdep->wordsize,
|
|
|
|
word);
|
|
|
|
}
|
|
|
|
greg++;
|
|
|
|
gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int byte;
|
|
|
|
for (byte = 0; byte < TYPE_LENGTH (type);
|
|
|
|
byte += tdep->wordsize)
|
|
|
|
{
|
|
|
|
if (write_pass && greg <= 10)
|
|
|
|
{
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
2003-10-10 20:29:13 +02:00
|
|
|
int len = TYPE_LENGTH (type) - byte;
|
|
|
|
if (len > tdep->wordsize)
|
|
|
|
len = tdep->wordsize;
|
|
|
|
memset (regval, 0, sizeof regval);
|
2007-11-08 01:10:06 +01:00
|
|
|
/* The ABI (version 1.9) specifies that values
|
|
|
|
smaller than one doubleword are right-aligned
|
|
|
|
and those larger are left-aligned. GCC
|
|
|
|
versions before 3.4 implemented this
|
|
|
|
incorrectly; see
|
|
|
|
<http://gcc.gnu.org/gcc-3.4/powerpc-abi.html>. */
|
|
|
|
if (byte == 0)
|
2003-10-10 20:29:13 +02:00
|
|
|
memcpy (regval + tdep->wordsize - len,
|
|
|
|
val + byte, len);
|
2007-11-08 01:10:06 +01:00
|
|
|
else
|
|
|
|
memcpy (regval, val + byte, len);
|
2003-10-10 20:29:13 +02:00
|
|
|
regcache_cooked_write (regcache, greg, regval);
|
|
|
|
}
|
|
|
|
greg++;
|
|
|
|
}
|
|
|
|
if (write_pass)
|
2008-05-03 01:24:44 +02:00
|
|
|
{
|
|
|
|
/* WARNING: cagney/2003-09-21: Strictly speaking, this
|
|
|
|
isn't necessary, unfortunately, GCC appears to get
|
|
|
|
"struct convention" parameter passing wrong putting
|
|
|
|
odd sized structures in memory instead of in a
|
|
|
|
register. Work around this by always writing the
|
|
|
|
value to memory. Fortunately, doing this
|
|
|
|
simplifies the code. */
|
|
|
|
int len = TYPE_LENGTH (type);
|
|
|
|
if (len < tdep->wordsize)
|
|
|
|
write_memory (gparam + tdep->wordsize - len, val, len);
|
|
|
|
else
|
|
|
|
write_memory (gparam, val, len);
|
|
|
|
}
|
2007-11-08 01:10:06 +01:00
|
|
|
if (freg <= 13
|
|
|
|
&& TYPE_CODE (type) == TYPE_CODE_STRUCT
|
|
|
|
&& TYPE_NFIELDS (type) == 1
|
|
|
|
&& TYPE_LENGTH (type) <= 16)
|
|
|
|
{
|
|
|
|
/* The ABI (version 1.9) specifies that structs
|
|
|
|
containing a single floating-point value, at any
|
|
|
|
level of nesting of single-member structs, are
|
|
|
|
passed in floating-point registers. */
|
|
|
|
while (TYPE_CODE (type) == TYPE_CODE_STRUCT
|
|
|
|
&& TYPE_NFIELDS (type) == 1)
|
|
|
|
type = check_typedef (TYPE_FIELD_TYPE (type, 0));
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_FLT)
|
|
|
|
{
|
|
|
|
if (TYPE_LENGTH (type) <= 8)
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
|
|
|
struct type *regtype
|
|
|
|
= register_type (gdbarch,
|
|
|
|
tdep->ppc_fp0_regnum);
|
|
|
|
convert_typed_floating (val, type, regval,
|
|
|
|
regtype);
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
(tdep->ppc_fp0_regnum
|
|
|
|
+ freg),
|
|
|
|
regval);
|
|
|
|
}
|
|
|
|
freg++;
|
|
|
|
}
|
|
|
|
else if (TYPE_LENGTH (type) == 16
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
&& (gdbarch_long_double_format (gdbarch)
|
2007-11-08 01:10:06 +01:00
|
|
|
== floatformats_ibm_long_double))
|
|
|
|
{
|
|
|
|
if (write_pass)
|
|
|
|
{
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
(tdep->ppc_fp0_regnum
|
|
|
|
+ freg),
|
|
|
|
val);
|
|
|
|
if (freg <= 12)
|
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
(tdep->ppc_fp0_regnum
|
|
|
|
+ freg + 1),
|
|
|
|
val + 8);
|
|
|
|
}
|
|
|
|
freg += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-10-10 20:29:13 +02:00
|
|
|
/* Always consume parameter stack space. */
|
|
|
|
gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!write_pass)
|
|
|
|
{
|
|
|
|
/* Save the true region sizes ready for the second pass. */
|
|
|
|
vparam_size = vparam;
|
|
|
|
/* Make certain that the general parameter save area is at
|
|
|
|
least the minimum 8 registers (or doublewords) in size. */
|
|
|
|
if (greg < 8)
|
|
|
|
gparam_size = 8 * tdep->wordsize;
|
|
|
|
else
|
|
|
|
gparam_size = gparam;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update %sp. */
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
|
2003-10-10 20:29:13 +02:00
|
|
|
|
|
|
|
/* Write the backchain (it occupies WORDSIZED bytes). */
|
|
|
|
write_memory_signed_integer (sp, tdep->wordsize, back_chain);
|
|
|
|
|
|
|
|
/* Point the inferior function call's return address at the dummy's
|
|
|
|
breakpoint. */
|
|
|
|
regcache_cooked_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr);
|
|
|
|
|
2005-02-09 17:51:43 +01:00
|
|
|
/* Use the func_addr to find the descriptor, and use that to find
|
|
|
|
the TOC. */
|
2003-10-10 20:29:13 +02:00
|
|
|
{
|
2005-02-09 17:51:43 +01:00
|
|
|
CORE_ADDR desc_addr;
|
|
|
|
if (convert_code_addr_to_desc_addr (func_addr, &desc_addr))
|
2003-10-10 20:29:13 +02:00
|
|
|
{
|
2005-02-09 17:51:43 +01:00
|
|
|
/* The TOC is the second double word in the descriptor. */
|
|
|
|
CORE_ADDR toc =
|
|
|
|
read_memory_unsigned_integer (desc_addr + tdep->wordsize,
|
|
|
|
tdep->wordsize);
|
|
|
|
regcache_cooked_write_unsigned (regcache,
|
|
|
|
tdep->ppc_gp0_regnum + 2, toc);
|
2003-10-10 20:29:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
|
2003-10-03 23:11:39 +02:00
|
|
|
|
2007-10-30 20:35:35 +01:00
|
|
|
/* The 64 bit ABI return value convention.
|
2003-10-03 23:11:39 +02:00
|
|
|
|
|
|
|
Return non-zero if the return-value is stored in a register, return
|
|
|
|
0 if the return-value is instead stored on the stack (a.k.a.,
|
|
|
|
struct return convention).
|
|
|
|
|
2003-11-10 23:47:31 +01:00
|
|
|
For a return-value stored in a register: when WRITEBUF is non-NULL,
|
2003-10-03 23:11:39 +02:00
|
|
|
copy the buffer to the corresponding register return-value location
|
2003-11-10 23:47:31 +01:00
|
|
|
location; when READBUF is non-NULL, fill the buffer from the
|
2003-10-03 23:11:39 +02:00
|
|
|
corresponding register return-value location. */
|
2003-11-07 21:44:51 +01:00
|
|
|
enum return_value_convention
|
2008-04-22 13:03:42 +02:00
|
|
|
ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
|
|
|
|
struct type *valtype, struct regcache *regcache,
|
|
|
|
gdb_byte *readbuf, const gdb_byte *writebuf)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
2003-11-07 21:44:51 +01:00
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
2004-05-07 22:48:43 +02:00
|
|
|
|
|
|
|
/* This function exists to support a calling convention that
|
|
|
|
requires floating-point registers. It shouldn't be used on
|
|
|
|
processors that lack them. */
|
|
|
|
gdb_assert (ppc_floating_point_unit_p (gdbarch));
|
|
|
|
|
2003-10-03 23:11:39 +02:00
|
|
|
/* Floats and doubles in F1. */
|
2003-10-07 00:23:47 +02:00
|
|
|
if (TYPE_CODE (valtype) == TYPE_CODE_FLT && TYPE_LENGTH (valtype) <= 8)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf != NULL)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
convert_typed_floating (writebuf, valtype, regval, regtype);
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
|
2003-10-03 23:11:39 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf != NULL)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
|
2003-11-10 23:47:31 +01:00
|
|
|
convert_typed_floating (regval, regtype, readbuf, valtype);
|
2003-10-03 23:11:39 +02:00
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
2008-01-30 04:18:39 +01:00
|
|
|
if (TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT)
|
|
|
|
return get_decimal_float_return_value (gdbarch, valtype, regcache, readbuf,
|
|
|
|
writebuf);
|
2005-11-07 21:37:58 +01:00
|
|
|
/* Integers in r3. */
|
2005-02-09 17:51:43 +01:00
|
|
|
if ((TYPE_CODE (valtype) == TYPE_CODE_INT
|
2008-05-03 01:24:44 +02:00
|
|
|
|| TYPE_CODE (valtype) == TYPE_CODE_ENUM
|
|
|
|
|| TYPE_CODE (valtype) == TYPE_CODE_CHAR
|
|
|
|
|| TYPE_CODE (valtype) == TYPE_CODE_BOOL)
|
2005-02-09 17:51:43 +01:00
|
|
|
&& TYPE_LENGTH (valtype) <= 8)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf != NULL)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
|
|
|
/* Be careful to sign extend the value. */
|
|
|
|
regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
|
2003-11-10 23:47:31 +01:00
|
|
|
unpack_long (valtype, writebuf));
|
2003-10-03 23:11:39 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf != NULL)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
|
|
|
/* Extract the integer from r3. Since this is truncating the
|
|
|
|
value, there isn't a sign extension problem. */
|
|
|
|
ULONGEST regval;
|
|
|
|
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
®val);
|
2003-11-10 23:47:31 +01:00
|
|
|
store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), regval);
|
2003-10-03 23:11:39 +02:00
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
/* All pointers live in r3. */
|
2008-05-03 01:24:44 +02:00
|
|
|
if (TYPE_CODE (valtype) == TYPE_CODE_PTR
|
|
|
|
|| TYPE_CODE (valtype) == TYPE_CODE_REF)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
|
|
|
/* All pointers live in r3. */
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf != NULL)
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3, writebuf);
|
|
|
|
if (readbuf != NULL)
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, readbuf);
|
2003-10-03 23:11:39 +02:00
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
2005-11-07 21:37:58 +01:00
|
|
|
/* Array type has more than one use. */
|
|
|
|
if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
|
|
|
/* Small character arrays are returned, right justified, in r3. */
|
2005-11-07 21:37:58 +01:00
|
|
|
if (TYPE_LENGTH (valtype) <= 8
|
|
|
|
&& TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT
|
|
|
|
&& TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1)
|
|
|
|
{
|
|
|
|
int offset = (register_size (gdbarch, tdep->ppc_gp0_regnum + 3)
|
|
|
|
- TYPE_LENGTH (valtype));
|
|
|
|
if (writebuf != NULL)
|
|
|
|
regcache_cooked_write_part (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
offset, TYPE_LENGTH (valtype), writebuf);
|
|
|
|
if (readbuf != NULL)
|
|
|
|
regcache_cooked_read_part (regcache, tdep->ppc_gp0_regnum + 3,
|
|
|
|
offset, TYPE_LENGTH (valtype), readbuf);
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
/* A VMX vector is returned in v2. */
|
|
|
|
if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY
|
|
|
|
&& TYPE_VECTOR (valtype) && tdep->ppc_vr0_regnum >= 0)
|
|
|
|
{
|
|
|
|
if (readbuf)
|
|
|
|
regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf);
|
|
|
|
if (writebuf)
|
|
|
|
regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2, writebuf);
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
2003-10-03 23:11:39 +02:00
|
|
|
}
|
|
|
|
/* Big floating point values get stored in adjacent floating
|
2005-11-07 21:37:58 +01:00
|
|
|
point registers, starting with F1. */
|
2003-10-03 23:11:39 +02:00
|
|
|
if (TYPE_CODE (valtype) == TYPE_CODE_FLT
|
2003-10-07 00:23:47 +02:00
|
|
|
&& (TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 32))
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf || readbuf != NULL)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < TYPE_LENGTH (valtype) / 8; i++)
|
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf != NULL)
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i,
|
2003-11-10 23:47:31 +01:00
|
|
|
(const bfd_byte *) writebuf + i * 8);
|
|
|
|
if (readbuf != NULL)
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1 + i,
|
2003-11-10 23:47:31 +01:00
|
|
|
(bfd_byte *) readbuf + i * 8);
|
2003-10-03 23:11:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
/* Complex values get returned in f1:f2, need to convert. */
|
|
|
|
if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX
|
|
|
|
&& (TYPE_LENGTH (valtype) == 8 || TYPE_LENGTH (valtype) == 16))
|
|
|
|
{
|
|
|
|
if (regcache != NULL)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-25 05:12:13 +02:00
|
|
|
gdb_byte regval[MAX_REGISTER_SIZE];
|
2003-10-07 00:23:47 +02:00
|
|
|
struct type *regtype =
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 05:53:46 +01:00
|
|
|
register_type (gdbarch, tdep->ppc_fp0_regnum);
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf != NULL)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
convert_typed_floating ((const bfd_byte *) writebuf +
|
2003-10-07 00:23:47 +02:00
|
|
|
i * (TYPE_LENGTH (valtype) / 2),
|
2003-10-03 23:11:39 +02:00
|
|
|
valtype, regval, regtype);
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_write (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + 1 + i,
|
2003-10-07 00:23:47 +02:00
|
|
|
regval);
|
2003-10-03 23:11:39 +02:00
|
|
|
}
|
2003-11-10 23:47:31 +01:00
|
|
|
if (readbuf != NULL)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_read (regcache,
|
|
|
|
tdep->ppc_fp0_regnum + 1 + i,
|
|
|
|
regval);
|
2003-10-03 23:11:39 +02:00
|
|
|
convert_typed_floating (regval, regtype,
|
2003-11-10 23:47:31 +01:00
|
|
|
(bfd_byte *) readbuf +
|
2003-10-07 00:23:47 +02:00
|
|
|
i * (TYPE_LENGTH (valtype) / 2),
|
2003-10-03 23:11:39 +02:00
|
|
|
valtype);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
/* Big complex values get stored in f1:f4. */
|
2003-10-07 00:23:47 +02:00
|
|
|
if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX && TYPE_LENGTH (valtype) == 32)
|
2003-10-03 23:11:39 +02:00
|
|
|
{
|
|
|
|
if (regcache != NULL)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
2003-11-10 23:47:31 +01:00
|
|
|
if (writebuf != NULL)
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i,
|
2003-11-10 23:47:31 +01:00
|
|
|
(const bfd_byte *) writebuf + i * 8);
|
|
|
|
if (readbuf != NULL)
|
* config/rs6000/tm-rs6000.h (FP0_REGNUM): Document that this
should no longer be used in code specific to the RS6000 and its
derivatives.
* ppc-tdep.h (struct gdbarch_tdep): Add 'ppc_fp0_regnum' member.
* rs6000-tdep.c (rs6000_gdbarch_init): Initialize
tdep->ppc_fp0_regnum.
(ppc_supply_fpregset, ppc_collect_fpregset)
(rs6000_push_dummy_call, rs6000_extract_return_value)
(rs6000_dwarf2_stab_reg_to_regnum, rs6000_store_return_value)
(rs6000_frame_cache): Use tdep->ppc_fp0_regnum instead of
FP0_REGNUM.
* aix-thread.c (supply_fprs, fetch_regs_kernel_thread)
(fill_gprs64, fill_gprs32, fill_fprs, store_regs_kernel_thread):
Same.
* ppc-bdm.c (bdm_ppc_fetch_registers, bdm_ppc_fetch_registers,
bdm_ppc_store_registers): Same.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_register)
(store_register, fill_fpregset): Same.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache)
(ppc_linux_supply_fpregset): Same.
* ppcnbsd-nat.c (getfpregs_supplies): Same.
* ppcnbsd-tdep.c (ppcnbsd_supply_fpreg, ppcnbsd_fill_fpreg):
Same.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Same.
* rs6000-nat.c (regmap, fetch_inferior_registers)
(store_inferior_registers, fetch_core_registers): Same.
2004-05-05 03:46:55 +02:00
|
|
|
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1 + i,
|
2003-11-10 23:47:31 +01:00
|
|
|
(bfd_byte *) readbuf + i * 8);
|
2003-10-03 23:11:39 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_REGISTER_CONVENTION;
|
|
|
|
}
|
|
|
|
return RETURN_VALUE_STRUCT_CONVENTION;
|
|
|
|
}
|
|
|
|
|