Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jun 2003 12:43:34 +0800
From:      "David Xu" <davidxu@freebsd.org>
To:        <deischen@freebsd.org>, "Marcel Moolenaar" <marcel@xcllnt.net>
Cc:        Julian Elischer <julian@elischer.org>
Subject:   Re: Implementing TLS: step 1
Message-ID:  <009b01c336e6$85045ee0$f001a8c0@davidw2k>
References:  <Pine.GSO.4.10.10306192348380.19237-100000@pcnet5.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help

----- Original Message -----=20
From: "Daniel Eischen" <eischen@vigrid.com>
To: "Marcel Moolenaar" <marcel@xcllnt.net>
Cc: <threads@freebsd.org>; <davidxu@freebsd.org>; "Julian Elischer" =
<julian@elischer.org>
Sent: Friday, June 20, 2003 11:57 AM
Subject: Re: Implementing TLS: step 1


> On Thu, 19 Jun 2003, Marcel Moolenaar wrote:
>=20
> > On Thu, Jun 19, 2003 at 11:39:42PM -0400, Daniel Eischen wrote:
> > >=20
> > > > Q2: Given that libthr has been ported to ia64, what needs to be =
done
> > > >     to port libkse to ia64 (roughtly)?
> > >=20
> > > libpthread/arch/i386/include/ksd.h:
> > > libpthread/arch/i386/include/atomic_ops.h
> > > libpthread/arch/i386/include/pthread_md.h
> > > libpthread/arch/i386/i386:
> >=20
> > No kernel code? Hmmm, looks like something that's worth giving a
>=20
> 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()).
>=20
> David, Julian, care to comment?
>=20

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=20
                     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=20
                     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 =3D curthread;
        p =3D td->td_proc;
        PROC_LOCK_ASSERT(p, MA_OWNED);

        bzero(si, sizeof(*si));
        si->si_signo =3D sig;
        si->si_code =3D code;
        si->si_addr =3D (void *)td->td_frame->tf_err;
}

> > shot. If we have libkse on ia64, we can more easily work on the
> > issues related to TLS...
>=20
> --=20
> Dan Eischen
>=20
> _______________________________________________
> freebsd-threads@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> To unsubscribe, send any mail to =
"freebsd-threads-unsubscribe@freebsd.org"
>=20



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?009b01c336e6$85045ee0$f001a8c0>