Implementing TLS: step 1
David Xu
davidxu at freebsd.org
Thu Jun 19 21:40:45 PDT 2003
----- Original Message -----
From: "Daniel Eischen" <eischen at vigrid.com>
To: "Marcel Moolenaar" <marcel at xcllnt.net>
Cc: <threads at freebsd.org>; <davidxu at freebsd.org>; "Julian Elischer" <julian at elischer.org>
Sent: Friday, June 20, 2003 11:57 AM
Subject: Re: Implementing TLS: step 1
> On Thu, 19 Jun 2003, Marcel Moolenaar wrote:
>
> > On Thu, Jun 19, 2003 at 11:39:42PM -0400, Daniel Eischen wrote:
> > >
> > > > Q2: Given that libthr has been ported to ia64, what needs to be done
> > > > to port libkse to ia64 (roughtly)?
> > >
> > > libpthread/arch/i386/include/ksd.h:
> > > libpthread/arch/i386/include/atomic_ops.h
> > > libpthread/arch/i386/include/pthread_md.h
> > > libpthread/arch/i386/i386:
> >
> > No kernel code? Hmmm, looks like something that's worth giving a
>
> I'm not too sure about the kernel code. If you have KSEs
> working for libthr, then I assume there is very little extra
> kernel code needed. You do need to have get_mcontext() and
> set_mcontext() implemented in machdep.c, though. It looks
> like you do (although nothing is done with clear_ret in
> get_mcontext()).
>
> David, Julian, care to comment?
>
Yes, we don't have so much MD code in kernel.
MD functions used by kse kernel code:
cpu_thread_setup - not kse related, all process need it,
should already work.
cpu_set_upcall_kse - kse code, set userland return address
to upcall func entry, and push its
mailbox parameter on user stack.
cpu_thread_clean - not kse related, should already work.
cpu_set_upcall - not kse related, make a new thread's
initial context so cpu_switch() can load it,
it may inherits original thread's pcb and
userland context (syscall trap frame).
I think it might already work on ia64.
get_mcontext - used by kse code, but is general function,
and any application can use it, not just kse
app.
set_mcontext - same as above
Planed MD function:
void
thread_siginfo(int sig, u_long code, siginfo_t *info);
Construct a siginfo structure based on current user
trap frame and parameter sig and MD fault code, fill fault
address in this structure. The function is used by kse to
deliver sync signal to userland, sample implement on ia32
is :
/*
* Build siginfo_t for SA thread
*/
void
thread_siginfo(int sig, u_long code, siginfo_t *si)
{
struct proc *p;
struct thread *td;
td = curthread;
p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
bzero(si, sizeof(*si));
si->si_signo = sig;
si->si_code = code;
si->si_addr = (void *)td->td_frame->tf_err;
}
> > shot. If we have libkse on ia64, we can more easily work on the
> > issues related to TLS...
>
> --
> Dan Eischen
>
> _______________________________________________
> freebsd-threads at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe at freebsd.org"
>
More information about the freebsd-threads
mailing list