Assembly Code Query

Alex J. Dam alexjotadam@yahoo.com.br
Sat Feb 26 14:06:00 GMT 2005


On Friday 25 February 2005 20:31, .jareeN. wrote:
> Hi all,

Hello.

> 	I am using gcc -S to generate this assembly code. The compiler
> gives:
>
> 		andl    $-16, %esp
>
> I understand that we are here basically anding 0xffff00ff with %esp. But

-16 equals 0xfffffff0, not 0xffff00ff.  So, by ANDing %esp with 0xfffffff0, 
you're actually aligning it to a 16-byte boundary and, as the code you've 
posted seems to be setting up a stack frame, this is no problem, since the 
value of %esp will only decrease.

> what I can't get is use of doing this. Could somebody tell me the
> significance of doing this.
>
>
>
> Detailed code:
>
>         pushl   %ebp
>         movl    $16, %edx
>         movl    %esp, %ebp
>         subl    $8, %esp
>         andl    $-16, %esp
>         movl    %edx, 4(%esp)
>
>
> TIA




More information about the Gcc-help mailing list