Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我读到 SFP 用于将 EBP 恢复到以前的值。为什么 EBP 需要回到它的初始值?
为什么 EBP 需要回到它的初始值?
当进行函数调用时,编译器通常作为函数体的第一件事,将当前 EBP 值压入堆栈并将 EBP(基指针/帧指针)设置为当前 ESP(堆栈指针,始终指向到栈顶)。然后使用 EBP 访问函数的局部变量和参数。
当函数返回 o 时,EBP 的值被恢复,它可以服务于前一个函数的函数调用。