diff --git a/context.c b/context.c index e975014..b17bf15 100644 --- a/context.c +++ b/context.c @@ -83,7 +83,7 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) memset(&ucp->uc_mcontext, 0, sizeof ucp->uc_mcontext); if(argc != 2) - *(int*)0 = 0; + *(volatile int*)0 = 0; va_start(va, argc); ucp->uc_mcontext.mc_rdi = va_arg(va, int); ucp->uc_mcontext.mc_rsi = va_arg(va, int); diff --git a/taskimpl.h b/taskimpl.h index e54f9e7..abf30e6 100644 --- a/taskimpl.h +++ b/taskimpl.h @@ -105,19 +105,17 @@ extern void makecontext(ucontext_t*, void(*)(), int, ...); #endif #if defined(__linux__) && defined(__amd64__) -typedef struct mcontext mcontext_t; -typedef struct ucontext ucontext_t; +# if defined(__i386__) +# include "386-ucontext.h" +# elif defined(__x86_64__) +# include "amd64-ucontext.h" +# endif extern int getmcontext(mcontext_t*); extern void setmcontext(const mcontext_t*); #define setcontext(u) setmcontext(&(u)->uc_mcontext) #define getcontext(u) getmcontext(&(u)->uc_mcontext) extern int swapcontext(ucontext_t*, const ucontext_t*); extern void makecontext(ucontext_t*, void(*)(), int, ...); -# if defined(__i386__) -# include "386-ucontext.h" -# elif defined(__x86_64__) -# include "amd64-ucontext.h" -# endif #endif #if defined(__APPLE__)