/* Target-dependent code for the Motorola 68000 series.
- Copyright (C) 1990-2021 Free Software Foundation, Inc.
+ Copyright (C) 1990-2022 Free Software Foundation, Inc.
This file is part of GDB.
static struct type *
m68k_ps_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->m68k_ps_type)
{
static struct type *
m68881_ext_type (struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (!tdep->m68881_ext_type)
tdep->m68881_ext_type
static struct type *
m68k_register_type (struct gdbarch *gdbarch, int regnum)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->fpregs_present)
{
static const char *
m68k_register_name (struct gdbarch *gdbarch, int regnum)
{
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+
if (regnum < 0 || regnum >= ARRAY_SIZE (m68k_register_names))
internal_error (__FILE__, __LINE__,
_("m68k_register_name: illegal register number %d"),
regnum);
else if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM
- && gdbarch_tdep (gdbarch)->fpregs_present == 0)
+ && tdep->fpregs_present == 0)
return "";
else
return m68k_register_names[regnum];
m68k_convert_register_p (struct gdbarch *gdbarch,
int regnum, struct type *type)
{
- if (!gdbarch_tdep (gdbarch)->fpregs_present)
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+
+ if (!tdep->fpregs_present)
return 0;
return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7
/* We only support floating-point values. */
if (type->code () == TYPE_CODE_PTR && len == 4)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regcache->raw_read (tdep->pointer_result_regnum, valbuf);
}
else if (len <= 4)
{
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->float_return && type->code () == TYPE_CODE_FLT)
{
if (type->code () == TYPE_CODE_PTR && len == 4)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
regcache->raw_write (tdep->pointer_result_regnum, valbuf);
/* gdb historically also set D0 in the SVR4 case. */
if (tdep->pointer_result_regnum != M68K_D0_REGNUM)
const gdb_byte *valbuf)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep->float_return && type->code () == TYPE_CODE_FLT)
{
static int
m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum type_code code = type->code ();
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* Aggregates with a single member are always returned like their
sole element. */
|| code == TYPE_CODE_COMPLEX || code == TYPE_CODE_ARRAY)
&& !m68k_reg_struct_return_p (gdbarch, type))
/* GCC may return a `long double' in memory too. */
- || (!gdbarch_tdep (gdbarch)->float_return
+ || (!tdep->float_return
&& code == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 12))
{
if (readbuf)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
ULONGEST addr;
regcache_raw_read_unsigned (regcache, tdep->pointer_result_regnum,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[4];
int i;
static int
m68k_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int num)
{
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
+
if (num < 8)
/* d0..7 */
return (num - 0) + M68K_D0_REGNUM;
else if (num < 16)
/* a0..7 */
return (num - 8) + M68K_A0_REGNUM;
- else if (num < 24 && gdbarch_tdep (gdbarch)->fpregs_present)
+ else if (num < 24 && tdep->fpregs_present)
/* fp0..7 */
return (num - 16) + M68K_FP0_REGNUM;
else if (num == 25)
struct m68k_frame_cache *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (cache->locals >= 0)
{
{
op = read_memory_unsigned_integer (pc, 2, byte_order);
if (op == P_FMOVEMX_SP
- && gdbarch_tdep (gdbarch)->fpregs_present)
+ && tdep->fpregs_present)
{
/* fmovem.x REGS,-(%sp) */
op = read_memory_unsigned_integer (pc + 2, 2, byte_order);
gdb_byte *buf;
CORE_ADDR sp, jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame);
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (tdep->jb_pc < 0)
void
m68k_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
/* SVR4 uses a different calling convention. */
set_gdbarch_return_value (gdbarch, m68k_svr4_return_value);
static void
m68k_embedded_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
m68k_svr4_init_abi (info, gdbarch);
tdep->pointer_result_regnum = M68K_D0_REGNUM;
static struct gdbarch *
m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
- struct gdbarch_tdep *tdep = NULL;
struct gdbarch *gdbarch;
struct gdbarch_list *best_arch;
tdesc_arch_data_up tdesc_data;
best_arch != NULL;
best_arch = gdbarch_list_lookup_by_info (best_arch->next, &info))
{
- if (flavour != gdbarch_tdep (best_arch->gdbarch)->flavour)
+ m68k_gdbarch_tdep *tdep
+ = (m68k_gdbarch_tdep *) gdbarch_tdep (best_arch->gdbarch);
+
+ if (flavour != tdep->flavour)
continue;
- if (has_fp != gdbarch_tdep (best_arch->gdbarch)->fpregs_present)
+ if (has_fp != tdep->fpregs_present)
continue;
- if (float_return != gdbarch_tdep (best_arch->gdbarch)->float_return)
+ if (float_return != tdep->float_return)
continue;
break;
if (best_arch != NULL)
return best_arch->gdbarch;
- tdep = XCNEW (struct gdbarch_tdep);
+ m68k_gdbarch_tdep *tdep = new m68k_gdbarch_tdep;
gdbarch = gdbarch_alloc (&info, tdep);
tdep->fpregs_present = has_fp;
tdep->float_return = float_return;
static void
m68k_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ m68k_gdbarch_tdep *tdep = (m68k_gdbarch_tdep *) gdbarch_tdep (gdbarch);
if (tdep == NULL)
return;