From: Joel Brobecker Date: Fri, 29 Jan 2010 05:27:36 +0000 (+0000) Subject: amd64-windows: 32 bytes allocated on stack by caller for integer parameter registers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3af6ddfec6363b97f9c850fef9f33e3bd2ad259c;p=binutils-gdb.git amd64-windows: 32 bytes allocated on stack by caller for integer parameter registers * i386-tdep.h (struct gdbarch_tdep): Add new field integer_param_regs_saved_in_caller_frame. * amd64-windows-tdep.c (amd64_windows_init_abi): Set tdep->integer_param_regs_saved_in_caller_frame to 1. * amd64-tdep.c (amd64_push_dummy_call): Allocate some memory on stack if tdep->integer_param_regs_saved_in_caller_frame is set. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8b1caa3f614..e8577283f41 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2010-01-29 Joel Brobecker + + amd64-windows: 32 bytes allocated on stack by caller for integer + parameter registers + * i386-tdep.h (struct gdbarch_tdep): Add new field + integer_param_regs_saved_in_caller_frame. + * amd64-windows-tdep.c (amd64_windows_init_abi): Set + tdep->integer_param_regs_saved_in_caller_frame to 1. + * amd64-tdep.c (amd64_push_dummy_call): Allocate some memory on + stack if tdep->integer_param_regs_saved_in_caller_frame is set. + 2010-01-29 Joel Brobecker amd64-windows: memory args passed by pointer during function calls. diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 058b318277c..fc621e0ee2d 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -701,6 +701,7 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int struct_return, CORE_ADDR struct_addr) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); gdb_byte buf[8]; /* Pass arguments. */ @@ -718,6 +719,11 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, regcache_cooked_write (regcache, arg_regnum, buf); } + /* Reserve some memory on the stack for the integer-parameter registers, + if required by the ABI. */ + if (tdep->integer_param_regs_saved_in_caller_frame) + sp -= tdep->call_dummy_num_integer_regs * 8; + /* Store return address. */ sp -= 8; store_unsigned_integer (buf, 8, byte_order, bp_addr); diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index 0ed93680340..05c4c1edfc0 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -84,6 +84,7 @@ amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->call_dummy_integer_regs = amd64_windows_dummy_call_integer_regs; tdep->classify = amd64_windows_classify; tdep->memory_args_by_pointer = 1; + tdep->integer_param_regs_saved_in_caller_frame = 1; set_solib_ops (gdbarch, &solib_target_so_ops); } diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index f79a15de7c5..5915eb91325 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -82,12 +82,12 @@ struct gdbarch_tdep int call_dummy_num_integer_regs; int *call_dummy_integer_regs; - /* Classify TYPE according to calling conventions, and store - the result in CLASS. Used on amd64 only. */ + /* Used on amd64 only. Classify TYPE according to calling conventions, + and store the result in CLASS. */ void (*classify) (struct type *type, enum amd64_reg_class class[2]); - /* Non-zero if the first few MEMORY arguments should be passed by - pointer. + /* Used on amd64 only. Non-zero if the first few MEMORY arguments + should be passed by pointer. More precisely, MEMORY arguments are passed through the stack. But certain architectures require that their address be passed @@ -95,6 +95,16 @@ struct gdbarch_tdep available for argument passing. */ int memory_args_by_pointer; + /* Used on amd64 only. + + If non-zero, then the callers of a function are expected to reserve + some space in the stack just before the area where the PC is saved + so that the callee may save the integer-parameter registers there. + The amount of space is dependent on the list of registers used for + integer parameter passing (see component call_dummy_num_integer_regs + above). */ + int integer_param_regs_saved_in_caller_frame; + /* Floating-point registers. */ struct regset *fpregset; size_t sizeof_fpregset;