Anonymous user
Calling Conventions: Difference between revisions
m
s/dword/uint32_t/g
[unchecked revision] | [unchecked revision] |
(Link to System V ABI and add categories) |
m (s/dword/uint32_t/g) |
||
Line 82:
==Passing Function Arguments==
GCC/x86 passes function arguments on the stack. These arguments are pushed in reverse order from their order in the argument list. Furthermore, since the x86 protected-mode stack operations operate on
To pass arguments to a C function, the calling function must push the argument values as described above. Thus, to call foo() from a [[NASM]] assembly program, you would do something like this
<syntaxhighlight lang="asm">
push eax ; low
push edx ; high
push bl ; baz
push ecx ; bar
Line 104:
mov ecx, [ebp + 8] ; fie
mov bl, [ebp + 12] ; foe
mov edx, [ebp + 16] ; low
mov eax, [ebp + 20] ; high
</syntaxhighlight>
|