Pre-Knowledge:
① Stack: A computer system refers to a piece of memory area of the stack management, the growth direction of the stack is from high address space to low address space growth
② assembly Command Call: Returns the address into the stack and jumps to the beginning of the called procedure
③ Assembly instruction Ret: POPs the return address from the stack and jumps to this position
IA32 (x86) supports procedure calls through the program stack. The machine uses stacks to pass process parameters (function parameters), store return information, and save registers. The portion of the stack allocated for a single process is called a stack frame. Describes the general structure of the stack frame. The top of the stack frame is defined by two pointers, the register%EBP as the frame pointer, and the%ESP is the stack pointer. %EBP points to the beginning of the stack frame, and%esp points to the top element of the stack.
View the stack mechanism of program from C-language function call