Reputation: 29
here is a little function on a old book:
unsigned long f()
{
__asm__("movl %eax,%esp");
}
the function explained to get the stack point,but it seems not.It actually gets a 8-bit address much lower than my frame address.I guess it's designed for 32-bit system? Please forgive me if I said something stupid.
Upvotes: 0
Views: 1507
Reputation: 63
Actually the code has some mistake
unsigned long f()
{
__asm__("movl %esp,%eax");
}
it provides the stack pointer address
Upvotes: 0
Reputation: 2970
Indeed, as @James mentioned in the comments, in 64 bit mode, %eax
and %esp
represent the least significant 32 bits of the 64 bit %rax
and %rsp
registers.
Upvotes: 2