ProgramA register is the only resource shared by all processes. Although only one process is active at a given time, we must ensure that when one process (caller) calls another (called, the called user does not overwrite the value of the Register that a caller will use later. To this end, ia32 adopts a set of unified register usage practices, and all processes must comply with, including the processes in the library.
By convention, registers eax, EDX, and ECx are divided into caller save registers. When P calls Q, Q can overwrite these registers without damaging the data required by P. In addition, registers EBX, ESI, and EDI are divided into callee save registers. This means that Q must save the values of these registers to the stack before overwriting them and restore them before returning, because P (or a higher-level process) these values may be required in future calculations. In addition, according to the conventions described here, the registers EBP and ESP must be saved.
P calculates y before calling Q, but it must ensure that the value of Y is available after Q is returned. There are two ways to do this:
1: it can store the value of Y in its stack frame before calling Q. When q returns, it can retrieve the value of Y from the stack.
2: it can save the value of Y in the caller's storage register. If Q, or any other program called by Q, wants to use this register, it must save the value of this register in the stack frame and restore it before returning. Therefore, when Q is returned to P, the value of Y is stored in the registers by the caller, either because the registers are not changed at all, or because they are saved and restored.