All of lore.kernel.org
 help / color / mirror / Atom feed
From: asmfreshmeat@gmx.de
To: linux-assembly@vger.kernel.org
Subject: GCC Optimization?
Date: Tue, 23 Nov 2004 01:26:34 +0100 (MET)	[thread overview]
Message-ID: <2462.1101169594@www25.gmx.net> (raw)

Hello,

where is one question I didnt found a good answer. 
When I'm disassembling the main function with gdb or objdump
I see always code like this:

0x08048354 <main+0>:    push   %ebp
0x08048355 <main+1>:    mov    %esp,%ebp
0x08048357 <main+3>:    sub    $0x8,%esp
0x0804835a <main+6>:    and    $0xfffffff0,%esp
0x0804835d <main+9>:    mov    $0x0,%eax
0x08048362 <main+14>:   sub    %eax,%esp

I understand what the first 3 lines are good for. Pushing the 
Basepointer, moving the Basepointer to the Stackpointer,
reserving 8 Bytes on the stack for variables.

But why do they use and .... I think and does only even %esp
so that the last 4 Bits are set to Zero. 
But if %esp was 0xcccccccc before it would now be 0xccccccc0
what happens to the 4 Bits from 0xccccccc0 to 0xcccccccc?
And what is this good for?

Second question:
What does mov $0x0,%eax? Why dont they use xor %eax and what is it good for?

Third question: 
What is sub %eax,%esp good for? We subtract 0 from esp... mmmhh... for what?

Best regards

-- 
Geschenkt: 3 Monate GMX ProMail + 3 Top-Spielfilme auf DVD
++ Jetzt kostenlos testen http://www.gmx.net/de/go/mail ++

             reply	other threads:[~2004-11-23  0:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-23  0:26 asmfreshmeat [this message]
2004-11-23  1:06 ` GCC Optimization? Brian Raiter
2004-11-23 16:43 ` Mateusz Marzantowicz
  -- strict thread matches above, loose matches on Subject: below --
2004-11-23  9:22 an0nym

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2462.1101169594@www25.gmx.net \
    --to=asmfreshmeat@gmx.de \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.