#include "solib-svr4.h"
#include "ppc-tdep.h"
+#include "gdb_assert.h"
+
/* If the kernel has to deliver a signal, it pushes a sigcontext
structure on the stack and then calls the signal handler, passing
the address of the sigcontext in an argument register. Usually
return (regno >= tdep->ppc_vr0_regnum && regno <= tdep->ppc_vrsave_regnum);
}
+/* Use the architectures FP registers? */
+int
+ppc_floating_point_unit_p (struct gdbarch *gdbarch)
+{
+ const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch);
+ if (info->arch == bfd_arch_powerpc)
+ return (info->mach != bfd_mach_ppc_e500);
+ if (info->arch == bfd_arch_rs6000)
+ return 1;
+ return 0;
+}
+
/* Read a LEN-byte address from debugged memory address MEMADDR. */
static CORE_ADDR
still in the link register, otherwise walk the frames and retrieve the
saved %pc value in the previous frame. */
- addr = get_pc_function_start (get_frame_pc (frame));
+ addr = get_frame_func (frame);
(void) skip_prologue (addr, get_frame_pc (frame), &fdata);
wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
write_register (SP_REGNUM, sp);
/* set back chain properly */
- store_address (tmp_buffer, 4, saved_sp);
+ store_unsigned_integer (tmp_buffer, 4, saved_sp);
write_memory (sp, tmp_buffer, 4);
target_store_registers (-1);
/* Check for bigtoc fixup code. */
msymbol = lookup_minimal_symbol_by_pc (pc);
- if (msymbol && rs6000_in_solib_return_trampoline (pc, SYMBOL_NAME (msymbol)))
+ if (msymbol && rs6000_in_solib_return_trampoline (pc, DEPRECATED_SYMBOL_NAME (msymbol)))
{
/* Double-check that the third instruction from PC is relative "b". */
op = read_memory_integer (pc + 8, 4);
&& !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
return 0;
- func_start = get_pc_function_start (get_frame_pc (fi));
+ func_start = get_frame_func (fi);
/* If we failed to find the start of the function, it is a mistake
to inspect the instructions. */
return deprecated_read_register_dummy (get_frame_pc (fi),
get_frame_base (fi), PC_REGNUM);
- func_start = get_pc_function_start (get_frame_pc (fi));
+ func_start = get_frame_func (fi);
/* If we failed to find the start of the function, it is a mistake
to inspect the instructions. */
return lr;
}
else
- return read_memory_addr (FRAME_CHAIN (fi) + tdep->lr_frame_offset,
+ return read_memory_addr (DEPRECATED_FRAME_CHAIN (fi)
+ + tdep->lr_frame_offset,
wordsize);
}
if (fdata.lr_offset == 0)
return read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum);
- return read_memory_addr (FRAME_CHAIN (fi) + fdata.lr_offset, wordsize);
+ return read_memory_addr (DEPRECATED_FRAME_CHAIN (fi) + fdata.lr_offset,
+ wordsize);
}
/* If saved registers of frame FI are not known yet, read and cache them.
if (fdatap == NULL)
{
fdatap = &work_fdata;
- (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
- get_frame_pc (fi), fdatap);
+ (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), fdatap);
}
frame_saved_regs_zalloc (fi);
->frame pointed to the outer-most address of the frame. In the
mean time, the address of the prev frame is used as the base
address of this frame. */
- frame_addr = FRAME_CHAIN (fi);
+ frame_addr = DEPRECATED_FRAME_CHAIN (fi);
/* if != -1, fdatap->saved_fpr is the smallest number of saved_fpr.
All fpr's from saved_fpr to fp31 are saved. */
CORE_ADDR gpr_addr = frame_addr + fdatap->gpr_offset;
for (i = fdatap->saved_gpr; i < 32; i++)
{
- get_frame_saved_regs (fi)[i] = gpr_addr;
+ get_frame_saved_regs (fi)[tdep->ppc_gp0_regnum + i] = gpr_addr;
gpr_addr += wordsize;
}
}
/* Find out if this function is using an alloca register. */
- (void) skip_prologue (get_pc_function_start (get_frame_pc (fi)),
- get_frame_pc (fi), &fdata);
+ (void) skip_prologue (get_frame_func (fi), get_frame_pc (fi), &fdata);
/* If saved registers of this frame are not known yet, read and
cache them. */
/* There is an alloca register, use its value, in the current frame,
as the initial stack pointer. */
{
- char *tmpbuf = alloca (MAX_REGISTER_RAW_SIZE);
+ char tmpbuf[MAX_REGISTER_SIZE];
if (frame_register_read (fi, fdata.alloca_reg, tmpbuf))
{
get_frame_extra_info (fi)->initial_sp
/* Describe the pointer in each stack frame to the previous stack frame
(its caller). */
-/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer. */
+/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces
+ the frame's chain-pointer. */
/* In the case of the RS/6000, the frame's nominal address
is the address of a 4-byte word containing the calling frame's address. */
{
if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n))
{
- double val = extract_floating (from, REGISTER_RAW_SIZE (n));
- store_floating (to, TYPE_LENGTH (type), val);
+ double val = deprecated_extract_floating (from, REGISTER_RAW_SIZE (n));
+ deprecated_store_floating (to, TYPE_LENGTH (type), val);
}
else
memcpy (to, from, REGISTER_RAW_SIZE (n));
{
if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n))
{
- double val = extract_floating (from, TYPE_LENGTH (type));
- store_floating (to, REGISTER_RAW_SIZE (n), val);
+ double val = deprecated_extract_floating (from, TYPE_LENGTH (type));
+ deprecated_store_floating (to, REGISTER_RAW_SIZE (n), val);
}
else
memcpy (to, from, REGISTER_RAW_SIZE (n));
{
int base_regnum;
int offset = 0;
- char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
+ char temp_buffer[MAX_REGISTER_SIZE];
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->ppc_gp0_regnum
{
int base_regnum;
int offset = 0;
- char *temp_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
+ char temp_buffer[MAX_REGISTER_SIZE];
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (reg_nr >= tdep->ppc_gp0_regnum
/* FIXME: cagney/2002-09-26: PR gdb/724: When making an inferior
function call GDB knows the address of the struct return value
and hence, should not need to call this function. Unfortunately,
- the current hand_function_call() code only saves the most recent
- struct address leading to occasional calls. The code should
- instead maintain a stack of such addresses (in the dummy frame
- object). */
+ the current call_function_by_hand() code only saves the most
+ recent struct address leading to occasional calls. The code
+ should instead maintain a stack of such addresses (in the dummy
+ frame object). */
/* NOTE: cagney/2002-09-26: Return 0 which indicates that we've
really got no idea where the return value is being stored. While
r3, on function entry, contained the address it will have since
/* 0 */ P(r0), P(r1), P(r2), P(r3), P(r4), P(r5), P(r6), P(r7), \
/* 8 */ P(r8), P(r9), P(r10),P(r11),P(r12),P(r13),P(r14),P(r15), \
/* 16 */ P(r16),P(r17),P(r18),P(r19),P(r20),P(r21),P(r22),P(r23), \
- /* 24 */ P(r24),P(r25),P(r26),P(r27),P(r28),P(r29),P(r30),P(r31), \
+ /* 24 */ P(r24),P(r25),P(r26),P(r27),P(r28),P(r29),P(r30),P(r31)
/* IBM POWER (pre-PowerPC) architecture, user-level view. We only cover
user-level SPR's. */
PPC_UISA_NOFP_SPRS,
/* 7...38 */
PPC_EV_REGS,
+ R8(acc), R(spefscr),
+ /* NOTE: Add new registers here the end of the raw register
+ list and just before the first pseudo register. */
/* 39...70 */
PPC_GPRS_PSEUDO_REGS
};
else
{
arch = bfd_arch_powerpc;
- mach = 0;
- bfd_default_set_arch_mach (&abfd, arch, mach);
+ bfd_default_set_arch_mach (&abfd, arch, 0);
info.bfd_arch_info = bfd_get_arch_info (&abfd);
+ mach = info.bfd_arch_info->mach;
}
tdep = xmalloc (sizeof (struct gdbarch_tdep));
tdep->wordsize = wordsize;
set_gdbarch_pc_regnum (gdbarch, 64);
set_gdbarch_sp_regnum (gdbarch, 1);
- set_gdbarch_fp_regnum (gdbarch, 1);
+ set_gdbarch_deprecated_fp_regnum (gdbarch, 1);
set_gdbarch_deprecated_extract_return_value (gdbarch,
rs6000_extract_return_value);
set_gdbarch_deprecated_store_return_value (gdbarch, rs6000_store_return_value);
tdep->ppc_ev31_regnum = -1;
break;
case bfd_mach_ppc_e500:
- tdep->ppc_gp0_regnum = 39;
- tdep->ppc_gplast_regnum = 70;
+ tdep->ppc_gp0_regnum = 41;
+ tdep->ppc_gplast_regnum = tdep->ppc_gp0_regnum + 32 - 1;
tdep->ppc_toc_regnum = -1;
tdep->ppc_ps_regnum = 1;
tdep->ppc_cr_regnum = 2;
tdep->ppc_ev0_regnum = 7;
tdep->ppc_ev31_regnum = 38;
set_gdbarch_pc_regnum (gdbarch, 0);
- set_gdbarch_sp_regnum (gdbarch, 40);
- set_gdbarch_fp_regnum (gdbarch, 40);
+ set_gdbarch_sp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1);
+ set_gdbarch_deprecated_fp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1);
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, e500_dwarf2_reg_to_regnum);
set_gdbarch_pseudo_register_read (gdbarch, e500_pseudo_register_read);
set_gdbarch_pseudo_register_write (gdbarch, e500_pseudo_register_write);
break;
}
+ /* Sanity check on registers. */
+ gdb_assert (strcmp (tdep->regs[tdep->ppc_gp0_regnum].name, "r0") == 0);
+
/* Set lr_frame_offset. */
if (wordsize == 8)
tdep->lr_frame_offset = 16;
set_gdbarch_read_pc (gdbarch, generic_target_read_pc);
set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
- set_gdbarch_read_fp (gdbarch, generic_target_read_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
- set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp);
set_gdbarch_num_regs (gdbarch, v->nregs);
set_gdbarch_num_pseudo_regs (gdbarch, v->npregs);
set_gdbarch_register_name (gdbarch, rs6000_register_name);
- set_gdbarch_register_size (gdbarch, wordsize);
+ set_gdbarch_deprecated_register_size (gdbarch, wordsize);
set_gdbarch_register_bytes (gdbarch, off);
set_gdbarch_register_byte (gdbarch, rs6000_register_byte);
set_gdbarch_register_raw_size (gdbarch, rs6000_register_raw_size);
- set_gdbarch_max_register_raw_size (gdbarch, 16);
+ set_gdbarch_deprecated_max_register_raw_size (gdbarch, 16);
set_gdbarch_register_virtual_size (gdbarch, generic_register_size);
- set_gdbarch_max_register_virtual_size (gdbarch, 16);
+ set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 16);
set_gdbarch_register_virtual_type (gdbarch, rs6000_register_virtual_type);
set_gdbarch_ptr_bit (gdbarch, wordsize * TARGET_CHAR_BIT);
set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+ if (sysv_abi)
+ set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
+ else
+ set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_char_signed (gdbarch, 0);
- set_gdbarch_call_dummy_length (gdbarch, 0);
- set_gdbarch_call_dummy_address (gdbarch, entry_point_address);
- set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
- set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 0);
- set_gdbarch_call_dummy_start_offset (gdbarch, 0);
- set_gdbarch_call_dummy_p (gdbarch, 1);
- set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
- set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
+ set_gdbarch_deprecated_fix_call_dummy (gdbarch, rs6000_fix_call_dummy);
set_gdbarch_frame_align (gdbarch, rs6000_frame_align);
- set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
- set_gdbarch_push_return_address (gdbarch, ppc_push_return_address);
+ set_gdbarch_deprecated_push_return_address (gdbarch, ppc_push_return_address);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_register_convertible (gdbarch, rs6000_register_convertible);
64-bit code. At some point in the future, this matter needs to be
revisited. */
if (sysv_abi && wordsize == 4)
- set_gdbarch_push_arguments (gdbarch, ppc_sysv_abi_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, ppc_sysv_abi_push_arguments);
else
- set_gdbarch_push_arguments (gdbarch, rs6000_push_arguments);
+ set_gdbarch_deprecated_push_arguments (gdbarch, rs6000_push_arguments);
- set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return);
+ set_gdbarch_deprecated_store_struct_return (gdbarch, rs6000_store_struct_return);
set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
- set_gdbarch_pop_frame (gdbarch, rs6000_pop_frame);
+ set_gdbarch_deprecated_pop_frame (gdbarch, rs6000_pop_frame);
set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_use_struct_convention (gdbarch,
generic_use_struct_convention);
- set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
-
set_gdbarch_frameless_function_invocation (gdbarch,
rs6000_frameless_function_invocation);
- set_gdbarch_frame_chain (gdbarch, rs6000_frame_chain);
- set_gdbarch_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
+ set_gdbarch_deprecated_frame_chain (gdbarch, rs6000_frame_chain);
+ set_gdbarch_deprecated_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
- set_gdbarch_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
- set_gdbarch_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
+ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
+ set_gdbarch_deprecated_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
if (!sysv_abi)
{
}
set_gdbarch_frame_args_address (gdbarch, rs6000_frame_args_address);
set_gdbarch_frame_locals_address (gdbarch, rs6000_frame_args_address);
- set_gdbarch_saved_pc_after_call (gdbarch, rs6000_saved_pc_after_call);
+ set_gdbarch_deprecated_saved_pc_after_call (gdbarch, rs6000_saved_pc_after_call);
/* We can't tell how many args there are
now that the C compiler delays popping them. */