[M3devel] SaveRegsInStack

jay.krell at cornell.edu jay.krell at cornell.edu
Mon Nov 23 12:32:36 CET 2009


Understood/agreed.

One of the clients -- "ProcessLive"  --can merge this with itself,  
using &j before returning. Because it is already doing a setjmp and  
using &j.

The other -- in Sparc stack walker -- doesn't use the return address.
It appears to me maybe the Sparc stack walker flushes registers  
repeatedly when once suffices. ?

  - Jay (phone)

On Nov 22, 2009, at 5:37 AM, hendrik at topoi.pooq.com wrote:

> On Sun, Nov 22, 2009 at 05:02:53AM +0000, Jay K wrote:
>>
>>
>> void SaveRegsInStack(void)
>>
>> {
>>
>> #if defined(__sparc) || defined(__ia64__)
>>
>>  jmpbuf j;
>>
>>  if (!setjmp(j)) longjmp(j, 1);
>>
>> #endif
>>
>> }
>
> I don't know the context, so this may be OK, but what screams at me
> about this code is that upon returning from SaveRegsInStack j is  
> popped
> from the stack, as a local variable.  I hope there is some good reason
> to presume that that piece of stack isn't overwritten by, for example,
> another call, or a Unix signal handler.
>
> -- hendrik
>



More information about the M3devel mailing list