Mail Archives: djgpp/1997/09/18/02:14:07
On Wed, 17 Sep 1997, Hans-Bernhard Broeker wrote:
> In article <Pine DOT LNX DOT 3 DOT 91 DOT 970916120927 DOT 905A-100000 AT aditya DOT unigoa DOT ernet DOT in> you wrote:
> > Greetings,
>
> > In what precise way does %ebp "characterise" a stack frame? Does it point
> > to the first address on the current stack frame? If so shouldn't each
> > nested procedure call redefine %ebp to set up a new stack frame for its
> > use?
>
> Of course they do, and that's exactly what they do. The point where
> you got misled seems to be that you expected the *caller* to do
> that.
Yes, that was it. Thanks for clearing things up.
>
> pushl %ebp
> movl %esp,%ebp
> subl $8,%esp
>
> The %ebp is pushed to the stack, then the stack pointer is copied to
> %ebp. So %ebp always holds the value of the stack pointer as it was
> when the function was started.
Is it correct to say then that, at any given time:
1) %ebp always points to the current stack frame
2) (%ebp) always points to the earlier (calling function's) stack frame
> movl %ebp,%esp
> popl %ebp
These two statements appear as "leave" right?
> I don't think I can see what this would be useful for, unless you plan
> to write a package like DJGPP from scratch, all on your own :-)
I wouldn't dare! At least not yet ;)
Thanks
- Raw text -