From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8459 invoked by alias); 24 Sep 2013 16:33:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 8416 invoked by uid 89); 24 Sep 2013 16:33:47 -0000 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 24 Sep 2013 16:33:47 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 32D20116712; Tue, 24 Sep 2013 12:34:01 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id VxINYU0NNcEa; Tue, 24 Sep 2013 12:34:01 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id F24BC11670E; Tue, 24 Sep 2013 12:34:00 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 96FC8E0314; Tue, 24 Sep 2013 09:33:43 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Pierre Muller , Mark Kettenis Subject: [commit 3/4] Revert use of memory_args_by_pointer in i386 gdbarch_tdep. Date: Tue, 24 Sep 2013 16:33:00 -0000 Message-Id: <1380040404-16932-4-git-send-email-brobecker@adacore.com> In-Reply-To: <1380040404-16932-1-git-send-email-brobecker@adacore.com> References: <20130920232017.GU3132@adacore.com> <1380040404-16932-1-git-send-email-brobecker@adacore.com> X-SW-Source: 2013-09/txt/msg00869.txt.bz2 This is no longer useful, as it was introduced to reuse the funcall handling code in amd64-tdep.c in the context of x64-windows. But we have since then changed the implementations to be completely independent of each other. This reverts the non-windows-specific part of the change called: amd64-windows: memory args passed by pointer during function calls. (the x64-windows portion has already been reverted) gdb/ChangeLog: Revert: * i386-tdep.h (gdbarch_tdep): Add field memory_args_by_pointer. * amd64-tdep.c (amd64_push_arguments): Add handling of architectures where tdep->memory_args_by_pointer is non-zero. Tested on x86_64-linux, checked in. --- gdb/ChangeLog | 7 +++++++ gdb/amd64-tdep.c | 40 ++++++---------------------------------- gdb/i386-tdep.h | 9 --------- 3 files changed, 13 insertions(+), 43 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1977ff0..cd03e31 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,13 @@ 2013-09-24 Joel Brobecker Revert: + * i386-tdep.h (gdbarch_tdep): Add field memory_args_by_pointer. + * amd64-tdep.c (amd64_push_arguments): Add handling of architectures + where tdep->memory_args_by_pointer is non-zero. + +2013-09-24 Joel Brobecker + + Revert: * i386-tdep.h (struct gdbarch_tdep): Add new field integer_param_regs_saved_in_caller_frame. * amd64-tdep.c (amd64_push_dummy_call): Allocate some memory on diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index ec6bfc6..35526cf 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -749,8 +749,7 @@ static CORE_ADDR amd64_push_arguments (struct regcache *regcache, int nargs, struct value **args, CORE_ADDR sp, int struct_return) { - struct gdbarch *gdbarch = get_regcache_arch (regcache); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); int *integer_regs = tdep->call_dummy_integer_regs; int num_integer_regs = tdep->call_dummy_num_integer_regs; @@ -763,11 +762,6 @@ amd64_push_arguments (struct regcache *regcache, int nargs, AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7, }; struct value **stack_args = alloca (nargs * sizeof (struct value *)); - /* An array that mirrors the stack_args array. For all arguments - that are passed by MEMORY, if that argument's address also needs - to be stored in a register, the ARG_ADDR_REGNO array will contain - that register number (or a negative value otherwise). */ - int *arg_addr_regno = alloca (nargs * sizeof (int)); int num_stack_args = 0; int num_elements = 0; int element = 0; @@ -811,19 +805,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs, { /* The argument will be passed on the stack. */ num_elements += ((len + 7) / 8); - stack_args[num_stack_args] = args[i]; - /* If this is an AMD64_MEMORY argument whose address must also - be passed in one of the integer registers, reserve that - register and associate this value to that register so that - we can store the argument address as soon as we know it. */ - if (class[0] == AMD64_MEMORY - && tdep->memory_args_by_pointer - && integer_reg < tdep->call_dummy_num_integer_regs) - arg_addr_regno[num_stack_args] = - tdep->call_dummy_integer_regs[integer_reg++]; - else - arg_addr_regno[num_stack_args] = -1; - num_stack_args++; + stack_args[num_stack_args++] = args[i]; } else { @@ -878,20 +860,10 @@ amd64_push_arguments (struct regcache *regcache, int nargs, { struct type *type = value_type (stack_args[i]); const gdb_byte *valbuf = value_contents (stack_args[i]); - CORE_ADDR arg_addr = sp + element * 8; - - write_memory (arg_addr, valbuf, TYPE_LENGTH (type)); - if (arg_addr_regno[i] >= 0) - { - /* We also need to store the address of that argument in - the given register. */ - gdb_byte buf[8]; - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - - store_unsigned_integer (buf, 8, byte_order, arg_addr); - regcache_cooked_write (regcache, arg_addr_regno[i], buf); - } - element += ((TYPE_LENGTH (type) + 7) / 8); + int len = TYPE_LENGTH (type); + + write_memory (sp + element * 8, valbuf, len); + element += ((len + 7) / 8); } /* The psABI says that "For calls that may call functions that use diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 8113dcc..0c408fa 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -85,15 +85,6 @@ struct gdbarch_tdep the result in CLASS. Used on amd64 only. */ void (*classify) (struct type *type, enum amd64_reg_class class[2]); - /* 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 - by register as well, if there are still some integer registers - available for argument passing. */ - int memory_args_by_pointer; - /* Floating-point registers. */ struct regset *fpregset; size_t sizeof_fpregset; -- 1.8.1.2