Xref: utzoo comp.unix.questions:12319 comp.unix.wizards:15118 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!zodiac!joyce!cslb!porthos!aida From: aida@porthos.csl.sri.com (Hitoshi Aida) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: Using sigvec & sigcontext Message-ID: <9358@cslb.CSL.SRI.COM> Date: 20 Mar 89 20:50:40 GMT References: <331@h.cs.wvu.wvnet.edu> Sender: usenet@cslb.CSL.SRI.COM Reply-To: aida@csl.sri.com (Hitoshi Aida) Organization: Computer Science Lab, SRI International Lines: 25 In article <331@h.cs.wvu.wvnet.edu> dymm@b.cs.wvu.wvnet.edu (David Dymm) writes: >So how do I use "scp"??? > >Can I use it to explicitly restore the context to return where I >was before the signal? In general, no. You should do a simulated "return from the interrupt" to restore the context. It includes restoring registers (including stack pointer and program counter), switching stack (if running on sigstack) and restoring signal mask, all in an atomic operation. That can be done only by returning from signal handler. You can more or less simulate it using assemby code, but some race condition cannot be avoidable. >If so, then I should be able to store it somewhere for later use, >then use it at some time in the future to go back to where I was >before the signal occurred. Does this make sense? No. The sigcontext points to a position in the stack which will no longer available after returning from the signal handler. You can use it only within the signal handler. At least you can modify the signal mask, program couner and status register field of the sigcontext, and they will take effect upon return from the signal handler. -------- Hitoshi AIDA (aida@csl.sri.com) Computer Science Laboratory, SRI International