From owner-freebsd-sparc64@FreeBSD.ORG Sun Oct 5 10:16:09 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 6511016A4B3; Sun, 5 Oct 2003 10:16:09 -0700 (PDT) Received: from k6.locore.ca (k6.locore.ca [198.96.117.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id B191743FF2; Sun, 5 Oct 2003 10:16:05 -0700 (PDT) (envelope-from jake@locore.ca) Received: from k7.locore.ca (k7.locore.ca [192.168.0.2]) by k6.locore.ca (Postfix) with ESMTP id 1F5351BA53; Sun, 5 Oct 2003 13:15:20 -0400 (EDT) From: Jake Burkholder To: deischen@freebsd.org Date: Sun, 5 Oct 2003 13:19:29 -0400 User-Agent: KMail/1.5.4 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310051319.29901.jake@locore.ca> 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 17:16:09 -0000 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. Use the locals as temporaries instead of using the stack, eg mov %i0, %l0 mov %i1, %l1 mov %i2, %l2 ... ldx [%l0 + MC_TPC], %l4 ldx [%l0 + MC_TNPC], %l3 brz %l1, 1f nop stx %l2, [%l1] 1: jmpl %l3, %g0 return %l4 Jake > > What's the magic instruction I should use? > > o Can someone look over the context saving/restoring in general? > I have a feeling there should be more to __thr_getcontext than > there is. > > The patch is at: > > http://people.freebsd.org/~deischen/kse/libpthread_sparc64.diffs > > I'm not subscribed to this list, so please keep me on the CC. > > Thanks,