Bug in libcoro on PPC mac

View: New views
2 Messages — Rating Filter:   Alert me  

Bug in libcoro on PPC mac

by joh_90uk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
   I have been trying to build IO on a PPC mac but found it was crashing on a PPC mac. The problem appeared to be in libcoro, where the version of Coro_Start() used (one in the #else block) was using the structure globalCallbackBlock. However globalCallbackBlock was never set up. I changed this by making to look like this below:

#elif defined(_BSD_PPC_SETJMP_H_)

#define buf (self->env)
#define setjmp  _setjmp
#define longjmp _longjmp

void Coro_setup(Coro *self, void *arg)
{
        size_t *sp = (size_t *)(((intptr_t)Coro_stack(self)
                                                + Coro_stackSize(self) - 64 + 15) & ~15);

        setjmp(buf);

        //printf("self = %p\n", self);
        //printf("sp = %p\n", sp);
        buf[0]  = (long)sp;
        buf[21] = (long)Coro_Start;
        globalCallbackBlock.context=((CallbackBlock*)arg)->context;
        globalCallbackBlock.func=((CallbackBlock*)arg)->func;
        //sp[-4] = (size_t)self; // for G5 10.3
        //sp[-6] = (size_t)self; // for G4 10.4

        //printf("self = %p\n", (void *)self);
        //printf("sp = %p\n", sp);
}

Seems to work.


Re: Bug in libcoro on PPC mac

by Steve Dekorte :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 2009-05-25, at 2:42 AM, joh_90uk wrote:
>   I have been trying to build IO on a PPC mac but found it was  
> crashing on a PPC mac. The problem appeared to be in libcoro, where  
> the version of Coro_Start() used (one in the #else block) was using  
> the structure globalCallbackBlock. However globalCallbackBlock was  
> never set up. I changed this by making to look like this below:

Thanks joh_90uk - I'd added your fix.