Re: one simple question
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$0xfff0,%esp Hmmm, when I compile the simplest possible C file: --- int main (int argc, char *argv[]) { return 0; } I get this: .file test1.c .version01.01 gcc2_compiled.: .text .p2align 2,0x90 .globl main .typemain,@function main: pushl %ebp movl %esp,%ebp xorl %eax,%eax jmp .L2 .p2align 2,0x90 .L2: leave ret .Lfe1: .sizemain,.Lfe1-main .ident GCC: (GNU) c 2.95.4 20020320 [FreeBSD] No such thing as: and$0xfff0,%esp Are you using gcc 3.3.x? Anyway, this code looks like it would align the stack the stack pointer... best regards Chungwei -- Cordula's Web. http://www.cordula.ws/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: one simple question
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 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. best regards, Chungwei --- Cordula's Web [EMAIL PROTECTED] wrote: 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$0xfff0,%esp Hmmm, when I compile the simplest possible C file: --- int main (int argc, char *argv[]) { return 0; } I get this: .file test1.c .version01.01 gcc2_compiled.: .text .p2align 2,0x90 .globl main .typemain,@function main: pushl %ebp movl %esp,%ebp xorl %eax,%eax jmp .L2 .p2align 2,0x90 .L2: leave ret .Lfe1: .sizemain,.Lfe1-main .ident GCC: (GNU) c 2.95.4 20020320 [FreeBSD] No such thing as: and$0xfff0,%esp Are you using gcc 3.3.x? Anyway, this code looks like it would align the stack the stack pointer... best regards Chungwei -- Cordula's Web. http://www.cordula.ws/ = bear ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: one simple question
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$0xfff0,%esp gcc2_compiled.: .text .p2align 2,0x90 .globl main .typemain,@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/ ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
one simple question
Hello.. I have a simple question, but I am not sure what the answer is. If anyone can possibly help me, it is really appreciated. 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$0xfff0,%esp best regards Chungwei ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: one simple question
On Wed, 3 Mar 2004 18:13:43 + chungwei Hsiung [EMAIL PROTECTED] wrote: Hello.. I have a simple question, but I am not sure what the answer is. If anyone can possibly help me, it is really appreciated. 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$0xfff0,%esp best regards Chungwei Hi Chungwei, I believe that instruction is used to align the stack pointer to a 16-byte boundary, for efficiency. However, this is just a guess, based on some discussions I've seen. I don't know for certain. You may have better luck asking on [EMAIL PROTECTED] -Chris ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]