> is there anybody interested in helping to port the
> plan9 from user space to amd64/x86_64?
> The most platform dependend code seems to be the libthread
> stuff. On OpenBSD-amd64 I can borrow an assembler version of
> rfork_thread from the OpenBSD librthread and can improvise
> the _tas function. The get/setmcontext pose a problem because
> I do not know if struct ucontext must really be exactly the same
> as struct sigcontext.

Which operating system are we talking about?

If the operating system provides:
        - a pthreads that doesn't use the high bits of the stack pointer
           as the per-pthread register
        - working makecontext, getcontext, setcontext

then all you have to write is a _tas function, and on the x86_64
you should just use the 386 one unmodified (see Linux-386-asm.s)

If the OS does not provide a working makecontext, getcontext,
and setcontext, then you need to write those too.  They needn't
follow any structures laid down by the rest of the system.
They just have to match each other.  For example, power-ucontext.h
is just made up from scratch.  It just needs to be a register set and
match the assembly.

If the OS does not provide a pthreads with a real per-thread register
then you are in bigger trouble and have to provide an entire kernel
thread implementation.  I doubt very much you need to do this on
any x86-64.  The only people who made this mistake seem to be
the early implementers of 386 thread libraries (these broken
libraries are still in use on NetBSD, OpenBSD, and Linux pre-NPTL),
and that's necessitated by the small number of registers.  On x86-64,
there's no reason to make that mistake.

In short, you probably don't need to write rfork_thread, you might need
to write getcontext/setcontext, and you can just steal _tas.

Russ

Reply via email to