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"
);
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to