开发者_如何转开发Possible Duplicate:
executing assembly within a function in c++
long getesp() {
__asm__("movl %esp,%eax");
}
void main() {
printf("%08X\n",getesp()+4);
}
why is the esp printed is before the stack is set up?(before the pushl %ebp, movl %esp,%ebp) thanks in advance
My guess: there is no need for a frame, so none is allocated in getesp. The particulars depend on the compiler and compiler flags you are using.
精彩评论