delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/17/13:50:43

Message-Id: <m0xBIZZ-000S1fC@inti.edu.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT edu DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT edu DOT ar>
Organization: INTI
To: "Gurunandan R. Bhat" <grbhat AT unigoa DOT ernet DOT in>, djgpp AT delorie DOT com
Date: Wed, 17 Sep 1997 15:12:06 +0000
MIME-Version: 1.0
Subject: Re: Asm Question

"Gurunandan R. Bhat" <grbhat AT unigoa DOT ernet DOT in> wrote:

> In what precise way does %ebp "characterise" a stack frame? Does it point
> to the first address on the current stack frame?
Is a copy of ESP at the entry point of the function. You can access to the 
local variables, parameters and return address using EBP as base (you can use 
ESP too, but not if you modify it).

> If so shouldn't each
> nested procedure call redefine %ebp to set up a new stack frame for its
> use? 
Each function sets EBP to your own "stack-frame".

> I have looked at some .s files produced by gcc and all they do is push and 
> pop %ebp at each procedure call. Where is it initialised if at all? I 
> suspect that this is done in crt0.s but would be grateful for the range 
> of line numbers in the relevant file where this is accomplished 
Naa..., take a better look to the code, gcc uses:

pushl %ebp
movl  %esp,%ebp
.
.
leave
ret
 
So the thing that is made at start-up is the definition of ss:esp.

Greetings, SET
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


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