Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!wuarchive!wugate!uunet!ginosko!husc6!rice!sun-spots-request From: hugh%chook%augean.OZ@uunet.uu.net (Hugh Garsden) Newsgroups: comp.sys.sun Subject: SPARC LWP Context Switching and Register Windows Keywords: Windows Message-ID: <354@brazos.Rice.edu> Date: 20 Jul 89 03:49:21 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 44 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 82, message 9 of 9 A few weeks ago there was some discussion about implementing light-weight processes (LWP's) on RISC machines. In particular, I have a routine for implementing context switching between LWP's on a SPARC machine, a SUN 4/280 running SunOS (thanks to Zalman Stern who posted some routines on which I have based this one). The routine goes like this - save register window flush all active windows (of LWP) to the stack save other global registers switch to a new stack load globals restore register window jump to a new thread Flushing the register windows does 2 important things - (1) saves context of out-going LWP on the stack (2) invalidates all previous windows so that when the incoming LWP executes a restore, the kernel restores the window from the stack, thus loading new context (at least I think this is what happens) To flush the register windows I execute this SPARC trap instruction - ta ST_FLUSH_WINDOWS All of this is working fine, but it is inefficient, because there are cases when the suspended LWP is never going to be restarted, so I don't always have to save context. What I want is this - a trap routine similar to ST_FLUSH_WINDOWS that gives me (2) above, but NOT (1). I know that there is a trap called CLEAN_WINDOWS, but this doesn't seem to give me what I want. Something else that I would like to know, where in the SunOS manuals is there any documentation (and I mean DETAILS) about SunOS software traps? Hugh Garsden Dept. of Computer Science University of Adelaide G.P.O. Box 498 Adelaide 5001 Australia hugh@chook.ua.oz.au