On Nov 23, 2017 17:02, "Ivan Nieto" <[email protected]> wrote:

In page 63, inside the 'All about functions' chapter, this diagram of the
stack appears:

[image: 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:

[image: 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
[email protected]
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.
_______________________________________________
Pgubook-readers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/pgubook-readers

Reply via email to