9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] amd64 support in p9p?
@ 2006-03-02 23:15 plan9
  2006-03-02 23:23 ` Devon H. O'Dell
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: plan9 @ 2006-03-02 23:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi all,
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.

Best regards,

Matthias



----- End forwarded message -----


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] amd64 support in p9p?
  2006-03-02 23:15 [9fans] amd64 support in p9p? plan9
@ 2006-03-02 23:23 ` Devon H. O'Dell
  2006-03-02 23:27 ` Russ Cox
  2006-03-02 23:56 ` Tim Wiess
  2 siblings, 0 replies; 5+ messages in thread
From: Devon H. O'Dell @ 2006-03-02 23:23 UTC (permalink / raw)
  To: matthiasb, Fans of the OS Plan 9 from Bell Labs

I have some / all of it working on FreeBSD/amd64. I'll try to get a
set of patches created soon. I don't know how well this would work
with OpenBSD.

--Devon

2006/3/2, plan9@weggla.franken.de <plan9@weggla.franken.de>:
> Hi all,
> 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.
>
> Best regards,
>
> Matthias
>
>
>
> ----- End forwarded message -----
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] amd64 support in p9p?
  2006-03-02 23:15 [9fans] amd64 support in p9p? plan9
  2006-03-02 23:23 ` Devon H. O'Dell
@ 2006-03-02 23:27 ` Russ Cox
  2006-03-02 23:51   ` Ronald G Minnich
  2006-03-02 23:56 ` Tim Wiess
  2 siblings, 1 reply; 5+ messages in thread
From: Russ Cox @ 2006-03-02 23:27 UTC (permalink / raw)
  To: matthiasb, 9fans

> 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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] amd64 support in p9p?
  2006-03-02 23:27 ` Russ Cox
@ 2006-03-02 23:51   ` Ronald G Minnich
  0 siblings, 0 replies; 5+ messages in thread
From: Ronald G Minnich @ 2006-03-02 23:51 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs; +Cc: matthiasb

Russ Cox wrote:

> 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.


Also, I did not realize this when I did armv, but you needn't worry
about saving/restoring the signal mask. That really makes like easy --
no syscall needed.

ron


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] amd64 support in p9p?
  2006-03-02 23:15 [9fans] amd64 support in p9p? plan9
  2006-03-02 23:23 ` Devon H. O'Dell
  2006-03-02 23:27 ` Russ Cox
@ 2006-03-02 23:56 ` Tim Wiess
  2 siblings, 0 replies; 5+ messages in thread
From: Tim Wiess @ 2006-03-02 23:56 UTC (permalink / raw)
  To: matthiasb; +Cc: 9fans

on OpenBSD you'll need to copy over rfork_thread and roll
your own {get,set}context functions. however as Russ mentioned,
you don't really need to use OpenBSD's ucontext_t (sigcontext)
for this.

tim


> Hi all,
> 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.
>
> Best regards,
>
> Matthias



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-03-02 23:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-02 23:15 [9fans] amd64 support in p9p? plan9
2006-03-02 23:23 ` Devon H. O'Dell
2006-03-02 23:27 ` Russ Cox
2006-03-02 23:51   ` Ronald G Minnich
2006-03-02 23:56 ` Tim Wiess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).