purpose of stackgap_init, stackgap_alloc and friends ?

Matthew Dillon dillon at apollo.backplane.com
Thu Jan 8 10:44:55 PST 2004


:Just curious as to the purpose/usage of stackgap_init/alloc and friends in
:the kernel in general and in the linuxulator in particular. 
:
:A short answer is okay :)
:
:Cheers,
:
:Andrew.
 
    The stackgap code exists in order for the linux (and other) emulation
    code to convert their emulation calls into normal system calls.

    Normal system calls expect arguments to be passed from userspace and do
    not accept kernel addresses (otherwise a user program could pass a kernel
    address to a system call).

    However, in DragonFly, a great deal of work has been done to separate out
    these front-end system call requirements from the actual meat of the system
    call.  The meat of many system calls is now in kern_<blah>, and most of the
    linux emulation code has been converted to directly call the kern_<blah>
    routines instead of the <blah> routines.  The kern_<blah> routines do not
    need userland addresses to be passed to them, and thus do not need any of
    that stackgap nonsenses.

    The goal is to convert all system calls into this two-level separation so
    as to be able to completely get rid of all the stackgap junk.  In our
    list archives we call this the 'syscall separation code'

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Kernel mailing list