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



In article <20090901130545.GC3447%britannica.bec.de@localhost>,
Joerg Sonnenberger  <joerg%britannica.bec.de@localhost> wrote:
>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.

Well, you could clear the uc_flags for signal mask and fpu before calling
setcontext to implement this, no?

christos



Home | Main Index | Thread Index | Old Index