Possible Duplicate:
executing assembly within a function in c++
long getesp() {
__asm__("movl %esp,%eax");
}
void main() {
printf("%08X\n",getesp()+4);
}
为什么esp是在堆栈建立之前打印的?(在pushl %ebp, movl %esp,%ebp之前) 提前致谢
最佳答案
我的猜测:不需要帧,因此在 getesp 中没有分配任何帧。详细信息取决于您使用的编译器和编译器标志。
关于c - 获取栈的起始地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6009560/