From owner-freebsd-java Thu Sep 14 1:45: 9 2000 Delivered-To: freebsd-java@freebsd.org Received: from flux.ptc.spbu.ru (flux.ptc.spbu.ru [195.19.225.195]) by hub.freebsd.org (Postfix) with ESMTP id F41B337B422 for ; Thu, 14 Sep 2000 01:45:04 -0700 (PDT) Received: from snark.ptc.spbu.ru (snark.ptc.spbu.ru [195.19.225.131]) by flux.ptc.spbu.ru (8.9.3/8.9.3/cf-1.0.rbl) with ESMTP id MAA06089 for ; Thu, 14 Sep 2000 12:44:57 +0400 (MSD) Received: (from uwe@localhost) by snark.ptc.spbu.ru (8.8.8+Sun/8.8.8) id MAA24754 for freebsd-java@FreeBSD.ORG; Thu, 14 Sep 2000 12:44:57 +0400 (MSD) Date: Thu, 14 Sep 2000 12:44:56 +0400 From: "Valeriy E. Ushakov" To: FreeBSD Java Mailinglist Subject: Re: Threads questions Message-ID: <20000914124456.A24487@snark.ptc.spbu.ru> Mail-Followup-To: FreeBSD Java Mailinglist References: <200009122153.PAA25042@nomad.yogotech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.3i In-Reply-To: ; from "Chuck Robey" on Wed, Sep 13, 2000 at 22:15:15 Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Wed, Sep 13, 2000 at 22:15:15 -0400, Chuck Robey wrote: > > If the OS supports kernel threads, then these provide the get/setcontext > > functions for this, but since none of the *BSD's support them, we don't > > have the library functions. > > I just did some porting of a homemade threading package from FreeBSD to > Solaris, where they *do* have ucontext.h, and the {get|set|make}context > calls. From my architectural reading, that's because (on Sparc > processors) getting the stack & registers doesn't get you the full > execution context (you need registers from windows that are currently > invisible, since return addresses are kept in registers, not on the > stack). It's easy to flush register windows to stack: asm volatile("t %0" : : "n" (T_FLUSHWIN)); and signal trampoline code for BSD/sparc (written by Chris Torek for his original port and still here) has a clever hack to compensate for lack of ucontext somewhat - in the trampoline it saves g's to l's of the trampoline window - and thus in the signal handler you can access all the 32 registers (at the time of signal) by peeking at the two frames below the signal handler frame. SY, Uwe -- uwe@ptc.spbu.ru | Zu Grunde kommen http://www.ptc.spbu.ru/~uwe/ | Ist zu Grunde gehen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message