2004-04-29 Andrew Cagney <cagney@redhat.com>

* mips-tdep.c (mips_abi_regsize): Replace tdep parameter with
	gdbarch, use mips_abi, update callers.
	(mips_stack_argsize): Replace tdep parameter with gdbarch, use
	mips_abi_regsize, update callers.
	(struct gdbarch_tdep): Delete mips_default_stack_argsize and
	mips_default_abi_regsize.
	(mips_gdbarch_init): Do not set mips_default_stack_argsize and
	mips_default_abi_regsize.
This commit is contained in:
Andrew Cagney 2004-04-29 19:42:01 +00:00
parent 1b13c4f6d5
commit 13326b4e26
2 changed files with 111 additions and 100 deletions

View File

@ -1,3 +1,14 @@
2004-04-29 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (mips_abi_regsize): Replace tdep parameter with
gdbarch, use mips_abi, update callers.
(mips_stack_argsize): Replace tdep parameter with gdbarch, use
mips_abi_regsize, update callers.
(struct gdbarch_tdep): Delete mips_default_stack_argsize and
mips_default_abi_regsize.
(mips_gdbarch_init): Do not set mips_default_stack_argsize and
mips_default_abi_regsize.
2004-04-29 Andrew Cagney <cagney@redhat.com>
* mips-tdep.c (mips_abi_regsize): Rename mips_saved_regsize.

View File

@ -137,9 +137,7 @@ struct gdbarch_tdep
enum mips_fpu_type mips_fpu_type;
int mips_last_arg_regnum;
int mips_last_fp_arg_regnum;
int mips_default_abi_regsize;
int mips_fp_register_double;
int mips_default_stack_argsize;
int default_mask_address_p;
/* Is the target using 64-bit raw integer registers but only
storing a left-aligned 32-bit value in each? */
@ -244,10 +242,24 @@ mips_isa_regsize (struct gdbarch *gdbarch)
static const char *mips_abi_regsize_string = size_auto;
static unsigned int
mips_abi_regsize (struct gdbarch_tdep *tdep)
mips_abi_regsize (struct gdbarch *gdbarch)
{
if (mips_abi_regsize_string == size_auto)
return tdep->mips_default_abi_regsize;
switch (mips_abi (gdbarch))
{
case MIPS_ABI_EABI32:
case MIPS_ABI_O32:
return 4;
case MIPS_ABI_N32:
case MIPS_ABI_N64:
case MIPS_ABI_O64:
case MIPS_ABI_EABI64:
return 8;
case MIPS_ABI_UNKNOWN:
case MIPS_ABI_LAST:
default:
internal_error (__FILE__, __LINE__, "bad switch");
}
else if (mips_abi_regsize_string == size_64)
return 8;
else /* if (mips_abi_regsize_string == size_32) */
@ -375,10 +387,10 @@ mips2_fp_compat (void)
static const char *mips_stack_argsize_string = size_auto;
static unsigned int
mips_stack_argsize (struct gdbarch_tdep *tdep)
mips_stack_argsize (struct gdbarch *gdbarch)
{
if (mips_stack_argsize_string == size_auto)
return tdep->mips_default_stack_argsize;
return mips_abi_regsize (gdbarch);
else if (mips_stack_argsize_string == size_64)
return 8;
else /* if (mips_stack_argsize_string == size_32) */
@ -1574,7 +1586,7 @@ mips_mdebug_frame_cache (struct frame_info *next_frame, void **this_cache)
if (gen_mask & 0x80000000)
{
cache->saved_regs[NUM_REGS + ireg].addr = reg_position;
reg_position -= mips_abi_regsize (tdep);
reg_position -= mips_abi_regsize (gdbarch);
}
}
@ -1595,7 +1607,7 @@ mips_mdebug_frame_cache (struct frame_info *next_frame, void **this_cache)
CORE_ADDR reg_position = (cache->base
+ PROC_REG_OFFSET (proc_desc));
if (inst & 0x20)
reg_position -= mips_abi_regsize (tdep);
reg_position -= mips_abi_regsize (gdbarch);
/* Check if the s0 and s1 registers were pushed on the
stack. */
@ -1604,7 +1616,7 @@ mips_mdebug_frame_cache (struct frame_info *next_frame, void **this_cache)
for (reg = 16; reg < sreg_count + 16; reg++)
{
cache->saved_regs[NUM_REGS + reg].addr = reg_position;
reg_position -= mips_abi_regsize (tdep);
reg_position -= mips_abi_regsize (gdbarch);
}
}
}
@ -1620,7 +1632,7 @@ mips_mdebug_frame_cache (struct frame_info *next_frame, void **this_cache)
for (ireg = MIPS_NUMREGS - 1; float_mask; --ireg, float_mask <<= 1)
if (float_mask & 0x80000000)
{
if (mips_abi_regsize (tdep) == 4
if (mips_abi_regsize (gdbarch) == 4
&& TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{
/* On a big endian 32 bit ABI, floating point registers
@ -1647,15 +1659,15 @@ mips_mdebug_frame_cache (struct frame_info *next_frame, void **this_cache)
loop). */
if ((ireg & 1))
cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
.addr = reg_position - mips_abi_regsize (tdep);
.addr = reg_position - mips_abi_regsize (gdbarch);
else
cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
.addr = reg_position + mips_abi_regsize (tdep);
.addr = reg_position + mips_abi_regsize (gdbarch);
}
else
cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->fp0 + ireg]
.addr = reg_position;
reg_position -= mips_abi_regsize (tdep);
reg_position -= mips_abi_regsize (gdbarch);
}
cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc]
@ -2100,7 +2112,7 @@ mips16_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
{
PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
set_reg_offset (temp_saved_regs, reg, sp + offset);
offset += mips_abi_regsize (tdep);
offset += mips_abi_regsize (current_gdbarch);
}
/* Check if the ra register was pushed on the stack. */
@ -2109,7 +2121,7 @@ mips16_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
{
PROC_REG_MASK (&temp_proc_desc) |= 1 << RA_REGNUM;
set_reg_offset (temp_saved_regs, RA_REGNUM, sp + offset);
offset -= mips_abi_regsize (tdep);
offset -= mips_abi_regsize (current_gdbarch);
}
/* Check if the s0 and s1 registers were pushed on the stack. */
@ -2117,7 +2129,7 @@ mips16_heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
{
PROC_REG_MASK (&temp_proc_desc) |= 1 << reg;
set_reg_offset (temp_saved_regs, reg, sp + offset);
offset -= mips_abi_regsize (tdep);
offset -= mips_abi_regsize (current_gdbarch);
}
}
}
@ -2675,22 +2687,22 @@ return_value_location (struct type *valtype,
lo->reg = regnum + 0;
hi->reg = regnum + 1;
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& len < mips_abi_regsize (tdep))
&& len < mips_abi_regsize (current_gdbarch))
{
/* "un-left-justify" the value in the low register */
lo->reg_offset = mips_abi_regsize (tdep) - len;
lo->reg_offset = mips_abi_regsize (current_gdbarch) - len;
lo->len = len;
hi->reg_offset = 0;
hi->len = 0;
}
else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG && len > mips_abi_regsize (tdep) /* odd-size structs */
&& len < mips_abi_regsize (tdep) * 2
else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG && len > mips_abi_regsize (current_gdbarch) /* odd-size structs */
&& len < mips_abi_regsize (current_gdbarch) * 2
&& (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
TYPE_CODE (valtype) == TYPE_CODE_UNION))
{
/* "un-left-justify" the value spread across two registers. */
lo->reg_offset = 2 * mips_abi_regsize (tdep) - len;
lo->len = mips_abi_regsize (tdep) - lo->reg_offset;
lo->reg_offset = 2 * mips_abi_regsize (current_gdbarch) - len;
lo->len = mips_abi_regsize (current_gdbarch) - lo->reg_offset;
hi->reg_offset = 0;
hi->len = len - lo->len;
}
@ -2699,10 +2711,10 @@ return_value_location (struct type *valtype,
/* Only perform a partial copy of the second register. */
lo->reg_offset = 0;
hi->reg_offset = 0;
if (len > mips_abi_regsize (tdep))
if (len > mips_abi_regsize (current_gdbarch))
{
lo->len = mips_abi_regsize (tdep);
hi->len = len - mips_abi_regsize (tdep);
lo->len = mips_abi_regsize (current_gdbarch);
hi->len = len - mips_abi_regsize (current_gdbarch);
}
else
{
@ -2712,7 +2724,7 @@ return_value_location (struct type *valtype,
}
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& register_size (current_gdbarch, regnum) == 8
&& mips_abi_regsize (tdep) == 4)
&& mips_abi_regsize (current_gdbarch) == 4)
{
/* Account for the fact that only the least-signficant part
of the register is being used */
@ -2730,7 +2742,7 @@ static int
mips_eabi_use_struct_convention (int gcc_p, struct type *type)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
return (TYPE_LENGTH (type) > 2 * mips_abi_regsize (tdep));
return (TYPE_LENGTH (type) > 2 * mips_abi_regsize (current_gdbarch));
}
/* Should call_function pass struct by reference?
@ -2745,7 +2757,7 @@ mips_eabi_reg_struct_has_addr (int gcc_p, struct type *type)
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
return (len > mips_abi_regsize (tdep));
return (len > mips_abi_regsize (current_gdbarch));
return 0;
}
@ -2785,7 +2797,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++)
len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
mips_stack_argsize (tdep));
mips_stack_argsize (gdbarch));
sp -= align_up (len, 16);
if (mips_debug)
@ -2826,13 +2838,13 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
/* The EABI passes structures that do not fit in a register by
reference. */
if (len > mips_abi_regsize (tdep)
if (len > mips_abi_regsize (gdbarch)
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
{
store_unsigned_integer (valbuf, mips_abi_regsize (tdep),
store_unsigned_integer (valbuf, mips_abi_regsize (gdbarch),
VALUE_ADDRESS (arg));
typecode = TYPE_CODE_PTR;
len = mips_abi_regsize (tdep);
len = mips_abi_regsize (gdbarch);
val = valbuf;
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " push");
@ -2908,8 +2920,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
in registers where gcc sometimes puts them on the stack.
For maximum compatibility, we will put them in both
places. */
int odd_sized_struct = ((len > mips_abi_regsize (tdep))
&& (len % mips_abi_regsize (tdep) != 0));
int odd_sized_struct = ((len > mips_abi_regsize (gdbarch))
&& (len % mips_abi_regsize (gdbarch) != 0));
/* Note: Floating-point values that didn't fit into an FP
register are only written to memory. */
@ -2917,8 +2929,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
{
/* Remember if the argument was written to the stack. */
int stack_used_p = 0;
int partial_len = (len < mips_abi_regsize (tdep)
? len : mips_abi_regsize (tdep));
int partial_len = (len < mips_abi_regsize (gdbarch)
? len : mips_abi_regsize (gdbarch));
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@ -2936,16 +2948,16 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
stack_used_p = 1;
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{
if (mips_stack_argsize (tdep) == 8
if (mips_stack_argsize (gdbarch) == 8
&& (typecode == TYPE_CODE_INT
|| typecode == TYPE_CODE_PTR
|| typecode == TYPE_CODE_FLT) && len <= 4)
longword_offset = mips_stack_argsize (tdep) - len;
longword_offset = mips_stack_argsize (gdbarch) - len;
else if ((typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION)
&& (TYPE_LENGTH (arg_type)
< mips_stack_argsize (tdep)))
longword_offset = mips_stack_argsize (tdep) - len;
< mips_stack_argsize (gdbarch)))
longword_offset = mips_stack_argsize (gdbarch) - len;
}
if (mips_debug)
@ -2987,7 +2999,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
argreg,
phex (regval,
mips_abi_regsize (tdep)));
mips_abi_regsize (gdbarch)));
write_register (argreg, regval);
argreg++;
}
@ -3003,7 +3015,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
if (stack_used_p)
stack_offset += align_up (partial_len,
mips_stack_argsize (tdep));
mips_stack_argsize (gdbarch));
}
}
if (mips_debug)
@ -3100,7 +3112,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
mips_stack_argsize (tdep));
mips_stack_argsize (gdbarch));
sp -= align_up (len, 16);
if (mips_debug)
@ -3169,16 +3181,16 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
in registers where gcc sometimes puts them on the stack.
For maximum compatibility, we will put them in both
places. */
int odd_sized_struct = ((len > mips_abi_regsize (tdep))
&& (len % mips_abi_regsize (tdep) != 0));
int odd_sized_struct = ((len > mips_abi_regsize (gdbarch))
&& (len % mips_abi_regsize (gdbarch) != 0));
/* Note: Floating-point values that didn't fit into an FP
register are only written to memory. */
while (len > 0)
{
/* Rememer if the argument was written to the stack. */
int stack_used_p = 0;
int partial_len = (len < mips_abi_regsize (tdep)
? len : mips_abi_regsize (tdep));
int partial_len = (len < mips_abi_regsize (gdbarch)
? len : mips_abi_regsize (gdbarch));
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@ -3196,11 +3208,11 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
stack_used_p = 1;
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{
if (mips_stack_argsize (tdep) == 8
if (mips_stack_argsize (gdbarch) == 8
&& (typecode == TYPE_CODE_INT
|| typecode == TYPE_CODE_PTR
|| typecode == TYPE_CODE_FLT) && len <= 4)
longword_offset = mips_stack_argsize (tdep) - len;
longword_offset = mips_stack_argsize (gdbarch) - len;
}
if (mips_debug)
@ -3262,17 +3274,17 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
accordingly. */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& partial_len < mips_abi_regsize (tdep)
&& partial_len < mips_abi_regsize (gdbarch)
&& (typecode == TYPE_CODE_STRUCT ||
typecode == TYPE_CODE_UNION))
regval <<= ((mips_abi_regsize (tdep) - partial_len) *
regval <<= ((mips_abi_regsize (gdbarch) - partial_len) *
TARGET_CHAR_BIT);
if (mips_debug)
fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
argreg,
phex (regval,
mips_abi_regsize (tdep)));
mips_abi_regsize (gdbarch)));
write_register (argreg, regval);
argreg++;
}
@ -3288,7 +3300,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
if (stack_used_p)
stack_offset += align_up (partial_len,
mips_stack_argsize (tdep));
mips_stack_argsize (gdbarch));
}
}
if (mips_debug)
@ -3310,7 +3322,7 @@ mips_n32n64_return_value (struct gdbarch *gdbarch,
if (TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION
|| TYPE_CODE (type) == TYPE_CODE_ARRAY
|| TYPE_LENGTH (type) > 2 * mips_abi_regsize (tdep))
|| TYPE_LENGTH (type) > 2 * mips_abi_regsize (gdbarch))
return RETURN_VALUE_STRUCT_CONVENTION;
else if (TYPE_CODE (type) == TYPE_CODE_FLT
&& tdep->mips_fpu_type != MIPS_FPU_NONE)
@ -3438,7 +3450,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
mips_stack_argsize (tdep));
mips_stack_argsize (gdbarch));
sp -= align_up (len, 16);
if (mips_debug)
@ -3458,7 +3470,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
"mips_o32_push_dummy_call: struct_return reg=%d 0x%s\n",
argreg, paddr_nz (struct_addr));
write_register (argreg++, struct_addr);
stack_offset += mips_stack_argsize (tdep);
stack_offset += mips_stack_argsize (gdbarch);
}
/* Now load as many as possible of the first arguments into
@ -3553,7 +3565,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
argreg += FP_REGISTER_DOUBLE ? 1 : 2;
}
/* Reserve space for the FP register. */
stack_offset += align_up (len, mips_stack_argsize (tdep));
stack_offset += align_up (len, mips_stack_argsize (gdbarch));
}
else
{
@ -3565,11 +3577,11 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
in registers where gcc sometimes puts them on the stack.
For maximum compatibility, we will put them in both
places. */
int odd_sized_struct = ((len > mips_abi_regsize (tdep))
&& (len % mips_abi_regsize (tdep) != 0));
int odd_sized_struct = ((len > mips_abi_regsize (gdbarch))
&& (len % mips_abi_regsize (gdbarch) != 0));
/* Structures should be aligned to eight bytes (even arg registers)
on MIPS_ABI_O32, if their first member has double precision. */
if (mips_abi_regsize (tdep) < 8
if (mips_abi_regsize (gdbarch) < 8
&& mips_type_needs_double_align (arg_type))
{
if ((argreg & 1))
@ -3581,8 +3593,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
{
/* Remember if the argument was written to the stack. */
int stack_used_p = 0;
int partial_len = (len < mips_abi_regsize (tdep)
? len : mips_abi_regsize (tdep));
int partial_len = (len < mips_abi_regsize (gdbarch)
? len : mips_abi_regsize (gdbarch));
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@ -3600,11 +3612,11 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
stack_used_p = 1;
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{
if (mips_stack_argsize (tdep) == 8
if (mips_stack_argsize (gdbarch) == 8
&& (typecode == TYPE_CODE_INT
|| typecode == TYPE_CODE_PTR
|| typecode == TYPE_CODE_FLT) && len <= 4)
longword_offset = mips_stack_argsize (tdep) - len;
longword_offset = mips_stack_argsize (gdbarch) - len;
}
if (mips_debug)
@ -3668,19 +3680,19 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
identified as such and GDB gets tweaked
accordingly. */
if (mips_abi_regsize (tdep) < 8
if (mips_abi_regsize (gdbarch) < 8
&& TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& partial_len < mips_abi_regsize (tdep)
&& partial_len < mips_abi_regsize (gdbarch)
&& (typecode == TYPE_CODE_STRUCT ||
typecode == TYPE_CODE_UNION))
regval <<= ((mips_abi_regsize (tdep) - partial_len) *
regval <<= ((mips_abi_regsize (gdbarch) - partial_len) *
TARGET_CHAR_BIT);
if (mips_debug)
fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
argreg,
phex (regval,
mips_abi_regsize (tdep)));
mips_abi_regsize (gdbarch)));
write_register (argreg, regval);
argreg++;
@ -3701,7 +3713,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
always allocated. */
stack_offset += align_up (partial_len,
mips_stack_argsize (tdep));
mips_stack_argsize (gdbarch));
}
}
if (mips_debug)
@ -3838,9 +3850,9 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct type *type,
int regnum;
for (offset = 0, regnum = V0_REGNUM;
offset < TYPE_LENGTH (type);
offset += mips_stack_argsize (tdep), regnum++)
offset += mips_stack_argsize (gdbarch), regnum++)
{
int xfer = mips_stack_argsize (tdep);
int xfer = mips_stack_argsize (gdbarch);
if (offset + xfer > TYPE_LENGTH (type))
xfer = TYPE_LENGTH (type) - offset;
if (mips_debug)
@ -3890,7 +3902,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
len += align_up (TYPE_LENGTH (VALUE_TYPE (args[argnum])),
mips_stack_argsize (tdep));
mips_stack_argsize (gdbarch));
sp -= align_up (len, 16);
if (mips_debug)
@ -3910,7 +3922,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
"mips_o64_push_dummy_call: struct_return reg=%d 0x%s\n",
argreg, paddr_nz (struct_addr));
write_register (argreg++, struct_addr);
stack_offset += mips_stack_argsize (tdep);
stack_offset += mips_stack_argsize (gdbarch);
}
/* Now load as many as possible of the first arguments into
@ -4005,7 +4017,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
argreg += FP_REGISTER_DOUBLE ? 1 : 2;
}
/* Reserve space for the FP register. */
stack_offset += align_up (len, mips_stack_argsize (tdep));
stack_offset += align_up (len, mips_stack_argsize (gdbarch));
}
else
{
@ -4017,11 +4029,11 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
in registers where gcc sometimes puts them on the stack.
For maximum compatibility, we will put them in both
places. */
int odd_sized_struct = ((len > mips_abi_regsize (tdep))
&& (len % mips_abi_regsize (tdep) != 0));
int odd_sized_struct = ((len > mips_abi_regsize (gdbarch))
&& (len % mips_abi_regsize (gdbarch) != 0));
/* Structures should be aligned to eight bytes (even arg registers)
on MIPS_ABI_O32, if their first member has double precision. */
if (mips_abi_regsize (tdep) < 8
if (mips_abi_regsize (gdbarch) < 8
&& mips_type_needs_double_align (arg_type))
{
if ((argreg & 1))
@ -4033,8 +4045,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
{
/* Remember if the argument was written to the stack. */
int stack_used_p = 0;
int partial_len = (len < mips_abi_regsize (tdep)
? len : mips_abi_regsize (tdep));
int partial_len = (len < mips_abi_regsize (gdbarch)
? len : mips_abi_regsize (gdbarch));
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@ -4052,11 +4064,11 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
stack_used_p = 1;
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{
if (mips_stack_argsize (tdep) == 8
if (mips_stack_argsize (gdbarch) == 8
&& (typecode == TYPE_CODE_INT
|| typecode == TYPE_CODE_PTR
|| typecode == TYPE_CODE_FLT) && len <= 4)
longword_offset = mips_stack_argsize (tdep) - len;
longword_offset = mips_stack_argsize (gdbarch) - len;
}
if (mips_debug)
@ -4120,19 +4132,19 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
identified as such and GDB gets tweaked
accordingly. */
if (mips_abi_regsize (tdep) < 8
if (mips_abi_regsize (gdbarch) < 8
&& TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& partial_len < mips_abi_regsize (tdep)
&& partial_len < mips_abi_regsize (gdbarch)
&& (typecode == TYPE_CODE_STRUCT ||
typecode == TYPE_CODE_UNION))
regval <<= ((mips_abi_regsize (tdep) - partial_len) *
regval <<= ((mips_abi_regsize (gdbarch) - partial_len) *
TARGET_CHAR_BIT);
if (mips_debug)
fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
argreg,
phex (regval,
mips_abi_regsize (tdep)));
mips_abi_regsize (gdbarch)));
write_register (argreg, regval);
argreg++;
@ -4153,7 +4165,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
always allocated. */
stack_offset += align_up (partial_len,
mips_stack_argsize (tdep));
mips_stack_argsize (gdbarch));
}
}
if (mips_debug)
@ -5614,8 +5626,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
case MIPS_ABI_O32:
set_gdbarch_push_dummy_call (gdbarch, mips_o32_push_dummy_call);
set_gdbarch_return_value (gdbarch, mips_o32_return_value);
tdep->mips_default_abi_regsize = 4;
tdep->mips_default_stack_argsize = 4;
tdep->mips_fp_register_double = 0;
tdep->mips_last_arg_regnum = A0_REGNUM + 4 - 1;
tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 4 - 1;
@ -5630,8 +5640,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
mips_o64_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch,
mips_o64_extract_return_value);
tdep->mips_default_abi_regsize = 8;
tdep->mips_default_stack_argsize = 8;
tdep->mips_fp_register_double = 1;
tdep->mips_last_arg_regnum = A0_REGNUM + 4 - 1;
tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 4 - 1;
@ -5648,8 +5656,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
mips_eabi_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch,
mips_eabi_extract_return_value);
tdep->mips_default_abi_regsize = 4;
tdep->mips_default_stack_argsize = 4;
tdep->mips_fp_register_double = 0;
tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 8 - 1;
@ -5668,8 +5674,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
mips_eabi_store_return_value);
set_gdbarch_deprecated_extract_return_value (gdbarch,
mips_eabi_extract_return_value);
tdep->mips_default_abi_regsize = 8;
tdep->mips_default_stack_argsize = 8;
tdep->mips_fp_register_double = 1;
tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 8 - 1;
@ -5685,8 +5689,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
case MIPS_ABI_N32:
set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call);
set_gdbarch_return_value (gdbarch, mips_n32n64_return_value);
tdep->mips_default_abi_regsize = 8;
tdep->mips_default_stack_argsize = 8;
tdep->mips_fp_register_double = 1;
tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 8 - 1;
@ -5698,8 +5700,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
case MIPS_ABI_N64:
set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call);
set_gdbarch_return_value (gdbarch, mips_n32n64_return_value);
tdep->mips_default_abi_regsize = 8;
tdep->mips_default_stack_argsize = 8;
tdep->mips_fp_register_double = 1;
tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1;
tdep->mips_last_fp_arg_regnum = tdep->regnum->fp0 + 12 + 8 - 1;
@ -5927,7 +5927,7 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
FP_REGISTER_DOUBLE);
fprintf_unfiltered (file,
"mips_dump_tdep: mips_stack_argsize() = %d\n",
mips_stack_argsize (tdep));
mips_stack_argsize (current_gdbarch));
fprintf_unfiltered (file, "mips_dump_tdep: A0_REGNUM = %d\n", A0_REGNUM);
fprintf_unfiltered (file,
"mips_dump_tdep: ADDR_BITS_REMOVE # %s\n",
@ -5987,7 +5987,7 @@ mips_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
"mips_dump_tdep: MIPS_NUMREGS = %d\n", MIPS_NUMREGS);
fprintf_unfiltered (file,
"mips_dump_tdep: mips_abi_regsize() = %d\n",
mips_abi_regsize (tdep));
mips_abi_regsize (current_gdbarch));
fprintf_unfiltered (file,
"mips_dump_tdep: PRID_REGNUM = %d\n", PRID_REGNUM);
fprintf_unfiltered (file,