From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 5 12:41:15 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D5AF16A4CE for ; Fri, 5 Mar 2004 12:41:15 -0800 (PST) Received: from smtp012.mail.yahoo.com (smtp012.mail.yahoo.com [216.136.173.32]) by mx1.FreeBSD.org (Postfix) with SMTP id DF2E943D31 for ; Fri, 5 Mar 2004 12:41:14 -0800 (PST) (envelope-from skuma17@yahoo.com) Received: from unknown (HELO yahoo.com) (skuma17@24.49.116.224 with plain) by smtp012.mail.yahoo.com with SMTP; 5 Mar 2004 20:41:12 -0000 Message-ID: <4048E603.7000504@yahoo.com> Date: Fri, 05 Mar 2004 15:41:39 -0500 From: Chungwei Hsiung User-Agent: Mozilla Thunderbird 0.5 (X11/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <2ccf552c8dcf.2c8dcf2ccf55@tid.es> In-Reply-To: <2ccf552c8dcf.2c8dcf2ccf55@tid.es> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sat, 06 Mar 2004 04:56:47 -0800 Subject: Re: A simple question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Mar 2004 20:41:15 -0000 ISAAC GELADO FERNANDEZ wrote: >De: Chungwei Hsiung >Fecha: Viernes, Marzo 5, 2004 7:43 pm > > >>I have a simple test program. I compile it, >>and >>gdb to disassemble main. I got the following.. >> >>0x80481f8
: push %ebp >>0x80481f9 : mov %esp,%ebp >>0x80481fb : sub $0x8,%esp >>0x80481fe : and $0xfffffff0,%esp >>0x8048201 : mov $0x0,%eax >>0x8048206 : sub %eax,%esp >> >>I don't know if at line 5, we move zero to %eax. why do we need to sub %eax, %esp? why do we need to subtract 0 from the stack pointer?? >> >> > > I am no really sure, but it maybe be because you don't have any local variable, so it is no necessary to allocate memory in the stack for them. This seems a pattern from the compiler, it subtract the size of local variables from the stack pointer, so when there is none it subtracts zero. But this is just a supposition > > Regards, > Isaac > > >_______________________________________________ >freebsd-hackers@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > >