Stack frame
Stack frames are a space allocated for a specific process in the stack. Each process generates a stack frame. The stack frame is determined by two registers: The frame pointer EBP and the stack pointer ESP. For a stack frame, the frame pointer EBP is fixed. Therefore, the frame pointer can be used as the benchmark pointer in a stack frame. Other storage contents can be used as the benchmark to determine the relative position. The stack pointer ESP always points to the top of the stack. StillArticleThe example of the P function calling Q function in is background. First, there will be a p-process stack frame in the stack. When the Q-process is called in the p-process, it will introduce registers, return addresses, and so on to the stack described in the previous article, then create stack frames for the Q process. The process of setting up stack frames is actually to open up space. When the P registers and return addresses are all written into the stack, we also need to import EBP into the stack. I understand that it is to import the EBP of caller P into the stack, because the caller P is not over, if p is to continue executing after the Q function is over, it should still use its stack frame pointer as the reference address. If it is not saved, during the creation of Q stack frames, EBP will be assigned a new value to overwrite the value of P's frame pointer. After all the above data is saved in the stack, the ESP value is assigned to the EBP so that a new stack frame is created. Because the new ESP pointer is pushed down (because the inbound stack is pushed in the direction of the small address), the new stack frame has its own storage space. A complete stack frame is created.
Because you cannot upload images today, you cannot take out instances. I feel that I do not understand this concept enough. I should be studying it.