Last active
March 21, 2016 23:23
-
-
Save segrax/88e7c5e7947f55e34353 to your computer and use it in GitHub Desktop.
Assembly Notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------ | |
CDECL calling convention 32 BIT | |
------------------------ | |
void test_CDECL( int a, int b, int c, int d ); | |
Four parameters to be pushed in right-to-left order | |
push 4 ; param d :esp -= 4 | |
push 3 ; param c :esp -= 4 | |
push 2 ; param b :esp -= 4 | |
push 1 ; param a :esp -= 4 | |
call test_CDECL | |
add esp, 16 :esp += 16 | |
------- | |
stdcall 32 BIT | |
-------- | |
Parameters are pushed the same as CDECL, however the called function is responsible for clearing the stack. | |
ie. | |
ret 16; : esp += 16 | |
-------- | |
fastcall | |
-------- | |
first two parameters (right to left) are put in ECX, and EDX - in that order. Rest of parameters are pushed right-to-left | |
ret 8; : esp += 8 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment