p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Professional Assembly Language (http://p2p.wrox.com/book-professional-assembly-language-161/)
-   -   A question about %esp and %ebp (http://p2p.wrox.com/book-professional-assembly-language/72283-question-about-esp-ebp.html)

Markon January 16th, 2009 11:26 AM

A question about %esp and %ebp
 
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?

Thank you

Silvine January 10th, 2010 06:35 AM

Quote:

Originally Posted by Markon (Post 233255)
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?

Thank you

Hi,

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!


All times are GMT -4. The time now is 06:11 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.