All of lore.kernel.org
 help / color / mirror / Atom feed
From: wangzhe5004@gmail.com (王哲)
To: kernelnewbies@lists.kernelnewbies.org
Subject: [RFC]confusion about syscall
Date: Sun, 15 Jul 2012 10:28:45 +0800	[thread overview]
Message-ID: <CAJrRU3WEitdr+376gsT=JP_BOpQvv_+JoUAS8Lxd6J1gG9-p0g@mail.gmail.com> (raw)

Hi all:

 i write two simple program to invoke syscall getpid.

the first  program (getpid1.c) is as followed:
#include <stdio.h>
#include <unistd.h>

int main(void)
{
    unsigned long value = 0;
    __asm__("int $0x80":"=a"(value):"0"(20));
    return 0;
}

and use objdump -d a.out disassembling it :
...
 80483c2:    b8 14 00 00 00       mov    $0x14,%eax
 80483c7:    89 c3                    mov    %eax,%ebx
 80483c9:    89 d8                    mov    %ebx,%eax
 80483cb:    cd 80                    int    $0x80
...


and the second program:

#include <stdio.h>
#include <unistd.h>

int main(void)
{
    unsigned long value = 0;
    value = getpid();
    return 0;
}

and disassembling it:( objdump -d a.out)
...
08048300 <getpid@plt>:
 8048300:    ff 25 00 a0 04 08        jmp    *0x804a000
 8048306:    68 00 00 00 00           push   $0x0
 804830b:    e9 e0 ff ff ff           jmp    80482f0 <_init+0x3c>
...
080483e4 <main>:
 80483e4:    55                                      push   %ebp
 80483e5:    89 e5                                  mov    %esp,%ebp
 80483e7:    83 e4 f0                              and    $0xfffffff0,%esp
 80483ea:    83 ec 10                             sub    $0x10,%esp
 80483ed:    c7 44 24 0c 00 00 00           movl   $0x0,0xc(%esp)
 80483f4:    00
 80483f5:    e8 06 ff ff ff                         call   8048300
<getpid@plt>
 80483fa:    89 44 24 0c                         mov    %eax,0xc(%esp)
 80483fe:    b8 00 00 00 00                    mov    $0x0,%eax
...

question:
      why i can't find the "movl $0x14,%eax"  "int 0x80" in the second
program after disassembling?

any advice will be help!
thanks in advance!
wanny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120715/d249e4c1/attachment.html 

             reply	other threads:[~2012-07-15  2:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-15  2:28 王哲 [this message]
2012-07-15  2:52 ` [RFC]confusion about syscall Peter Teoh
2012-07-15  5:49 ` Mulyadi Santosa
2012-07-15  9:18   ` 王哲
2012-07-15 17:42     ` Mulyadi Santosa
2012-07-15 10:46   ` Peter Teoh
2012-07-15 12:36     ` 王哲
2012-07-15 15:24       ` Peter Teoh
2012-07-15 15:33         ` Peter Teoh

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='CAJrRU3WEitdr+376gsT=JP_BOpQvv_+JoUAS8Lxd6J1gG9-p0g@mail.gmail.com' \
    --to=wangzhe5004@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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.