Date: Thu, 18 Sep 1997 00:32:50 +0000 ( ) From: "Gurunandan R. Bhat" To: Hans-Bernhard Broeker Cc: djgpp AT delorie DOT com Subject: Re: Asm Question In-Reply-To: <01INR2K59CQE8WVYJI@mail> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Wed, 17 Sep 1997, Hans-Bernhard Broeker wrote: > In article 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