www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/18/02:14:07

Date: Thu, 18 Sep 1997 00:32:50 +0000 ( )
From: "Gurunandan R. Bhat" <grbhat AT unigoa DOT ernet DOT in>
To: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Cc: djgpp AT delorie DOT com
Subject: Re: Asm Question
In-Reply-To: <01INR2K59CQE8WVYJI@mail>
Message-Id: <Pine.LNX.3.91.970918002833.488A-100000@aditya.unigoa.ernet.in>
Mime-Version: 1.0


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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019