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, Sep 01, 2009 at 02:53:36PM +0200, Joerg Sonnenberger wrote:
> On Tue, Sep 01, 2009 at 12:54:14AM -0700, Matt Thomas wrote:
> > So I'm thinking that in MIPS64, setjmp/longjmp can just be versions of  
> > getcontext/setcontext.
> > longjmp need to be able to set the return value, but that's a minor  
> > variation.
> >
> > Can anyone think of valid reasons not do that?
> 
> 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.

Joerg


Home | Main Index | Thread Index | Old Index