summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coro.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/coro.c b/coro.c
index 0eaa150..19b5d21 100644
--- a/coro.c
+++ b/coro.c
@@ -178,8 +178,21 @@ void coro_create(coro_context *ctx,
# elif CORO_LOSER
setjmp (ctx->env);
+#if __CYGWIN__
ctx->env[7] = (long)((char *)sptr + ssize);
ctx->env[8] = (long)coro_init;
+#elif defined(_M_IX86)
+ ((_JUMP_BUFFER *)&ctx->env)->Eip = (long)coro_init;
+ ((_JUMP_BUFFER *)&ctx->env)->Esp = (long)STACK_ADJUST_PTR (sptr,ssize);
+#elif defined(_M_AMD64)
+ ((_JUMP_BUFFER *)&ctx->env)->Rip = (__int64)coro_init;
+ ((_JUMP_BUFFER *)&ctx->env)->Rsp = (__int64)STACK_ADJUST_PTR (sptr,ssize);
+#elif defined(_M_IA64)
+ ((_JUMP_BUFFER *)&ctx->env)->StIIP = (__int64)coro_init;
+ ((_JUMP_BUFFER *)&ctx->env)->IntSp = (__int64)STACK_ADJUST_PTR (sptr,ssize);
+#else
+#error "microsoft libc or architecture not supported"
+#endif
# elif CORO_LINUX