From owner-freebsd-sparc64@FreeBSD.ORG Sun Oct 5 13:58:34 2003 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1ADFC16A4B3 for ; Sun, 5 Oct 2003 13:58:34 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3FF5B43FBD for ; Sun, 5 Oct 2003 13:58:31 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id h95KwUgG006066; Sun, 5 Oct 2003 16:58:30 -0400 (EDT) Date: Sun, 5 Oct 2003 16:58:30 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Jake Burkholder In-Reply-To: <200310051625.04587.jake@locore.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: sparc64@freebsd.org Subject: Re: Review for libpthread support X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2003 20:58:34 -0000 On Sun, 5 Oct 2003, Jake Burkholder wrote: > On Sunday 05 October 2003 13:46, Daniel Eischen wrote: > > On Sun, 5 Oct 2003, Jake Burkholder wrote: > > > On Sunday 05 October 2003 12:21, Daniel Eischen wrote: > > > > Hi guys, > > > > > > > > I have a patch for adding libpthread support for sparc64. It's jake's > > > > patch, with a few mods by myself. I'd like for some folks to look it > > > > over. I haven't tested it; I need a couple of questions answered > > > > first so I can fill in a missing piece. > > > > > > > > o Can someone look at the end of __thr_getcontext (line 524 of > > > > the patch)? I need to test %i2 for NULL and branch to 1 if true. > > > > > > > > +/* bz %i2, 1f */ > > > > + stx %i1, [%i2] > > > > +1: ldx [%sp], %i1 /* restore %i1 */ > > > > + ldx [%sp + 8], %i2 /* restore %i2 */ > > > > > > brz. Beware of delay slots, the instruction after a branch is executed > > > before the branch is taken. > > > > OK. > > > > > Use the locals as temporaries instead of using the stack, eg > > > > What if a thread gets interrupted while using locals? _thr_setcontext() > > is suppose to be able to resume a thread that was interrupted anywhere. > > What if some library function used locals, thread T1 had a page > > fault, and it's context was exported back to libpthread? The > > library may run other threads before resuming T1 again. > > They're part of T1's context. They'll get saved on T1's stack on entry to the > kernel to handle the page fault. Oh, so they're not stored in the mcontext, but when resumed they'll be popped off the stack. Thanks, I'll use the local's then. -- Dan Eischen