/* Target-dependent code for SPARC.
- Copyright (C) 2003-2018 Free Software Foundation, Inc.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
This file is part of GDB.
sparc_fetch_wcookie (struct gdbarch *gdbarch)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct target_ops *ops = target_stack;
+ struct target_ops *ops = current_top_target ();
gdb_byte buf[8];
int len;
static CORE_ADDR
sparc32_store_arguments (struct regcache *regcache, int nargs,
struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+ function_call_return_method return_method,
+ CORE_ADDR struct_addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
{
int regnum = SPARC_O0_REGNUM + element;
- regcache_cooked_write (regcache, regnum, valbuf);
+ regcache->cooked_write (regnum, valbuf);
if (len > 4 && element < 5)
- regcache_cooked_write (regcache, regnum + 1, valbuf + 4);
+ regcache->cooked_write (regnum + 1, valbuf + 4);
}
/* Always store the argument in memory. */
gdb_assert (element == num_elements);
- if (struct_return)
+ if (return_method == return_method_struct)
{
gdb_byte buf[4];
sparc32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+ function_call_return_method return_method,
+ CORE_ADDR struct_addr)
{
- CORE_ADDR call_pc = (struct_return ? (bp_addr - 12) : (bp_addr - 8));
+ CORE_ADDR call_pc = (return_method == return_method_struct
+ ? (bp_addr - 12) : (bp_addr - 8));
/* Set return address. */
regcache_cooked_write_unsigned (regcache, SPARC_O7_REGNUM, call_pc);
/* Set up function arguments. */
- sp = sparc32_store_arguments (regcache, nargs, args, sp,
- struct_return, struct_addr);
+ sp = sparc32_store_arguments (regcache, nargs, args, sp, return_method,
+ struct_addr);
/* Allocate the 16-word window save area. */
sp -= 16 * 4;
return pc;
}
-static CORE_ADDR
-sparc_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- return frame_unwind_register_unsigned (this_frame, tdep->pc_regnum);
-}
-
/* Return PC of first real instruction of the function starting at
START_PC. */
{
/* Floating return values. */
memcpy (buf, valbuf, len);
- regcache_cooked_write (regcache, SPARC_F0_REGNUM, buf);
+ regcache->cooked_write (SPARC_F0_REGNUM, buf);
if (len > 4)
- regcache_cooked_write (regcache, SPARC_F1_REGNUM, buf + 4);
+ regcache->cooked_write (SPARC_F1_REGNUM, buf + 4);
if (len > 8)
{
- regcache_cooked_write (regcache, SPARC_F2_REGNUM, buf + 8);
- regcache_cooked_write (regcache, SPARC_F3_REGNUM, buf + 12);
+ regcache->cooked_write (SPARC_F2_REGNUM, buf + 8);
+ regcache->cooked_write (SPARC_F3_REGNUM, buf + 12);
}
if (len > 16)
{
- regcache_cooked_write (regcache, SPARC_F4_REGNUM, buf + 16);
- regcache_cooked_write (regcache, SPARC_F5_REGNUM, buf + 20);
- regcache_cooked_write (regcache, SPARC_F6_REGNUM, buf + 24);
- regcache_cooked_write (regcache, SPARC_F7_REGNUM, buf + 28);
+ regcache->cooked_write (SPARC_F4_REGNUM, buf + 16);
+ regcache->cooked_write (SPARC_F5_REGNUM, buf + 20);
+ regcache->cooked_write (SPARC_F6_REGNUM, buf + 24);
+ regcache->cooked_write (SPARC_F7_REGNUM, buf + 28);
}
}
else
{
gdb_assert (len == 8);
memcpy (buf, valbuf, 8);
- regcache_cooked_write (regcache, SPARC_O1_REGNUM, buf + 4);
+ regcache->cooked_write (SPARC_O1_REGNUM, buf + 4);
}
else
{
/* ??? Do we need to do any sign-extension here? */
memcpy (buf + 4 - len, valbuf, len);
}
- regcache_cooked_write (regcache, SPARC_O0_REGNUM, buf);
+ regcache->cooked_write (SPARC_O0_REGNUM, buf);
}
}
if (fused_p)
{
/* Fused compare-and-branch instructions are non-delayed,
- and do not have an annuling capability. So we need to
+ and do not have an annulling capability. So we need to
always set a breakpoint on both the NPC and the branch
target address. */
gdb_assert (offset != 0);
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- cb (".reg", tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
- cb (".reg2", tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
+ cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL,
+ cb_data);
+ cb (".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset,
+ NULL, cb_data);
}
\f
set_gdbarch_dummy_id (gdbarch, sparc_dummy_id);
- set_gdbarch_unwind_pc (gdbarch, sparc_unwind_pc);
-
frame_base_set_default (gdbarch, &sparc32_frame_base);
/* Hook in the DWARF CFI frame unwinder. */
i7 ^ wcookie);
}
- regcache_raw_supply (regcache, i, buf);
+ regcache->raw_supply (i, buf);
}
}
}
i7 ^ wcookie);
}
- regcache_raw_supply (regcache, i, buf);
+ regcache->raw_supply (i, buf);
}
}
}
{
if (regnum == -1 || regnum == SPARC_SP_REGNUM || regnum == i)
{
- regcache_raw_collect (regcache, i, buf);
+ regcache->raw_collect (i, buf);
/* Handle StackGhost. */
if (i == SPARC_I7_REGNUM)
{
if (regnum == -1 || regnum == SPARC_SP_REGNUM || regnum == i)
{
- regcache_raw_collect (regcache, i, buf);
+ regcache->raw_collect (i, buf);
/* Handle StackGhost. */
if (i == SPARC_I7_REGNUM)
int i;
if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, SPARC32_PSR_REGNUM,
- regs + gregmap->r_psr_offset);
+ regcache->raw_supply (SPARC32_PSR_REGNUM, regs + gregmap->r_psr_offset);
if (regnum == SPARC32_PC_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, SPARC32_PC_REGNUM,
- regs + gregmap->r_pc_offset);
+ regcache->raw_supply (SPARC32_PC_REGNUM, regs + gregmap->r_pc_offset);
if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, SPARC32_NPC_REGNUM,
- regs + gregmap->r_npc_offset);
+ regcache->raw_supply (SPARC32_NPC_REGNUM, regs + gregmap->r_npc_offset);
if (regnum == SPARC32_Y_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, SPARC32_Y_REGNUM,
- regs + gregmap->r_y_offset);
+ regcache->raw_supply (SPARC32_Y_REGNUM, regs + gregmap->r_y_offset);
if (regnum == SPARC_G0_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, SPARC_G0_REGNUM, &zero);
+ regcache->raw_supply (SPARC_G0_REGNUM, &zero);
if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
{
for (i = SPARC_G1_REGNUM; i <= SPARC_O7_REGNUM; i++)
{
if (regnum == i || regnum == -1)
- regcache_raw_supply (regcache, i, regs + offset);
+ regcache->raw_supply (i, regs + offset);
offset += 4;
}
}
for (i = SPARC_L0_REGNUM; i <= SPARC_I7_REGNUM; i++)
{
if (regnum == i || regnum == -1)
- regcache_raw_supply (regcache, i, regs + offset);
+ regcache->raw_supply (i, regs + offset);
offset += 4;
}
}
int i;
if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, SPARC32_PSR_REGNUM,
- regs + gregmap->r_psr_offset);
+ regcache->raw_collect (SPARC32_PSR_REGNUM, regs + gregmap->r_psr_offset);
if (regnum == SPARC32_PC_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, SPARC32_PC_REGNUM,
- regs + gregmap->r_pc_offset);
+ regcache->raw_collect (SPARC32_PC_REGNUM, regs + gregmap->r_pc_offset);
if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, SPARC32_NPC_REGNUM,
- regs + gregmap->r_npc_offset);
+ regcache->raw_collect (SPARC32_NPC_REGNUM, regs + gregmap->r_npc_offset);
if (regnum == SPARC32_Y_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, SPARC32_Y_REGNUM,
- regs + gregmap->r_y_offset);
+ regcache->raw_collect (SPARC32_Y_REGNUM, regs + gregmap->r_y_offset);
if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
{
for (i = SPARC_G1_REGNUM; i <= SPARC_O7_REGNUM; i++)
{
if (regnum == i || regnum == -1)
- regcache_raw_collect (regcache, i, regs + offset);
+ regcache->raw_collect (i, regs + offset);
offset += 4;
}
}
for (i = SPARC_L0_REGNUM; i <= SPARC_I7_REGNUM; i++)
{
if (regnum == i || regnum == -1)
- regcache_raw_collect (regcache, i, regs + offset);
+ regcache->raw_collect (i, regs + offset);
offset += 4;
}
}
for (i = 0; i < 32; i++)
{
if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
- regcache_raw_supply (regcache, SPARC_F0_REGNUM + i,
- regs + fpregmap->r_f0_offset + (i * 4));
+ regcache->raw_supply (SPARC_F0_REGNUM + i,
+ regs + fpregmap->r_f0_offset + (i * 4));
}
if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
- regcache_raw_supply (regcache, SPARC32_FSR_REGNUM,
- regs + fpregmap->r_fsr_offset);
+ regcache->raw_supply (SPARC32_FSR_REGNUM, regs + fpregmap->r_fsr_offset);
}
void
for (i = 0; i < 32; i++)
{
if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
- regcache_raw_collect (regcache, SPARC_F0_REGNUM + i,
- regs + fpregmap->r_f0_offset + (i * 4));
+ regcache->raw_collect (SPARC_F0_REGNUM + i,
+ regs + fpregmap->r_f0_offset + (i * 4));
}
if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
- regcache_raw_collect (regcache, SPARC32_FSR_REGNUM,
- regs + fpregmap->r_fsr_offset);
+ regcache->raw_collect (SPARC32_FSR_REGNUM,
+ regs + fpregmap->r_fsr_offset);
}
\f