Request for swapcontext and getcontext to be ported to our libc

Matthew Dillon dillon at apollo.backplane.com
Fri Jan 12 19:15:58 PST 2007


:However, I recall it being mentioned that the proliferation of syscalls is
:unneccessary, so a libc implementation would keep the kernel lean.  The
:reason we need curthread is to get access to the frame construct, which is
:neccessary to save the context.
:
:Regards,
:--
:Matt Emmerton

    Nah.  The frame is just made up of entirely user-accessible registers.
    The only thing that is kernel-only is the signal mask (and one can make
    a system call to get it).  The FP state can be controlled in userland 
    too.

    The really interesting thing about it is that if you do it in userland
    you don't have to save or restore the call-used registers.

    I think the FreeBSD folks did these as system calls because they believe
    the context switching routines may have to do other kernel-only things
    in the future.  That isn't a bad argument.

    On the otherhand, if one is talking about operating in virtualized
    environments (any sort of virtualization), having to do a system call
    at all is very, very expensive.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Users mailing list