tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RFC: setjmp/longjmp (and friends) for a new port



On Tue, 1 Sep 2009 15:05:45 +0200
Joerg Sonnenberger <joerg%britannica.bec.de@localhost> wrote:

> > getcontext/setcontext modify the signal mask, setjmp/longjmp don't.
> 
> OK, let me partially take that back. setjmp/longjmp may restore the
> signal mask, SUS leaves that as undefined behavior. As such it is valid
> to use getcontext/setcontext for that. Depending on the ABI patching the
> output of getcontext should be good enough for longjmp, e.g. set the IP
> to a ret and the return value register to the expected data.

Indeed, on NetBSD setjmp/longjmp seem to also save/restore the signal
mask, while sig* variants do it conditionally and _* variants only
save/restore registers, at least according to setjmp(3)...
-- 
Matt


Home | Main Index | Thread Index | Old Index