Uninformed: Informative Information for the Uninformed

Vol 4» 2006.Jun


Stack Frame Layout

The stack frame layout for functions on x64 is very similar to x86, but with a few key differences. Just like x86, the stack frame on x64 is divided into three parts: parameters, return address, and locals. These three parts are explained individually below. One of the important principals to understand when it comes to x64 stack frames is that the stack does not fluctuate throughout the course of a given function. In fact, the stack pointer is only permitted to change in the context of a function prologue3.1. Parameters are not pushed and popped from the stack. Instead, stack space is pre-allocated for all of the arguments that would be passed to child functions. This is done, in part, for making it easier to unwind call stacks in the event of an exception. The table below describes a typical stack frame:


\begin{tabular}{\vert c\vert}
\par
\hline
\par
Stack parameter area \\
\hline
...
...a \\
\hline
Return address \\
\hline
Locals \\
\par
\hline
\end{tabular}



Subsections