int 80, i think, is hardly used nowadays:<div><br></div><div><a href="http://wiki.osdev.org/System_Calls">http://wiki.osdev.org/System_Calls</a> </div><div><a href="http://articles.manugarg.com/systemcallinlinux2_6.html">http://articles.manugarg.com/systemcallinlinux2_6.html</a>
</div><div><a href="http://semipublic.comp-arch.net/wiki/SYSENTER/SYSEXIT_vs._SYSCALL/SYSRET">http://semipublic.comp-arch.net/wiki/SYSENTER/SYSEXIT_vs._SYSCALL/SYSRET</a>
</div><div><br></div><div>and even for SYSENTER instruction, it will not be compiled into your program, but exists inside some external libraries, unless u compile it as static.</div><div><br></div><div><div class="gmail_quote">
On Sun, Jul 15, 2012 at 10:28 AM, 王哲 <span dir="ltr"><<a href="mailto:wangzhe5004@gmail.com" target="_blank">wangzhe5004@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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>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>disassembling it:(</span><span> objdump -d a.out</span><span>)</span><br>
<span>...<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>disassembling?<br>
<br>any advice will be help!<br></span><span>thanks in advance!<br>wanny<br><br></span>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh<br>
</div>