I was looking at some ASM code for some of my programs using the 'gcc -S' option to generate it and I noticed a few things that I have NO IDEA what they do, why they are there and if they have any effect on my programs.
Here is a list:
Any help would be appreciated, im not too concerned about the last two commands but more or less the aligns, what are they, and are they important, I would imagine they are relatively significant because they are there to begin with.Code:;at the begining .text .align 4 .p2align 2 ;what's this?! ;and I used to know what these were but I forgot leave ;I think this does popl %ebp to get the original base pointer ret ;and does this jump to where the program was called or after it or what, I forgot...
EDIT:
And another question in ASM:
I can't seem to figure out why I continually get a seg-fault for this prog:
Any explanations of just how things work at all could help, thanks.Code:.lor: .string "Hello, World!\n" .text .align 4 .globl main main: pushl %ebp movl %esp, %ebp movl $10, %ebx LOOP: cmpl $0, %ebx jne NE jmp GO NE: pushl $.lor call printf popl %eax decl %ebx jmp LOOP GO: movl $0, %eax leave ret
-LC



LinkBack URL
About LinkBacks


