pgubook-readers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pgubook-readers] Stack Diagram confussion


From: Alexander Kapshuk
Subject: Re: [Pgubook-readers] Stack Diagram confussion
Date: Thu, 23 Nov 2017 17:46:10 +0200



On Nov 23, 2017 17:02, "Ivan Nieto" <address@hidden> wrote:
In page 63, inside the 'All about functions' chapter, this diagram of the stack appears:

Imágenes integradas 1
And for my understanding, and from my lecture of the code. I think that this diagram have the Base Number and Power attributes in reverse order. The stack should look like this:

Power           <--- 12(%ebp)
B, Number     <---  8(%ebp)
Ret Addr        <---  4(%ebp)
Old %ebp       <---   (%ebp)
Current Res    <--- -4(%ebp)

This is the code:

Imágenes integradas 2

%ebx should contain the Base Number and %ecx should contain the power.
I just want to know if the way I am understanding this is correct.

Greetings.

_______________________________________________
Pgubook-readers mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/pgubook-readers

Yes, you did understand it correctly.
As an aside, local storage allocated on the stack to hold the result of multiplication may be omitted.
movl %ebx,%eax
...
Imull %ebx,%eax

The book probably mentions about that too.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]