… | |
… | |
30 | * go to Ralf S. Engelschall <rse@engelschall.com>. |
30 | * go to Ralf S. Engelschall <rse@engelschall.com>. |
31 | */ |
31 | */ |
32 | |
32 | |
33 | #include "coro.h" |
33 | #include "coro.h" |
34 | |
34 | |
35 | #if CORO_SJLJ || CORO_LOOSE || CORO_LINUX || CORO_IRIX |
|
|
36 | |
|
|
37 | /* IRIX is decidedly NON-unix */ |
35 | /* IRIX is decidedly NON-unix */ |
38 | #if __sgi |
36 | #if __sgi |
39 | # define STACK_ADJUST(sp,ss) ((ss) - sizeof (long) + (char *)(sp)) |
37 | # define STACK_ADJUST(sp,ss) ((char *)(sp) + (ss) - 8) |
40 | #else |
38 | #else |
41 | # define STACK_ADJUST(sp,ss) (ss) |
39 | # define STACK_ADJUST(sp,ss) (sp) |
42 | #endif |
40 | #endif |
|
|
41 | |
|
|
42 | #if CORO_SJLJ || CORO_LOOSE || CORO_LINUX || CORO_IRIX |
43 | |
43 | |
44 | #include <signal.h> |
44 | #include <signal.h> |
45 | |
45 | |
46 | static volatile coro_func coro_init_func; |
46 | static volatile coro_func coro_init_func; |
47 | static volatile void *coro_init_arg; |
47 | static volatile void *coro_init_arg; |
… | |
… | |
180 | #endif |
180 | #endif |
181 | |
181 | |
182 | # elif CORO_IRIX |
182 | # elif CORO_IRIX |
183 | |
183 | |
184 | setjmp (ctx->env); |
184 | setjmp (ctx->env); |
185 | ctx->env[JB_PC] = (int)coro_init; |
185 | ctx->env[JB_PC] = (__uint64_t)coro_init; |
186 | ctx->env[JB_SP] = (int)((char *)sptr + ssize); |
186 | ctx->env[JB_SP] = (__uint64_t)STACK_ADJUST(sptr,ssize); |
187 | |
187 | |
188 | # endif |
188 | # endif |
189 | |
189 | |
190 | coro_transfer ((coro_context *)create_coro, (coro_context *)new_coro); |
190 | coro_transfer ((coro_context *)create_coro, (coro_context *)new_coro); |
191 | |
191 | |