Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Oct 2007 12:38:06 -0700
From:      Yuri <yuri@rawbw.com>
To:        Derek Ragona <derek@computinginnovations.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Calling syscalls through int 0x80 documentation?
Message-ID:  <1192736286.4717b61e1dcc0@webmail.rawbw.com>
In-Reply-To: <6.0.0.22.2.20071018141850.02482e78@mail.computinginnovations.com>
References:  <1192731161.4717a21980065@webmail.rawbw.com> <6.0.0.22.2.20071018132410.02311ad8@mail.computinginnovations.com> <1192733243.4717aa3b1843f@webmail.rawbw.com> <6.0.0.22.2.20071018141850.02482e78@mail.computinginnovations.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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"
);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1192736286.4717b61e1dcc0>