title: Calling Conventions date: 2021-01-13 categories: [cheatsheets]
cdecl:
stdcall
fastcall
Different compilers use different conventions, even when passing parameters over the stack, gcc differs from vs compiler: vsc pushes the params. on the stack, gcc moves them on the stack.
visual studio compiler:
push ebx
push ecx
call add
gcc:
mov [esp+4], ebx
mov [esp], ecx
call add
Detaild List:
https://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_calling_conventions
32 Bit: Parameters are passed over the Stack
64 Bit:
* Windows: RCX, RDX, R8, R9 - Rest over the Stack
* Linux: RDI, RSI, RDX, RCX, R8, R9 - Rest over the Stack