From: Mark Kettenis Date: Mon, 26 Mar 2001 12:11:14 +0000 (+0000) Subject: * i386-tdep.c (i386_push_arguments, i386_store_struct_return): New X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=22f8ba577413fda5817e1eac7605a56c5cbfccdb;p=binutils-gdb.git * i386-tdep.c (i386_push_arguments, i386_store_struct_return): New functions. * config/i386/tm-i386.h (PUSH_ARGUMENTS): New macro. (STORE_STRUCT_RETURN): Redefine in terms of i386_store_struct_return. (i386_push_arguments, i386_store_struct_return): New prototypes. * config/i386/tm-i386v.h (STORE_STRUCT_RETURN): Remove. It's definition was identical to the definition in "i386/tm-i386.h" so the new definition should suffice too. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2e7b9ca5892..9859890e0ff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2001-03-26 Mark Kettenis + + * i386-tdep.c (i386_push_arguments, i386_store_struct_return): New + functions. + * config/i386/tm-i386.h (PUSH_ARGUMENTS): New macro. + (STORE_STRUCT_RETURN): Redefine in terms of + i386_store_struct_return. + (i386_push_arguments, i386_store_struct_return): New prototypes. + * config/i386/tm-i386v.h (STORE_STRUCT_RETURN): Remove. It's + definition was identical to the definition in "i386/tm-i386.h" so + the new definition should suffice too. + 2001-03-26 Eli Zaretskii * event-loop.c (toplevel) [!HAVE_POLL] [NO_FD_SET]: Remove unused diff --git a/gdb/config/i386/tm-i386.h b/gdb/config/i386/tm-i386.h index e8714995ab5..9417b77a453 100644 --- a/gdb/config/i386/tm-i386.h +++ b/gdb/config/i386/tm-i386.h @@ -279,16 +279,20 @@ extern void i386_register_convert_to_raw (struct type *type, int regnum, extern void i387_float_info (void); #define FLOAT_INFO { i387_float_info (); } #endif - + +#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ + i386_push_arguments ((nargs), (args), (sp), (struct_return), (struct_addr)) +extern CORE_ADDR i386_push_arguments (int nargs, struct value **args, + CORE_ADDR sp, int struct_return, + CORE_ADDR struct_addr); + /* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. */ + subroutine will return. This is called from call_function. */ -#define STORE_STRUCT_RETURN(ADDR, SP) \ - { char buf[REGISTER_SIZE]; \ - (SP) -= sizeof (ADDR); \ - store_address (buf, sizeof (ADDR), ADDR); \ - write_memory ((SP), buf, sizeof (ADDR)); } +#define STORE_STRUCT_RETURN(addr, sp) \ + i386_store_struct_return ((addr), (sp)) +extern void i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp); /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, diff --git a/gdb/config/i386/tm-i386v.h b/gdb/config/i386/tm-i386v.h index a60dd5a8f70..c451bf82901 100644 --- a/gdb/config/i386/tm-i386v.h +++ b/gdb/config/i386/tm-i386v.h @@ -34,13 +34,6 @@ #undef START_INFERIOR_TRAPS_EXPECTED #define START_INFERIOR_TRAPS_EXPECTED 4 -#undef STORE_STRUCT_RETURN -#define STORE_STRUCT_RETURN(ADDR, SP) \ - { char buf[REGISTER_SIZE]; \ - (SP) -= sizeof (ADDR); \ - store_address (buf, sizeof (ADDR), ADDR); \ - write_memory ((SP), buf, sizeof (ADDR)); } - /* Extract from an array REGBUF containing the (raw) register state a function return value of type TYPE, and copy that, in virtual format, into VALBUF. */ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 6d5a7771b8f..a5d3ef74f94 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -694,6 +694,30 @@ get_longjmp_target (CORE_ADDR *pc) #endif /* GET_LONGJMP_TARGET */ +CORE_ADDR +i386_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp, + int struct_return, CORE_ADDR struct_addr) +{ + sp = default_push_arguments (nargs, args, sp, struct_return, struct_addr); + + if (struct_return) + { + char buf[4]; + + sp -= 4; + store_address (buf, 4, struct_addr); + write_memory (sp, buf, 4); + } + + return sp; +} + +void +i386_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) +{ + /* Do nothing. Everything was already done by i386_push_arguments. */ +} + /* These registers are used for returning integers (and on some targets also for returning `struct' and `union' values when their size and alignment match an integer type). */