C++ stack opening, clearing, calling convention

1. Open the stack:

1. Push the actual parameters (initialize the formal parameters, and
push the stack from right to left); 2. Push the address of the next line of instructions (can continue execution along the call point after rollback);
3. (push ebp) push The address of the bottom of the caller's stack (can fall back to the caller's stack frame);
4. The called party opens up memory and initializes cccccccc ;

2. Clear the stack:

1. Clean up the stack frame reserved by the callee;
2. pop ebp (the stack frame is rolled back to the caller);
3. pop pc (code is executed along the caller);
4. Clean up the formal parameters; the formal parameters are called by The side opens up the memory and the caller cleans up.
Less than or equal to four bytes are brought out by one register (eax)
Greater than four and less than eight bytes are brought out by two registers (eax+edx)
Greater than eight bytes are brought out by temporary tmp (in the caller Stack frame);

3. Calling convention:

_cdcall
C standard calling convention
_stdcall
windows standard calling convention
_fastcall
fast calling convention
_thiscall
class member method standard calling convention

Insert picture description hereInsert picture description here

Guess you like

Origin blog.csdn.net/Gunanhuai/article/details/102846263