From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: kettenis@gnu.org
Subject: amd64-windows: Fix funcall with by-pointer arguments
Date: Wed, 24 Oct 2012 17:23:00 -0000 [thread overview]
Message-ID: <1351099417-18960-1-git-send-email-brobecker@adacore.com> (raw)
Hello,
I realized a while ago that I completely misunderstood the amd64-windows
API regarding arguments that are passed by pointer. The calling
convention is published there:
http://msdn.microsoft.com/en-us/library/zthk2dkh(v=vs.80).aspx
Aggregates whose size is not 8/16/32/64 should be passed by pointer,
and what that means is that the caller is expected to make a copy
of the object, and pass its address as the argument. This is different
from passing the argument through the stack and the stack address
at the same time.
In particular, when you have a function call which involves one of
those by-pointer argument that follows an on-stack argument, the
incorrect method would puth the by-pointer argument on the stack
after the first argument, thus screwing up the offset of the first
argument relative to the caller's frame address, etc.
This patch series fixes the problem by:
1. Reverting the first (incorrect) attempt at handling by-pointer
arguments;
2. Add handling of by-pointer arguments again.
Tested on x86_64-windows with AdaCore's testsuite, and on x86_64-linux
using the official testsuite.
next reply other threads:[~2012-10-24 17:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-24 17:23 Joel Brobecker [this message]
2012-10-24 17:23 ` [RFA 2/2] amd64-windows: Arguments passed by pointer Joel Brobecker
2012-10-24 17:24 ` [RFA 1/2] Revert "amd64-windows: memory args passed by pointer during function calls." Joel Brobecker
2012-10-25 13:18 ` amd64-windows: Fix funcall with by-pointer arguments Mark Kettenis
2013-01-16 11:59 ` Joel Brobecker
2013-09-13 22:11 ` [RFC-v2] " Pierre Muller
2013-09-16 20:57 ` Joel Brobecker
2013-09-17 13:50 ` Joel Brobecker
2013-09-20 23:20 ` Joel Brobecker
2013-09-24 16:33 ` Joel Brobecker
2013-09-24 16:33 ` [commit 3/4] Revert use of memory_args_by_pointer in i386 gdbarch_tdep Joel Brobecker
2013-09-24 16:33 ` [commit 2/4] Revert use of integer_param_regs_saved_in_caller_frame " Joel Brobecker
2013-09-24 16:33 ` [commit 4/4] Revert use of classify callback " Joel Brobecker
2013-09-24 16:33 ` [commit 1/4] Reimplement function calls on amd64-windows Joel Brobecker
2013-09-24 17:26 ` fixed ChangeLog: " Joel Brobecker
2013-09-24 16:53 ` [RFC-v2] amd64-windows: Fix funcall with by-pointer arguments Mark Kettenis
2013-09-24 22:02 ` Pierre Muller
2013-09-26 0:34 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351099417-18960-1-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=kettenis@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox