Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Nov 2009 17:45:15 -0800
From:      Charlie Kester <corky1951@comcast.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: Problems with FreeBSD assembly
Message-ID:  <20091112014515.GB21567@comcast.net>
In-Reply-To: <20091112013240.GA21567@comcast.net>
References:  <4AFB13D9.9050507@gmail.com> <20091112013240.GA21567@comcast.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed 11 Nov 2009 at 17:32:41 PST Charlie Kester wrote:

One more thing:

>Notice that the system call number (or any other dword) should also be
>pushed onto the stack before the int 80h.

The reason for this is given at the top of the page:

    although the kernel is accessed using int 80h, it is assumed the
    program will call a function that issues int 80h, rather than issuing
    int 80h directly.

So the extra dword pushed onto the stack takes the place of the return
address from the function the kernel expects to have been called.   

And since you're not actually using as a return address, it doesn't
matter what value it actually has.  The kernel doesn't use it for
anything; it just expects it to be there in a properly arranged stack
frame.




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