List of X86 Calling Conventions
This is a list of x86 calling conventions. These are conventions primarily intended for C/C++ compilers (especially the 64-bit part below), and thus largely special cases. Other languages may use other formats and conventions in their implementations.
| Architecture | Calling convention name | Operating system, compiler | Parameters in registers | Parameter order on stack | Stack cleanup by | Notes |
|---|---|---|---|---|---|---|
| 8086 | cdecl | RTL (C) | Caller | |||
| Pascal | LTR (Pascal) | Callee | ||||
| fastcall | Microsoft (non-member) | AX, DX, BX | LTR (Pascal) | Callee | Return pointer in BX. | |
| fastcall | Microsoft (member function) | AX, DX | LTR (Pascal) | Callee | “this” on stack low address. Return pointer in AX. | |
| fastcall | Borland compiler | AX, DX, BX | LTR (Pascal) | Callee | “this” on stack low address. Return pointer on stack high address. | |
| Watcom compiler | AX, DX, BX, CX | RTL (C) | Callee | Return pointer in SI. | ||
| IA-32 | cdecl | GCC | RTL (C) | Caller | When returning struct/class, the calling code allocates space and passes a pointer to this space via a hidden parameter on the stack. The called function writes the return value to this address. | |
| cdecl | Microsoft | RTL (C) | Caller | When returning struct/class,
|
||
| stdcall | RTL (C) | Callee | ||||
| GCC | RTL (C) | Hybrid | Stack aligned on 16 bytes boundary. | |||
| fastcall | Microsoft | ECX, EDX | RTL (C) | Callee | Return pointer on stack if not member function. | |
| fastcall | GCC | ECX, EDX | RTL (C) | Callee | ||
| fastcall | Borland/Embarcadero compiler | EAX, EDX, ECX | LTR (Pascal) | Callee | ||
| thiscall | Microsoft | ECX | RTL (C) | Callee | Default for member functions. | |
| Watcom compiler | EAX, EDX, EBX, ECX | RTL (C) | Callee | Return pointer in ESI. | ||
| x86-64 | Microsoft x64 calling convention | Windows (Microsoft Visual C++, Intel C++ Compiler, Embarcadero compiler), UEFI | RCX/XMM0, RDX/XMM1, R8/XMM2, R9/XMM3 | RTL (C) | Caller | Stack aligned on 16 bytes. 32 bytes shadow space on stack. The specified 8 registers can only be used for parameters 1 through 4. |
| System V AMD64 ABI | GNU/Linux, BSD, Mac OS X (GCC, Intel C++ Compiler) | RDI, RSI, RDX, RCX, R8, R9, XMM0–7 | RTL (C) | Caller | Stack aligned on 16 bytes boundary. Red zone below stack. |
Read more about this topic: X86 Calling Conventions
Famous quotes containing the words list of, list, calling and/or conventions:
“I made a list of things I have
to remember and a list
of things I want to forget,
but I see they are the same list.”
—Linda Pastan (b. 1932)
“Do your children view themselves as successes or failures? Are they being encouraged to be inquisitive or passive? Are they afraid to challenge authority and to question assumptions? Do they feel comfortable adapting to change? Are they easily discouraged if they cannot arrive at a solution to a problem? The answers to those questions will give you a better appraisal of their education than any list of courses, grades, or test scores.”
—Lawrence Kutner (20th century)
“Those of us who are in this world to educateto care foryoung children have a special calling: a calling that has very little to do with the collection of expensive possessions but has a lot to do with the worth inside of heads and hearts. In fact, thats our domain: the heads and hearts of the next generation, the thoughts and feelings of the future.”
—Fred M. Rogers, U.S. writer and host of Mr. Rogers Neighborhood. That Which is Essential Is Invisible to the Eye, Young Children (July 1994)
“I find nothing healthful or exalting in the smooth conventions of society. I do not like the close air of saloons. I begin to suspect myself to be a prisoner, though treated with all this courtesy and luxury. I pay a destructive tax in my conformity.”
—Ralph Waldo Emerson (18031882)