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.
On Sun, Jul 15, 2012 at 10:28 AM, 王哲 <wangzhe5004@xxxxxxxxx> wrote:
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
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Regards,
Peter Teoh
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies