SPARC LWP Context Switching and Register Windows
Hugh Garsden
hugh%chook%augean.OZ at uunet.uu.net
Thu Jul 20 13:49:21 AEST 1989
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 at chook.ua.oz.au
More information about the Comp.sys.sun
mailing list