Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jan 2002 12:18:34 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Dan Eischen <eischen@vigrid.com>
Cc:        <arch@freebsd.org>
Subject:   Re: Request for review: getcontext, setcontext, etc
Message-ID:  <Pine.BSF.4.33.0201071214400.94490-100000@herring.nlsystems.com>
In-Reply-To: <3C37E559.B011DF29@vigrid.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 6 Jan 2002, Dan Eischen wrote:

> I've got getcontext, setcontext, makecontext, and swapcontext
> implemented and would like to add them to libc.  I've made the
> patch available at:
>
>   http://people.freebsd.org/~deischen/ucontext/uc-libc-sys.diffs
>
> These are library level versions of these functions.  Solaris
> has getcontext and setcontext as system calls.  My intent is
> to replace libc_r's use of setjmp/longjmp and jmp_buf munging
> with these functions, so I don't want them as system calls.
> I also want to use them with the KSE-enabled threads library.
> Is there a reason that getcontext and setcontext need to be
> system calls?
>
> For those not familiar with these functions, see:
>
>   http://www.opengroup.org/onlinepubs/007908799/xsh/ucontext.h.html

As far as I can see from reading the code, in makecontext you pass the
value of argc as well as #argc arguments to the new context. The linux
version of makecontext (at least for ia64) doesn't appear to do this - it
just copies #argc longs worth of arguments over to the new stack.

The other difference with the linux version is that it uses va_arg(ap,
long) to read the arguments instead of va_arg(ap, int) which makes it
possible to pass 64bit arguments. The SUSv2 spec document does seem to
suggest that the arguments must be integers which makes the linux
behaviour wrong although its probably more useful than truncating
everything to 32bits.

-- 
Doug Rabson				Mail:  dfr@nlsystems.com
					Phone: +44 20 8348 6160



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.33.0201071214400.94490-100000>