--- libcoro/coro.c 2003/03/22 23:08:40 1.10 +++ libcoro/coro.c 2005/03/21 14:35:22 1.15 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001 Marc Alexander Lehmann + * Copyright (c) 2001-2005 Marc Alexander Lehmann * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: @@ -48,7 +48,10 @@ #if CORO_SJLJ || CORO_LOOSE || CORO_LINUX || CORO_IRIX -#include +#if CORO_SJLJ +# include +# include +#endif static volatile coro_func coro_init_func; static volatile void *coro_init_arg; @@ -74,7 +77,7 @@ /* trampoline signal handler */ static void -trampoline(int sig) +trampoline (int sig) { if (setjmp (((coro_context *)new_coro)->env)) coro_init (); /* start it */ @@ -165,8 +168,8 @@ # elif CORO_LOOSE setjmp (ctx->env); - ctx->env[7] = (int)((char *)sptr + ssize); - ctx->env[8] = (int)coro_init; + ctx->env[7] = (long)((char *)sptr + ssize); + ctx->env[8] = (long)coro_init; # elif CORO_LINUX @@ -182,6 +185,9 @@ #elif defined(__GNU_LIBRARY__) && defined(__i386__) ctx->env[0].__jmpbuf[0].__pc = (char *)coro_init; ctx->env[0].__jmpbuf[0].__sp = (void *)((char *)sptr + ssize); +#elif defined(__GNU_LIBRARY__) && defined(__amd64__) + ctx->env[0].__jmpbuf[JB_PC] = (long)coro_init; + ctx->env[0].__jmpbuf[JB_RSP] = (long)((char *)sptr + ssize); #else #error "linux libc or architecture not supported" #endif