Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Mar 2004 15:41:39 -0500
From:      Chungwei Hsiung <skuma17@yahoo.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: A simple question
Message-ID:  <4048E603.7000504@yahoo.com>
In-Reply-To: <2ccf552c8dcf.2c8dcf2ccf55@tid.es>
References:  <2ccf552c8dcf.2c8dcf2ccf55@tid.es>

next in thread | previous in thread | raw e-mail | index | archive | help
ISAAC GELADO FERNANDEZ wrote:

>De: Chungwei Hsiung <skuma17@yahoo.com>
>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 <main>:       push   %ebp
>>0x80481f9 <main+1>:     mov    %esp,%ebp
>>0x80481fb <main+3>:     sub    $0x8,%esp
>>0x80481fe <main+6>:     and    $0xfffffff0,%esp
>>0x8048201 <main+9>:     mov    $0x0,%eax
>>0x8048206 <main+14>:    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"
>
>  
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4048E603.7000504>