Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!sun-spots-request From: sanzgiri@flamingo.metaphor.com Newsgroups: comp.sys.sun Subject: Context switching on SPARC Keywords: Miscellaneous Message-ID: <10201@brazos.Rice.edu> Date: 24 Jul 90 18:43:28 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 23 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 9, Issue 277, message 16 Originator: spots@titan.rice.edu I'd appreciate help on either or both of the following 2 related questions: (both about context switching - within a process - on the SPARC) 1) I'd like to write a piece of code that "fakes" a setjmp call from a previously non-existent context. I want to do this so that the corresponding longjmp call will branch to a given function pointer and use a given pointer as its stack pointer. Doing the "obvious thing" leads to segmentation violations, bus errors etc. 2) How does one write a piece of assembly code that will restore an arbitrary register state? Again, doing the "obvious thing" leads to illegal instruction errors or similar junk. I am pretty sure the above problems are related to the "windowing" architecture of the processor - wherein you must not only restore the given window but its predecessors as well while remaining compatible with the overflow-underflow processing - in order to switch contexts. But I am unable to get any meaningful help from either of the SPARC architecture manual or the Sun-4 assembly language reference manual. Enquiries with Sun haven't turned anything up yet. E-mail would be great. (I'll summarise). Posted replies OK too.