delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/11/22:10:50

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Message-ID: <000d01c1b37b$3d5ae180$34e2a0c8@rjo.virtua.com.br>
From: "Pedro Izecksohn" <izecksohn AT yahoo DOT com>
To: <djgpp AT delorie DOT com>
Cc: <kala AT sankya DOT com>
References: <000a01c1b296$f2b0dc00$34e2a0c8 AT rjo DOT virtua DOT com DOT br> <slrna6ehga DOT 9j6 DOT kala AT ganga DOT sankya DOT com>
Subject: Re: Assembly Question:
Date: Tue, 12 Feb 2002 01:10:19 -0300
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
Disposition-Notification-To: "Pedro Izecksohn" <izecksohn AT yahoo DOT com>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Reply-To: djgpp AT delorie DOT com

   Dear Babu Kalakrishnan,

   You wrote: "...May be the first one is part of the entry code (to correct
for the pushed return address and pushed ebp occupying 8 bytes)...".

   I listened something about this a long time ago. May you explain it
better?

   Because in general:
   movl %ebp, %esp
   popl %ebp
   ret
   Take every thing that was pushed.

   Sorry about my previous message. I didn't see 2 replies between so much
new messages.

----- Original Message -----
From: "Babu Kalakrishnan" <kala AT sankya DOT com>
Newsgroups: comp.os.msdos.djgpp
To: <djgpp AT delorie DOT com>
Sent: Monday, February 11, 2002 1:18 AM
Subject: Re: Assembly Question:


> On Sun, 10 Feb 2002 21:56:07 -0300, Pedro Izecksohn <izecksohn AT yahoo DOT com>
wrote:
> >
> >   Hello to you all,
> >
> >   My question isn't really useful, but I would like to understand:
> >
> >   When "gcc asmtest.c -S" the code below:
> >
> >void test1 () {
> >}
> >
> >void main () {
> >test1();
> >}
> >
> >   gcc makes the following .S code: (Without the lines numbers.)
> >
> >1 .file "asmtest.c"
> >2 .section .text
> >3 .p2align 4
> >4 .globl _test1
> >5 _test1:
> >6 pushl %ebp
> >7 movl %esp, %ebp
> >8 popl %ebp
> >9 ret
> >10 .p2align 4
> >11 .globl _main
> >12 _main:
> >13 pushl %ebp
> >14 movl %esp, %ebp
> >15 subl $8, %esp
> >16 andl $-16, %esp
> >17 call _test1
> >18 movl %ebp, %esp
> >19 popl %ebp
> >20 ret
> >21 .ident "GCC: (GNU) 3.0.3"
> >
> >   What is the purpose of the lines 15 and 16 ?
>
> These are obviously meant for ensuring 16 byte stack alignment. I'm not
> sure why both statements are present though. May be the first one is
> part of the entry code (to correct for the pushed return address and
> pushed ebp occupying 8 bytes) - and the second is a part of the function
> call code (ensuring 16 byte alignment before calling the function).
>
> BK




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

- Raw text -


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