* ia64-tdep.c (ia64_push_dummy_call): Define as combination of

former ia64_push_arguments and ia64_push_return_address, and use
	regcache functions instead of read/write_register.
	(ia64_gdbarch_init): Set push_dummy_call instead of
	deprecated_push_arguments and deprecated_push_return_address.
This commit is contained in:
Andreas Schwab 2003-07-01 22:32:36 +00:00
parent b6da3fa883
commit 8dd5115e3f
2 changed files with 35 additions and 32 deletions

View file

@ -1,3 +1,11 @@
2003-07-02 Andreas Schwab <schwab@suse.de>
* ia64-tdep.c (ia64_push_dummy_call): Define as combination of
former ia64_push_arguments and ia64_push_return_address, and use
regcache functions instead of read/write_register.
(ia64_gdbarch_init): Set push_dummy_call instead of
deprecated_push_arguments and deprecated_push_return_address.
2003-07-01 Andreas Jaeger <aj@suse.de>
* x86-64-tdep.c (x86_64_push_arguments): Align stack to 16-byte

View file

@ -1520,7 +1520,7 @@ static void
ia64_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
{
/* FIXME: See above. */
/* Note that most of the work was done in ia64_push_arguments() */
/* Note that most of the work was done in ia64_push_dummy_call() */
struct_return_address = addr;
}
@ -1853,8 +1853,10 @@ find_func_descr (CORE_ADDR faddr, CORE_ADDR *fdaptr)
}
static CORE_ADDR
ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
ia64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
int argno;
struct value *arg;
@ -1862,7 +1864,9 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
int len, argoffset;
int nslots, rseslots, memslots, slotnum, nfuncargs;
int floatreg;
CORE_ADDR bsp, cfm, pfs, new_bsp, funcdescaddr;
ULONGEST bsp, cfm, pfs, new_bsp;
CORE_ADDR funcdescaddr;
ULONGEST global_pointer = FIND_GLOBAL_POINTER (func_addr);
nslots = 0;
nfuncargs = 0;
@ -1887,21 +1891,21 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
memslots = nslots - rseslots;
/* Allocate a new RSE frame */
cfm = read_register (IA64_CFM_REGNUM);
regcache_cooked_read_unsigned (regcache, IA64_CFM_REGNUM, &cfm);
bsp = read_register (IA64_BSP_REGNUM);
regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp);
bsp = rse_address_add (bsp, cfm & 0x7f);
new_bsp = rse_address_add (bsp, rseslots);
write_register (IA64_BSP_REGNUM, new_bsp);
regcache_cooked_write_unsigned (regcache, IA64_BSP_REGNUM, new_bsp);
pfs = read_register (IA64_PFS_REGNUM);
regcache_cooked_read_unsigned (regcache, IA64_PFS_REGNUM, &pfs);
pfs &= 0xc000000000000000LL;
pfs |= (cfm & 0xffffffffffffLL);
write_register (IA64_PFS_REGNUM, pfs);
regcache_cooked_write_unsigned (regcache, IA64_PFS_REGNUM, pfs);
cfm &= 0xc000000000000000LL;
cfm |= rseslots;
write_register (IA64_CFM_REGNUM, cfm);
regcache_cooked_write_unsigned (regcache, IA64_CFM_REGNUM, cfm);
/* We will attempt to find function descriptors in the .opd segment,
but if we can't we'll construct them ourselves. That being the
@ -1979,11 +1983,12 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
len = TYPE_LENGTH (type);
while (len > 0 && floatreg < IA64_FR16_REGNUM)
{
ia64_register_convert_to_raw (
float_elt_type,
floatreg,
VALUE_CONTENTS (arg) + argoffset,
&deprecated_registers[REGISTER_BYTE (floatreg)]);
char buf[MAX_REGISTER_SIZE];
ia64_register_convert_to_raw (float_elt_type,
floatreg,
VALUE_CONTENTS (arg) + argoffset,
buf);
regcache_raw_write (regcache, floatreg, buf);
floatreg++;
argoffset += TYPE_LENGTH (float_elt_type);
len -= TYPE_LENGTH (float_elt_type);
@ -1994,11 +1999,14 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
/* Store the struct return value in r8 if necessary. */
if (struct_return)
{
store_unsigned_integer (&deprecated_registers[REGISTER_BYTE (IA64_GR8_REGNUM)],
REGISTER_RAW_SIZE (IA64_GR8_REGNUM),
struct_addr);
regcache_cooked_write_unsigned (regcache, IA64_GR8_REGNUM, struct_addr);
}
if (global_pointer != 0)
regcache_cooked_write_unsigned (regcache, IA64_GR1_REGNUM, global_pointer);
regcache_cooked_write_unsigned (regcache, IA64_BR0_REGNUM, bp_addr);
/* Sync gdb's idea of what the registers are with the target. */
target_store_registers (-1);
@ -2018,18 +2026,6 @@ ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
return sp;
}
static CORE_ADDR
ia64_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
{
CORE_ADDR global_pointer = FIND_GLOBAL_POINTER (pc);
if (global_pointer != 0)
write_register (IA64_GR1_REGNUM, global_pointer);
write_register (IA64_BR0_REGNUM, CALL_DUMMY_ADDRESS ());
return sp;
}
static void
ia64_store_return_value (struct type *type, char *valbuf)
{
@ -2289,8 +2285,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_write_pc (gdbarch, ia64_write_pc);
/* Settings for calling functions in the inferior. */
set_gdbarch_deprecated_push_arguments (gdbarch, ia64_push_arguments);
set_gdbarch_deprecated_push_return_address (gdbarch, ia64_push_return_address);
set_gdbarch_push_dummy_call (gdbarch, ia64_push_dummy_call);
set_gdbarch_deprecated_pop_frame (gdbarch, ia64_pop_frame);
set_gdbarch_deprecated_call_dummy_words (gdbarch, ia64_call_dummy_words);