Problems with FreeBSD assembly

Charlie Kester corky1951 at
Thu Nov 12 01:45:19 UTC 2009

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

More information about the freebsd-questions mailing list