A newbish question
From: Daniel Bruce (spamtrap_at_crayne.org)
Date: 03/16/05
- Next message: Thomas Pototschnig: "SSE instruction CVTPI2PS on Athlon XP does nothing"
- Previous message: Robert Redelmeier: "Re: Speed of SSE2 and MMX on image processing."
- Next in thread: Matt: "Re: A newbish question"
- Reply: Matt: "Re: A newbish question"
- Reply: Grumble: "Re: A newbish question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 16 Mar 2005 18:40:24 +0000 (UTC)
I am really not sure where to post this, but it seems asm-inclined, so I
posted it here. If I have posted it in the wrong place, feel free to
redirect me. What I was wondering about was some(to me) weird assembly
output I see when I compile a program in gcc(version 3.4.3 if it matters),
the program doesn't seem to matter, as it's the prelude I'm wondering
about.
>>From what I have read, the prelude should look like this:
---------- asm start ---------
push %ebp
mov %esp, %ebp
sub [number], %esp
----------- asm end ----------
When I open the program in gdb, and disassemble main, however, what I get
is this:
----- disassembly start ------
0x8048204 <main>: push %ebp
0x8048205 <main+1>: mov %esp,%ebp
0x8048207 <main+3>: sub $0x8,%esp
0x804820a <main+6>: and $0xfffffff0,%esp
0x804820d <main+9>: mov $0x0,%eax
0x8048212 <main+14>: add $0xf,%eax
0x8048215 <main+17>: add $0xf,%eax
0x8048218 <main+20>: shr $0x4,%eax
0x804821b <main+23>: shl $0x4,%eax
0x804821e <main+26>: sub %eax,%esp
------ disassembly end -------
What I was wondering was, why does it do this, and what does it really do?
Everything, except the number in the third line, seems to be constant no
matter what program I compile. Also, it seems that when calling functions,
it doesn't push arguments, but rather movs to various offsets of %esp.
This is on linux with kernel version 2.6.8, on an athlon XP processor.
I'm really quite the n00b when it comes to asm and such... and this has
gotten me confused when I'm trying to read texts, and the output I get
differ so much from what the texts say...
Again, feel free to yell at me if this is in the wrong place =)
- Next message: Thomas Pototschnig: "SSE instruction CVTPI2PS on Athlon XP does nothing"
- Previous message: Robert Redelmeier: "Re: Speed of SSE2 and MMX on image processing."
- Next in thread: Matt: "Re: A newbish question"
- Reply: Matt: "Re: A newbish question"
- Reply: Grumble: "Re: A newbish question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|