Originally Posted by Markon
At pages 132+, are explained the CALLs.
I've not understood if we can use only the register %esp instead of using the %ebp register also.
I understand that %ebp is really useful to restore the original %esp at the time of calling the function. But, if I've a simple function, can I not use %ebp?
If you read the very start of the book - it explains the registers there.
EBP is the Extended Base Pointer. It is used for calculating the data variables on the stack.
ESP is the Extended Stack Pointer. It is used for positioning reads and writes from the stack. For instance, during a POP the ESP register is changed whereas EBP remains the same!
So, be careful when modifying these registers as they hold very important information!