one simple question

Cordula's Web cpghost at cordula.ws
Thu Mar 4 08:57:57 PST 2004


> > > I compile a test C file. I notice there are a few lines at the
> > > beginning of the assembly code. I want to know what it means, but
> > > can't figure out one of them. Can anyone tell me what the
> > > following line does please?
> > > 
> > > and    $0xfffffff0,%esp
> >
> > gcc2_compiled.:
> > .text
> > 	.p2align 2,0x90
> > .globl main
> > 		.type		 main, at function
> > main:
> > 	pushl %ebp
> > 	movl %esp,%ebp
> > 	xorl %eax,%eax
> > 	jmp .L2
> > 	.p2align 2,0x90
> > .L2:
> 
> thank you very much for the reply
> yes and I am using gcc 3.2.2
> if you "gdb" the executable and "disassemble main"
> you will see the line like that
> but if you use gcc -S something.s something.c
> it won't appear in the assembly code

Ah, so it's being introduced by the assembler, not the compiler.
That is perhaps the effect of alignement instructions like

> > .text
> > 	.p2align 2,0x90

this and similar defaults.

> and I google around, I think it does the alignment for optimization
> purpose, in that case the memory access will be faster according to the
> article.

That may very well be the case. Considering that a cache line is also
a few words worth, it may be sensible to start with an aligned stack
frame too.

> best regards,
> Chungwei

-- 
Cordula's Web. http://www.cordula.ws/



More information about the freebsd-questions mailing list