Hi all:<br><br> i write two simple program to invoke syscall getpid.<br><br>the first program (getpid1.c) is as followed:<br>#include <stdio.h><br>#include <unistd.h><br><br>int main(void)<br>{<br> unsigned long value = 0;<br>
__asm__("int $0x80":"=a"(value):"0"(20));<br> return 0;<br>}<br><br>and <span class="keyword">use objdump -d a.out disassembling it :<br>...<br> 80483c2: b8 14 00 00 00 mov $0x14,%eax<br>
80483c7: 89 c3 mov %eax,%ebx<br> 80483c9: 89 d8 mov %ebx,%eax<br> 80483cb: cd 80 int $0x80<br>...<br><br><br>and the second program:<br><br>#include <stdio.h><br>
#include <unistd.h><br><br>int main(void)<br>{<br> unsigned long value = 0;<br> value = getpid();<br> return 0;<br>}<br><br>and </span><span class="keyword">disassembling it:(</span><span class="keyword"> objdump -d a.out</span><span class="keyword">)</span><br>
<span class="keyword">...<br>08048300 <getpid@plt>:<br> 8048300: ff 25 00 a0 04 08 jmp *0x804a000<br> 8048306: 68 00 00 00 00 push $0x0<br> 804830b: e9 e0 ff ff ff jmp 80482f0 <_init+0x3c><br>
...<br>080483e4 <main>:<br> 80483e4: 55 push %ebp<br> 80483e5: 89 e5 mov %esp,%ebp<br> 80483e7: 83 e4 f0 and $0xfffffff0,%esp<br>
80483ea: 83 ec 10 sub $0x10,%esp<br> 80483ed: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)<br> 80483f4: 00 <br> 80483f5: e8 06 ff ff ff call 8048300 <getpid@plt><br>
80483fa: 89 44 24 0c mov %eax,0xc(%esp)<br> 80483fe: b8 00 00 00 00 mov $0x0,%eax<br>...<br><br>question:<br> why i can't find the "movl $0x14,%eax" "int 0x80" in the second program after </span><span class="keyword">disassembling?<br>
<br>any advice will be help!<br></span><span class="keyword">thanks in advance!<br>wanny<br><br></span>