From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 5 10:42:37 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 77FAB16A4CE for ; Fri, 5 Mar 2004 10:42:37 -0800 (PST) Received: from smtp105.mail.sc5.yahoo.com (smtp105.mail.sc5.yahoo.com [66.163.169.225]) by mx1.FreeBSD.org (Postfix) with SMTP id 3C00543D2D for ; Fri, 5 Mar 2004 10:42:37 -0800 (PST) (envelope-from skuma17@yahoo.com) Received: from unknown (HELO yahoo.com) (skuma17@24.49.116.224 with plain) by smtp105.mail.sc5.yahoo.com with SMTP; 5 Mar 2004 18:42:37 -0000 Message-ID: <4048CA38.6040203@yahoo.com> Date: Fri, 05 Mar 2004 13:43:04 -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 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: 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 18:42:37 -0000 Hello.. I am super new to this list, and I have a simple question that I don't know why it does that. 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 0x8048208 : movl $0x804a6ce,0xfffffff8(%ebp) 0x804820f : movl $0x0,0xfffffffc(%ebp) 0x8048216 : sub $0x4,%esp 0x8048219 : push $0x0 0x804821b : lea 0xfffffff8(%ebp),%eax 0x804821e : push %eax 0x804821f : pushl 0xfffffff8(%ebp) 0x8048222 : call 0x804823c 0x8048227 : add $0x10,%esp 0x804822a : mov $0x0,%eax 0x804822f : leave 0x8048230 : ret 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 substract 0 from the stack pointer?? Any help is really appreciated. best regards Chungwei