Calling syscalls through int 0x80 documentation?

Yuri yuri at rawbw.com
Thu Oct 18 12:38:10 PDT 2007


By experimenting I found the working version now.
I still don't understand why first element on stack while going into 'int 0x80'
should be stack pointer.

asm(
".text\n"
"mysyscall:\n"
"       movl    %esp,%eax\n"
"       push    28(%eax)\n"
"       push    24(%eax)\n"
"       push    20(%eax)\n"
"       push    16(%eax)\n"
"       push    12(%eax)\n"
"       push    8(%eax)\n"
"       push    %eax\n"
"       movl    4(%eax), %eax\n"
"       int     $0x80\n"
"       pop     %ecx\n"
"       pop     %ecx\n"
"       pop     %ecx\n"
"       pop     %ecx\n"
"       pop     %ecx\n"
"       pop     %ecx\n"
"       pop     %ecx\n"
"       ret\n"
".previous\n"
);


More information about the freebsd-questions mailing list