Mercurial > pub > dyncall > dyncall
comparison doc/manual/callconvs/callconv_x86.tex @ 530:585dcb68f55d
- more doc and disas examples for x86 fastcall and non-trivial aggregates
author | Tassilo Philipp |
---|---|
date | Sat, 16 Apr 2022 12:10:02 +0200 |
parents | fc614cb865c6 |
children |
comparison
equal
deleted
inserted
replaced
529:fe694c7677b4 | 530:585dcb68f55d |
---|---|
186 \clearpage | 186 \clearpage |
187 | 187 |
188 \paragraph{Return values} | 188 \paragraph{Return values} |
189 | 189 |
190 \begin{itemize} | 190 \begin{itemize} |
191 \item return values of pointer or integral type (\textless=\ 32 bits) are returned via the eax register | 191 \item return values of pointer or integral type, as well as aggregates (structs, unions) \textless=\ 64 are returned via the eax and edx registers |
192 \item for {\it non-trivial} C++ aggregates, the caller allocates space, passes pointer to it to the callee as a hidden first param | 192 \item for {\it non-trivial} C++ aggregates, the caller allocates space, passes pointer to it to the callee as a hidden first param |
193 (meaning via ecx), and callee writes return value to this space; the ptr to the aggregate is returned in eax | 193 (meaning via ecx), and callee writes return value to this space; the ptr to the aggregate is returned in eax |
194 \item integers and aggregates (structs, unions) \textgreater\ 32 and \textless=\ 64 bits are returned via the eax and edx registers | |
195 \item return values \textgreater\ 64 bits (e.g. aggregates) are returned by the caller allocating the space and | 194 \item return values \textgreater\ 64 bits (e.g. aggregates) are returned by the caller allocating the space and |
196 passing a pointer to the callee as a new, implicit first parameter (always via the stack, never via a register) | 195 passing a pointer to the callee as a new, implicit first parameter (always via the stack, never via a register) |
197 \item floating point types are returned via the st0 register | 196 \item floating point types are returned via the st0 register |
198 \end{itemize} | 197 \end{itemize} |
199 | 198 |
508 \item called function cleans up the stack | 507 \item called function cleans up the stack |
509 \item all parameters are pushed onto the stack (as dwords) | 508 \item all parameters are pushed onto the stack (as dwords) |
510 \item arguments \textgreater\ 64 bits are pushed as a sequence of dwords | 509 \item arguments \textgreater\ 64 bits are pushed as a sequence of dwords |
511 \item aggregates (structs, unions) are pushed as a sequence of dwords | 510 \item aggregates (structs, unions) are pushed as a sequence of dwords |
512 \item {\it non-trivial} C++ aggregates (as defined by the language) of any size, are passed indirectly via a pointer to a copy of the aggregate | 511 \item {\it non-trivial} C++ aggregates (as defined by the language) of any size, are passed indirectly via a pointer to a copy of the aggregate |
513 \item stack is usually 4 byte aligned (GCC \textgreater=\ 3.x seems to use a 16byte alignement) | 512 \item stack is usually 4 byte aligned (GCC \textgreater=\ 3.x seems to use a 16byte alignment) |
514 \item the direction flag is clear on entry and must be returned clear % mention it first, above @@@ | 513 \item the direction flag is clear on entry and must be returned clear % mention it first, above @@@ |
515 \end{itemize} | 514 \end{itemize} |
516 | 515 |
517 % introduce mangling section? \item Function name is decorated by prepending an underscore character and appending a '@' character and the number of bytes of stack space required | 516 % introduce mangling section? \item Function name is decorated by prepending an underscore character and appending a '@' character and the number of bytes of stack space required |
518 | 517 |