x64 calling convention (stack) and varargs

I've read Microsoft's documentation, but the scheme is so awkward, I thought I'd double-check to make sure I'm understanding it correctly...

My understanding is the generic method by which parameters are passed is this:

--- bottom of stack ---
(return address)
[shadow space for arg 1]
[shadow space for arg 2]
[shadow space for arg 3]
[shadow space for arg 4]
arg N
arg N - 1
arg N - 2
...
arg 6
arg 5
---- top of stack -----

It seems so awkward when implementing va_arg and such... is this actually correct?

Answers


The correct diagram is

--- Bottom of stack ---    RSP + size     (higher addresses)
arg N
arg N - 1
arg N - 2
...
arg 6
arg 5
[shadow space for arg 4]
[shadow space for arg 3]
[shadow space for arg 2]
[shadow space for arg 1]
(return address)
---- Top of stack -----    RSP            (lower addresses)
[grows downward]

The return address is at the top of the stack (most recently pushed), followed by shadow space for the first four parameters, followed by parameters 5 and onward.

The parameters are pushed right to left: The last parameter (N) is pushed first, so it is closest to the bottom of the stack.


Need Your Help

Can generic types be used as the “type” of a composite component's attribute tag?

java generics jsf jsf-2 composite-component

It looks to me like composite components' attributes don't allow generic types. Here's a simple test case:

*Efficiently* moving dataframes from Pandas to R with RPy (or other means)

python r dataframes rpy2

I have a dataframe in Pandas, and I want to do some statistics on it using R functions. No problem! RPy makes it easy to send a dataframe from Pandas into R:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.